How to toggle visibility of a series on a chart in Microsoft Forms?

166 Views Asked by At

I am making a Microsoft Forms program in Visual Basic for a college project. As part of this I have a chart with a number of series on it. How would I go about changing one of these series to be not visible on the chart? I have tried to read the documentation on the Chart component but have not found a solution

How I created the series:

GraphDisplay.Series.Add(Country1Name)

Where GraphDisplay is the name of my chart, and Country1Name is the name of the series

1

There are 1 best solutions below

0
On

It would help if you posted some of your code, specifically how the series is added to the chart, but assuming you have a Series object, this is generally how you would hide the series. Change the Enabled property to False

Dim s As New Windows.Forms.DataVisualization.Charting.Series()
s.Enabled = False

From the documentation:

Gets or sets a flag that indicates whether the series will be visible on the rendered chart.