O'Reilly logo

Learning jqPlot by Scott Gottreu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding an event handler for our stacked area chart

We wrap up the chart and move on to working on the stacked area chart from yesterday. We will create an event handler for the jqplotDataHighlight method. When a user hovers over a stacked area, we will populate a table with the current series data.

There are a few differences between this event handler and the one we used with our bar chart. We will use seriesIndex instead of pointIndex to access the data we need. For stacked charts, nothing is passed through pointIndex, so it will return null. Also, with the data parameter, it is an array of all the data points for the highlighted line.

Since we passed in date values originally, we might expect to have access to them in our callback. Not quite; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required