By Alex Efimov - Wednesday, August 11, 2010
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.
|
By Nevron Support - Thursday, August 12, 2010
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);
|
By Alex Efimov - Friday, August 13, 2010
Thanks.
|
|