Amchart4 single click double click event

Viewed 183

I using Amchartv4 piechart and have 2 different function each on single click event and double click event. I using the amchart hit event and double hit event on the piechart slices. When I double click it will also trigger the single click event.

How do I prevent single click event when double click?

const pieSeries = chart.series.push(new am4charts.PieSeries());

const slice = pieSeries.slices.template;

slice.events.on(
        'hit',
        function (ev) {
         const value = ev.target.dataItem.properties.category;
          this.singleClick(value);
        },
        this
      );

      slice.events.on(
        'doublehit',
        function (ev) {
          const value = ev.target.dataItem.properties.category;
          this.doubleClick(value);
        },
        this
      );
0 Answers
Related