Hi Igor,
The following code shows how to add custom legend items in manual mode:
using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;
namespace MyNamespace
{
/// <summary>
/// Sample class
/// </summary>
public class MyClass
{
/// <summary>
/// Main entry point
/// </summary>
/// <param name="context"></param>
public static void RSMain(NRSChartCodeContext context)
{
NLegend legend = context.document.Legends[0];
legend.Mode = LegendMode.Manual;
{
NLegendItemCellData licd = new NLegendItemCellData();
licd.MarkLineStyle.Width = new NLength(0);
licd.MarkFillStyle = new NColorFillStyle(Color.Red);
licd.ContentAlignment = ContentAlignment.MiddleLeft;
licd.Text = "Left aligned text";
legend.Data.Items.Add(licd);
}
{
NLegendItemCellData licd = new NLegendItemCellData();
licd.MarkLineStyle.Width = new NLength(0);
licd.MarkFillStyle = new NColorFillStyle(Color.Green);
licd.ContentAlignment = ContentAlignment.MiddleRight;
licd.Text = "Right aligned text";
legend.Data.Items.Add(licd);
}
{
NLegendItemCellData licd = new NLegendItemCellData();
licd.MarkLineStyle.Width = new NLength(0);
licd.MarkFillStyle = new NColorFillStyle(Color.Blue);
licd.ContentAlignment = ContentAlignment.MiddleCenter;
licd.Text = "Some long text in the middle";
legend.Data.Items.Add(licd);
}
}
}
}
Hope this helps - let us know if you meet any problems or have any questions.
Best Regards,
Nevron Support Team