Getting data into a chart

Stimulsoft Reports.NET discussion
Post Reply
ikirck
Posts: 23
Joined: Fri Aug 25, 2006 4:25 am

Getting data into a chart

Post by ikirck »

Hello,

I'm trying to get a chart to show some manually compiled data. On the ChartBeforePrint-event, I use the following code:

Stimulsoft.Report.Chart.StiLineSeries seriesLine = new Stimulsoft.Report.Chart.StiLineSeries();
seriesLine.Title = "Anzahl Personen";
object[] arg = new object[3];
seriesLine.Arguments = arg;
seriesLine.Arguments[0] = "A";
seriesLine.Arguments[1] = "B";
seriesLine.Arguments[2] = "C";
double[] val = new double[3];
seriesLine.Values = val;
seriesLine.Values[0] = 1;
seriesLine.Values[1] = 5;
seriesLine.Values[2] = 7;
Chart1.Series.Add(seriesLine);

The resulting chart shows only the title of the series, but not the graph.

Could you please tell me if I am forgetting something?
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Getting data into a chart

Post by Vital »

This code will be work fine if you add chart to compiled report. In your case you add this chart to not compiled report. So you need use following code:

Code: Select all

Stimulsoft.Report.Chart.StiLineSeries seriesLine = new Stimulsoft.Report.Chart.StiLineSeries();
seriesLine.Title = "Anzahl Personen";
seriesLine.ListOfArguments.Value = "A;B;C";
seriesLine.ListOfValues.Value = "1;5;7";
Chart1.Series.Add(seriesLine);
Thank you.
ikirck
Posts: 23
Joined: Fri Aug 25, 2006 4:25 am

Getting data into a chart

Post by ikirck »

I tried this, but sadly, it has the same result. The chart still shows only the title, but nothing else.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Getting data into a chart

Post by Vital »

Can you show other code you are use before and after provided code?
ikirck
Posts: 23
Joined: Fri Aug 25, 2006 4:25 am

Getting data into a chart

Post by ikirck »

There is just this code. I'm using it in the Designer, in the BeforePrint-event of the chart. The chart is empty and should only have the series I add in the event code.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Getting data into a chart

Post by Vital »

Instead BeforePrintEvent please use ProcessChartEvent and following code:

Code: Select all

Stimulsoft.Report.Chart.StiChart chart = sender as Stimulsoft.Report.Chart.StiChart;
Stimulsoft.Report.Chart.StiLineSeries seriesLine = new Stimulsoft.Report.Chart.StiLineSeries();
seriesLine.Title = "Anzahl Personen";
object[] arg = new object[3];
seriesLine.Arguments = arg;
seriesLine.Arguments[0] = "A";
seriesLine.Arguments[1] = "B";
seriesLine.Arguments[2] = "C";
double[] val = new double[3];
seriesLine.Values = val;
seriesLine.Values[0] = 1;
seriesLine.Values[1] = 5;
seriesLine.Values[2] = 7;
chart.Series.Add(seriesLine);
Thank you.
ikirck
Posts: 23
Joined: Fri Aug 25, 2006 4:25 am

Getting data into a chart

Post by ikirck »

Thanks a lot, it works fine now.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Getting data into a chart

Post by Vital »

Please contact us if you need any help.
Post Reply