在jQuery Flot"plotclick"事件中获取单击的标签

Mar*_* M. 6 jquery events click flot

所以我在jQuery中有一个方法来捕获我的Flot图表上的点击事件:

$("#placeholder").bind("plotclick", function (event, pos, item) {
    alert("clicked");
});
Run Code Online (Sandbox Code Playgroud)

我知道item ['datapoint']数组中的点击值.但是我在哪里可以找到我点击的曲线标签?

谢谢.

Mar*_*ark 7

看看item.series.label:

$("#placeholder").bind("plotclick", function (event, pos, item) {
    if (item) { 
        alert(item.series.label);
    }
});
Run Code Online (Sandbox Code Playgroud)

小提琴这里.