Profile Picture

Hiding series from the legend

Posted By Rick Shaban 11 Years Ago
Author
Message
Rick Shaban
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 6, Visits: 1
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

Attachments
Working.png (129 views, 36.00 KB)
Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi Rick,

You need to use:

someSeries.Legend.Mode = SeriesLegendMode.None;

In order to hide the series from the legend.



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic