Is there a way to sort the legend items?


Author
Message
Alex Efimov
Alex Efimov
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)
Group: Forum Members
Posts: 5, Visits: 1
Hi.
I have a chart with several different series. Some of the series are set to display the legend items, some are not. What I want to do is to sort the legend items in a custom way.

How can I do this?

Thanks in advance.
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Alex,

The control over the automatic legend items is limited to changing the order in which they are added (through the series.Legend.Order property). If you need better control, you can use the legend in "manual" mode. The following code demonstrates how to add a legend item in this mode.

NLegend legend = nChartControl1.Legends[0];
legend.Mode = LegendMode.Manual;

NLegendItemCellData item0 = new NLegendItemCellData();
item0.Text = "Custom item";
item0.TextStyle.FontStyle = new NFontStyle("Arial", 9);
item0.MarkLineStyle = new NStrokeStyle(0, Color.Black);
item0.MarkBorderStyle = new NStrokeStyle(1, Color.Black);
item0.MarkFillStyle = new NColorFillStyle(Color.Red);
item0.MarkShape = LegendMarkShape.Rectangle;
legend.Data.Items.Add(item0);


Best Regards,
Nevron Support Team


Alex Efimov
Alex Efimov
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)
Group: Forum Members
Posts: 5, Visits: 1
Thanks.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search