Hi Timothy,
Yes, you can easily display a legend with a single item (or any custom number of items), when you set the legend mode property to manual. The following code shows how to create a
chart with two
series and a legend that displays a single legend item:
N
Chart chart = n
ChartControl1.
Charts[0];
for (int i = 0; i < 2; i++)
{
NBar
Series bar
Series = new NBar
Series();
bar
Series.MultiBarMode = MultiBarMode.Clustered;
bar
Series.Values.Add(10);
bar
Series.Values.Add(20);
bar
Series.Values.Add(30);
chart.
Series.Add(bar
Series);
}
NLegend legend = n
ChartControl1.Legends[0];
legend.Mode = LegendMode.Manual;
NLegendItemCellData legendItem = new NLegendItemCellData("Single Legend Item", LegendMarkShape.Rectangle);
legendItem.MarkFillStyle = new NColorFillStyle(Color.Red);
legendItem.MarkLineStyle.Width = new NLength(0);
legend.Data.Items.Add(legendItem);
You can also take a look at "All Examples \ Panels \ Legend" group of examples for more examples of how to configure the legend.
We hope this helps - let us know if you have any questions or meet any problems.
Best Regards,
Nevron Support Team