How to hide or remove a specific series among multiple series in a WinForms Chart?
Hiding a Series
In WinForms Chart control, hide a particular series by setting its Visible property to false. This will prevent the series from being rendered on the chart while keeping it available internally. Other series can be displayed normally by setting their Visible property to true.
this.chartControl1 = new ChartControl();
...
// Hiding and showing specific series
this.chartControl1.Series[0].Visible = false;
this.chartControl1.Series[1].Visible = true;Me.chartControl1 = New ChartControl()
...
' Hiding and showing specific series
Me.chartControl1.Series(0).Visible = False
Me.chartControl1.Series(1).Visible = TrueFor more details, refer to the WinForms Chart documentation.
Adding and Removing Series
If you need to add or remove a specific series, you can use the Add and Remove methods in ChartSeries to add new series or remove existing ones.
this.chartControl1 = new ChartControl();
...
// Adding a series
this.chartControl1.Series.Add(series1);
// Removing a series
this.chartControl1.Series.Remove(series2);Me.chartControl1 = New ChartControl()
...
' Adding a series
Me.chartControl1.Series.Add(series1)
' Removing a series
Me.chartControl1.Series.Remove(series2)Conclusion
I hope you enjoyed learning about how to hide or remove a specific series among multiple series in a WinForms Chart.
You can refer to our WinForms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms Chart examples to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!