Display the serie label in tooltip - hightlighter plugin

8,742 views
Skip to first unread message

Mathieu Laurent

unread,
Oct 16, 2009, 9:03:48 AM10/16/09
to jqplot-users
Hello,

It should be great to display the label of the serie in the tooltips
of the highlighter data points plugin.

Example :

var series = [
[3,2,1,1,3,3,2,1,2],
[4,4,6,11,13,13,15,15,15] ]
];

var options = {
series:[
{label:'serie name 1'},
{label:'serie name 2'}
],
highlighter: {
tooltipAxes: 'x',
formatString:'#serieLabel# - %s'
}
};

$.jqplot('chartdiv',series,options);

#serieLabel# w should be replace by the label of the serie.

Regards

Mathieu

Mathieu Laurent

unread,
Oct 16, 2009, 9:33:35 AM10/16/09
to jqplot-users
A simple solution :

Add in function showTooltip(plot, series, neighbor) { ... }

str = str.replace(/#serieLabel#/,series.label);

before

elem.html(str);

Regards

Mathieu

Mathieu Laurent

unread,
Oct 16, 2009, 10:30:48 AM10/16/09
to jqplot-users
Reply all
Reply to author
Forward
0 new messages