Search code examples
amcharts5lineseries

How to add a mouseover event for LineSeries in amCharts 5?


I want to add a mouseover event for a LineSeries in amCharts 5.

My try, but nothing happens:

series.strokes.template.interactionsEnabled = true;
series.strokes.template.events.enableType("pointerover");
series.strokes.template.events.on("pointerover", function(ev) {
  console.log("pointerover event", ev.target);
});

Solution

  • That does look like the correct syntax, and I have it working in this CodePen example: amCharts5 LineSeries with open data fields #DDV. (Note that for some reason I do not receive the dataContext attribute on the event target, as I would expect)

      series.strokes.template.events.on("pointerover", function(ev){
        console.log(ev.target);
      });