This is a demo tutorial. While there is no step-by-step commentary available (yet), the live demo below is fully functional. Feel free to open it for full source code.
This demo shows how we can selectively add series to legend, then toggle multiple series with a single legend item.
The code uses series' on()
method to watch for changes in its visible
setting, which is triggered when series is toggled via legend. It then hides or shows related series.
It also uses series' legendLabelText
to consolidate multiple series names and their values into a single legend item.
See the Pen
Grouping several series into single legend item by amCharts team (@amcharts)
on CodePen.0