Page 1 of 1

Getting data into a chart

Posted: Wed Mar 21, 2007 6:14 am
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?

Getting data into a chart

Posted: Wed Mar 21, 2007 8:07 am
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.

Getting data into a chart

Posted: Wed Mar 21, 2007 8:13 am
by ikirck
I tried this, but sadly, it has the same result. The chart still shows only the title, but nothing else.

Getting data into a chart

Posted: Wed Mar 21, 2007 8:14 am
by Vital
Can you show other code you are use before and after provided code?

Getting data into a chart

Posted: Wed Mar 21, 2007 8:18 am
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.

Getting data into a chart

Posted: Wed Mar 21, 2007 8:53 am
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.

Getting data into a chart

Posted: Wed Mar 21, 2007 8:58 am
by ikirck
Thanks a lot, it works fine now.

Getting data into a chart

Posted: Wed Mar 21, 2007 9:00 am
by Vital
Please contact us if you need any help.