Search code examples
flot

Is there a way to trigger plotselected event without triggering plotclick event?


I need click events in the chart. But I also need to allow user to select a range to zoom in.

Click events are registered properly. However on doing a selection, it triggers both plotselected and plotclick events.

How do I prevent the plotclick event from being triggered while plotselected is triggered?

Selection plugin: https://github.com/flot/flot/blob/master/jquery.flot.selection.js


Solution

  • The problem is plotselected triggering plotclick event.

    The following conditional check solved my problem.

    $("#graph").bind("plotclick", function (event, pos, item) {
            if (item == undefined) return false;
            // the rest of the click event here
    });