Profile Picture

Is there a way to sort the legend items?

Posted By Alex Efimov 14 Years Ago
Author
Message
Alex Efimov
Posted 14 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 14 Years Ago
Posts: 5, Visits: 1
Thanks.

Nevron Support
Posted 14 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: Last Week
Posts: 3,054, Visits: 4,009
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
Posted 14 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 14 Years Ago
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.



Similar Topics


Reading This Topic