Question

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.

Was it helpful?

Solution

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}
}

OTHER TIPS

If you want the 'x' and 'y' values to get passed to the specific series highlighter without the format used in the axes.yaxis.tickOptions.formatString option, you can set the useAxesFormatters: false in the highlighter object applied to the series, so you can apply your personalized format to the raw values

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