Add a constant line to the report

Stimulsoft Reports.NET discussion
Post Reply
mihiri1
Posts: 12
Joined: Tue May 15, 2012 3:00 am
Location: Brisbane, QLD

Add a constant line to the report

Post by mihiri1 »

On Chart component, there is a option to add a constant line, But that constant value has to be hard coded at design time. Is it possible that this can be set at run time?

I use SS 2011.1.919
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Add a constant line to the report

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

StiChart chart1 = report.GetComponents()["Chart1"] as StiChart;

Stimulsoft.Report.Chart.StiConstantLines line1 = new Stimulsoft.Report.Chart.StiConstantLines();
line1.LineColor = System.Drawing.Color.Black;
line1.Text = "Constant Line 1";
line1.AxisValue = "2";

chart1.ConstantLines.Clear();
chart1.ConstantLines.AddRange(new Stimulsoft.Report.Chart.IStiConstantLines[] {
            line1 });
Thank you.
mihiri1
Posts: 12
Joined: Tue May 15, 2012 3:00 am
Location: Brisbane, QLD

Re: Add a constant line to the report

Post by mihiri1 »

Hi Thanks, It works.

Is there any way that I can set the Constant lien Text to appear on the Right, instead of the Left?
Or is there a way I can make a separate legend for the constant lines.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Add a constant line to the report

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

line1.Position = Stimulsoft.Report.Chart.StiConstantLines.StiTextPosition.RightTop;
Thank you.
mihiri1
Posts: 12
Joined: Tue May 15, 2012 3:00 am
Location: Brisbane, QLD

Re: Add a constant line to the report

Post by mihiri1 »

hi

Tried settting line1.Position = Stimulsoft.Report.Chart.StiConstantLines.StiTextPosition.RightTop;
But it makes the label to go completely disappeared.

However I tried LeftTop/ LeftBottom which worked all right.

Any idea about why RightTop/RightBottom do no work?

Thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Add a constant line to the report

Post by Alex K. »

Hello,

The issue is fixed.
Please check the next prerelease build which will be available today.

Thank you.
Post Reply