Question

I am using jqplot 1.0.8 and experience problems with the CategoryAxisRenderer. The y-axis displays numeric values and the x-axis displays either numeric values or string values. That is why I chose the CategoryAxisRenderer. Basically, everything is rendered correctly except for the highlighter. If I hover over a point, I do not get the value for the x-axis, but instead, I get only the index of the value.

Initialization

PLOT = $.jqplot(that.getId() + '-CONTENT', [array], {
    width: $('#' + elemId).width() - 30,
    height: 500,
    axesDefaults: {
        tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
    },
    axes: {
        xaxis: {
            renderer: $.jqplot.CategoryAxisRenderer,
            tickOptions: {
                angle: -90,
                fontSize: '8pt'
            }
        },
        yaxis:{
            min:1
        }
    },
    highlighter: {
        show: true,
        tooltipLocation: 'ne',
        sizeAdjust: 7.5,
        useAxesFormatters: false,
        formatString: '%s, %d'
    },
    cursor: {
        show: false
    }
});

Output

enter image description here enter image description here

Expected results

1) 1978, 1

2) University of Ljubljana, 37

Was it helpful?

Solution 2

If you want to display the categorized x-axis values, you have to follow this workaround: https://groups.google.com/d/msg/jqplot-users/ZeXgxATxMyI/Fs3DnBAecu0J

OTHER TIPS

I got the exactly same problem and my own solution is that customize the tooltip using tooltipContentEditor.

highlighter: {
            tooltipContentEditor: function (str, seriesIndex, pointIndex, plot) {
                var content = plot.axes.xaxis.ticks[pointIndex] + ", " + str.split(',')[1];
                return content;
            }
        },
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top