I have a flot line graph and I really need to be able to get the legend of a point when it's clicked on. For example, I have a time series graph that I'm displaying and when the user clicks on a point I need to be able to get the value of the month they clicked on (ie 'Apr 2015'). I'm using a plotclick handler but in the item object I don't see a way to get to the information I need. Here's the options I'm using:
var options = {
xaxis: {
mode: "time",
timeformat: xTimeFormat
},
yaxis: {
},
series: {
lines: {
show: true
}
},
grid: {
hoverable: true,
clickable: true
},
tooltip: true,
tooltipOpts: {
xDateFormat: "%b %Y",
content: "<b>%x</b><br />%y"
}
};
$.plot($("#" + rowID + " .flotGraph"), series, options);
And the plotclick function:
$("#placeholder").on('plotclick', function(event, pos, item){
console.log(item);
});