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; when jqPlot takes in the data, it converts all of the date values to Unix timestamps. So, what we get in our callback are these timestamps.
We start by opening the file with our stacked chart. Below the existing chart, we set about adding in our new...