Search code examples
tooltipamcharts

Why is my AmChart XYChart only showing a single tooltip for multiple series?


I'm using AmCharts v4 to create an XYChart with 3 series. When each series is created, I assign a tooltip:

series.tooltipText = "{name}: [bold]{valueY}[/]";

However, the chart ends up displaying only a single tooltip (Temperature: -50).

Single tooltip, multiple series

There are many questions on StackOverflow about the opposite problem: users seeing multiple tooltips displayed by default, when they want to see a single combined tool-tip. For example, I want my chart to look like the one in this question:

Amcharts 4, xychart, limiting the number of tooltips and combining infos in one tooltip

How is it possible that I have created 3 series, each is displayed correctly, each has a tooltip assigned, but I only see one tooltip when hovering?


Solution

  • Ok, the explanation is: I was creating a chart and pushing my data directly to chart.data.

    It turns out that I need to push the series-specific datapoints to series.data individually for each series. Then I get a separate tool-tip for each series. This concept is explained here:

    https://www.amcharts.com/docs/v4/concepts/series/