So I have a method in jQuery for catching click events on my Flot chart:
$("#placeholder").bind("plotclick", function (event, pos, item) {
alert("clicked");
});
I know the clicked values from item['datapoint'] array. But where can I find the label of curve I clicked?
Thanks.
Look at item.series.label
:
$("#placeholder").bind("plotclick", function (event, pos, item) {
if (item) {
alert(item.series.label);
}
});
Fiddle here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With