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

685 Views Asked by At

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);
});
1

There are 1 best solutions below

0
Dan Overlander On BEST ANSWER

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);
  });