setting chart series values at runtime

Stimulsoft Reports.WEB discussion
Post Reply
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

setting chart series values at runtime

Post 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
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: setting chart series values at runtime

Post 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.
Post Reply