Serie Labels from code behind

Stimulsoft Reports.NET discussion
Post Reply
jorgeto
Posts: 42
Joined: Tue Aug 16, 2011 4:49 pm
Location: Lima

Serie Labels from code behind

Post by jorgeto »

Hi,

I need to create a chart with pie series from code behind. Everything works ok, but I can't show the series labels.

Here is my code:

for (int i = 1; i <= ds.Tables.Count; i++)
{
StiChart chart = new StiChart();
chart.ClientRectangle = new RectangleD(x, y, 8.0, 8.0);
chart.Name = "Grafico" + i;
StiPieSeries serie = new StiPieSeries();
StiCenterAxisLabels label = new StiCenterAxisLabels();
label.Chart = chart;
label.LegendValueType = StiSeriesLabelsValueType.Argument;
label.ValueType = StiSeriesLabelsValueType.Value;
label.LabelColor = System.Drawing.Color.Black;
serie.SeriesLabels = label;
serie.SeriesLabels.Chart = chart;
serie.ShowSeriesLabels = StiShowSeriesLabels.FromChart;


serie.ArgumentDataColumn = "Datos2.name";
serie.ValueDataColumn = "Datos2.valor";
chart.Legend.VertAlignment = StiLegendVertAlignment.Center;
chart.Legend.HorAlignment = StiLegendHorAlignment.RightOutside;
chart.SeriesLabels.LegendValueType = StiSeriesLabelsValueType.Argument;
chart.SeriesLabels.ValueType = StiSeriesLabelsValueType.Value;

chart.Series.Add(serie);

report.Pages[1].Components.Add(chart);

x += 10;
if (x == 20.5)
{
y += 10;
x = 0.5;
}
}


Thanks.

Daniel
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Serie Labels from code behind

Post by HighAley »

Hello.

Chart is very complicated component.
Try to create a chart in the Designer and then look at the code on the Code tab.

Thank you.
Post Reply