My chart is composed of multiple chart series. I have created a custom legend with buttons so the user can press a button and show or hide a chart series as desired. I have implemented a solution where the number of series are redefined after each button press but this requires a call to reloadData
which is an expensive operation.
How do I hide a chart series without calling reloadData
? I am looking for a solution that only requires the chart to be redrawn using redrawChart
.
SChartSeries
objects (from which all series types inherit) have ahidden
property. You can set this property toNO
orYES
to show or hide the series. You must callredrawChart
after changing the value.For example, the following method toggles the visibility of the first series in a chart: