I have a jqplot pie chart with a legend and I would like to get the legend text to appear as a tooltip when the mouse hovers on the pies. I’m not sure how to do that. Does anyone have any experience doing similar?
example code:
$(document).ready(function(){
var data = [['Heavy Industry', 12],['Retail', 9], ['Light Industry', 14],['Out of home', 16],['Commuting', 7], ['Orientation', 9]];
var plot1 = jQuery.jqplot ('chart1', [data],
{
seriesDefaults: {
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
showDataLabels: true
}
},
legend: { show:true, location: 'e' }
}
);
});
You need to bind the jqplot data highligh and unhighligh events, grab the data you want to show and set the chart containing div’s title attribute.
The following code shows the title in the format of “x: y”, where x is the legend label and y is the value:
This piece of code is being used in my system which works with no problem.