Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQPlot Highlighter - Different highlighter options for each series

Tags:

jquery

jqplot

I have a jQPlot line graph with three different series on it and am using the Highlighter plug in to show hover overs on the data points in each series. I'd like to use different options for highlighter for each line in the graph.

Lines 1 and 2 need to show the y value and line 3 needs to show the y value as well as a message. For example, the hover over on line 1 would be "10" but line 3 needs to be "Target = 25".

I can't seem to find any way to specify different options for each specific series. Any help would be much appreciated.

like image 888
nolt2232 Avatar asked Dec 27 '22 05:12

nolt2232


1 Answers

Add a highlighter object to each series and specify the format string. Here's an example script with two series:

var series1 = [[1, 2], [2, 3], [3, 4]]; 
var series2 = [[6, 7], [7, 8], [8, 9]]; 

var plot = $.jqplot('chart1', [series1, series2],
{
  series:[
      {
          highlighter: {formatString: "%d"}
      },         
      {
          highlighter: {formatString: "Target = %d"}
      }
  ],

  highlighter: {show: true}
}
like image 110
Kryptic Avatar answered Apr 07 '23 12:04

Kryptic