Search code examples
amchartsamcharts4

Amchart : show legends for specific series only


I have a graph that mixes column and line charts. I would like to display the legend only for the column chart.

My full code is available here: https://codepen.io/European-DataLab/pen/wVJKrN?editors=0010

Here, is the code for the legend :

// Legend settings
series.name = "Période référence";
series2.name = "Cotisation minimale";
chart.legend = new am4charts.Legend();
chart.legend.position = "top";
chart.legend.align = "center";

In my example, the legend for the two lines is shown. Here is my output: enter image description here

However, I would like to have this output: enter image description here


Solution

  • May be setting the hiddenInLegend property to true

    series.hiddenInLegend = true;
    

    This should work as per the documentation below

    https://www.amcharts.com/docs/v4/reference/series/#hiddenInLegend_property