I have multiple series in the chart though only need to display a few of them in the legend.
I tried:
RangeM.Legend.DisplayOnLegend.VisibilityMode = VisibilityMode.Hidden
and
RangeM.Legend.DisplayOnLegend.Visible = False
But then get the error "NullReferenceException was unhandled by user code" on this line. "Object reference not set to an instance of an object."
How can this be corrected?
Below is my legend setup:
Dim legend As NLegend = chartControl.Legends(0)
legend.Data.ExpandMode = LegendExpandMode.RowsFixed
legend.Data.RowCount = 1
legend.Dock = Windows.Forms.DockStyle.Top
legend.DockMargins = New NMarginsL(10, 10, 10, 5)
legend.VerticalBorderStyle.Color = NColor.ColorFromString("255,235,241,249")
legend.Margins = New NMarginsL(40, 10, 40, 10)
legend.BoundsMode = BoundsMode.Fit
legend.Data.CellMargins = New NMarginsL(10, 0, 10, 0)
legend.OuterBottomBorderStyle.Color = NColor.ColorFromString("255,235,241,249")
legend.OuterTopBorderStyle.Color = NColor.ColorFromString("255,235,241,249")
legend.OuterLeftBorderStyle.Color = NColor.ColorFromString("255,235,241,249")
legend.OuterRightBorderStyle.Color = NColor.ColorFromString("255,235,241,249")
legend.BoundsMode = BoundsMode.Fit
legend.FillStyle = New NColorFillStyle(NColor.ColorFromString("255,235,241,249"))
Best regards,
Rick