Search code examples
angulartypescriptamcharts4

How to hide a specific element in a series by default


I've created a stacked column chart in an angular application using Amcharts 4. I was wondering if there's a simple way to set a specific element in the legend series to be "hidden" by default. For example, I would like element1 to be "hidden" by default in the picture below.

stacked column picture

I understand how to hide the entire series using this method '.hide()' but not sure how to hide just a specific element from the series.

enter image description here


Solution

  • You can control if the series shows up in the lenged by setting hiddenInLegend like this: series.hiddenInLegend = true;.

    This way you can easily handle what series should be shown in the legend.

    I have created an example of a chart with the legend hidden for the first series. https://codepen.io/Kaehler/pen/ExoaOJY