Question

Am I right in thinking that the Hightlighter class in jqPlot does not handle tooltips for the PieRenderer? I've spent quite a while trying to get them to work however I can't seem to get it to show the tooltip.

If I am right, is there a way to handle the rollover of a segment and pass the data to a third party jQuery tooltip?

Thanks.

Was it helpful?

Solution 2

Looking through the issues for jqplot, it would seem that there have been a few requests for this functionality, but it has not yet been implemented.

Based on this question How to display tooltips on jqplot pie chart, you could wire up the jqplotDataHighlight and jqplotDataUnhighlight events:

$("#chartId").bind('jqplotDataHighlight', function(ev, seriesIndex, pointIndex, data) {

}); 

$("#chartId").bind('jqplotDataUnhighlight', function(ev, seriesIndex, pointIndex, data) {

});

There is a good example of using this technique to create custom tooltips here. Although it is dealing with bubble charts, it should point you in the right direction.

You could also try out the jqplot-highlighter plugin, which allows tooltips for pie charts.

OTHER TIPS

if you are using the Highlighter plugin, remember to set useAxesFormatters: false or it don't work.

highlighter: {
    show: true,
    useAxesFormatters: false, // must be false for piechart   
    tooltipLocation: 'w',
    formatString:'%s, %P',
}

It don't follow the mouse but it's set in the top left corner.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top