Page 1 of 1

setting chart series values at runtime

Posted: Fri Nov 03, 2017 2:28 pm
by cbrydon
Hello,

I am attempting to set the list of values and arguments for a line series on a chart in the BeforePrint event of the chart.
I've tried using the following code from another post as a guide, but can't quite figure out the correct syntax.

var chart = report.GetComponentByName("Chart1");
(((Stimulsoft.Report.Chart.StiAxis)(((Stimulsoft.Report.Chart.StiAxisArea)((chart as StiChart).Area)).XAxis)).Title).Text = "YourXAxisTitle";
(((Stimulsoft.Report.Chart.StiAxis)(((Stimulsoft.Report.Chart.StiAxisArea)((chart as StiChart).Area)).YAxis)).Title).Text = "YourYAxisTitle";
(((Stimulsoft.Report.Chart.StiAxis)(((Stimulsoft.Report.Chart.StiAxisArea)((chart as StiChart).Area)).YRightAxis)).Title).Text = "YourRightYAxisTitle";

I've tried code similar to the following, but I guess I don't quite understand the code I'm supposed to use.

var chart = report.GetComponentByName("Chart1");
chart.Series[0].ListOfValues = "12;14;16";

I get a message that says... 'Stimulsoft.Report.Components.StiComponent' does not contain a definition for 'Series'...

Can you point me in the right direction?
Is there a programmer's document/website that explains how to code like this?

Thanks,
Carl

Re: setting chart series values at runtime

Posted: Wed Nov 08, 2017 1:28 pm
by HighAley
Hello, Carl.

This code is not for the chart's event.
You should do this is your code before passing the report to the Viewer.
Here is a sample:

Code: Select all

var chart = report.GetComponentByName("Chart1");
((chart as StiChart).Series[0] as StiClusteredColumnSeries).ListOfValues.Value = "12;14;16";
Thank you.