Page 1 of 2

programmatically set labels

Posted: Mon May 02, 2022 2:44 pm
by dmasterplan
How can I programmatically set Labels?
this.ChartName.?

I want my Label to be set to "Value"

Re: programmatically set labels

Posted: Tue May 03, 2022 8:32 am
by dmasterplan
Hi Guys,

Did I break a rule or commit mistakes or anything? I am not getting an answer to my queries.

I want to apologize if I did. I'm really sorry. Please tell me what my violations are and I will not do it again.

Sincerely,

dmasterplan

Re: programmatically set labels

Posted: Tue May 03, 2022 9:19 am
by ulli82
A little patience would be advisable ;) This forum is not your personal coach...

Re: programmatically set labels

Posted: Tue May 03, 2022 9:26 am
by dmasterplan
ulli82 wrote: Tue May 03, 2022 9:19 am A little patience would be advisable ;) This forum is not your personal coach...
Alright. Thanks!

Re: programmatically set labels

Posted: Tue May 03, 2022 9:52 am
by Lech Kulikowski
Hello,

The best way - it is set the necessary option in the designer, then open the Code Tab, check the code, and use the similar code in the necessary place.

Thank you.

Re: programmatically set labels

Posted: Tue May 03, 2022 11:42 am
by dmasterplan
This is the way in setting the step in "Area", "X Axis" then in the properties "Labels" then "Step"
this.Chart3_Area.YAxis.Labels.Step = N

I just can't figure out the code for Labels (Chart Editor > Labels > Value)

Re: programmatically set labels

Posted: Tue May 03, 2022 1:48 pm
by Lech Kulikowski
Hello,

The next code:
this.Chart1.SeriesLabels = new Stimulsoft.Report.Chart.StiValueAxisLabels();

Thank you.

Re: programmatically set labels

Posted: Wed May 04, 2022 12:26 am
by dmasterplan
Hi,

Thanks for replying. I tried it inside the BeforePrint event of the chart, however, I am getting an error

Cannot implicitly convert type 'Stimulsoft.Report.Chart.StiValueAxisLabels' to
'Stimulsoft.Report.Chart.StiInsideBaseAxisLabels()'


this is my code:

Code: Select all

if(vTotalPackages == 200) {
	this.Chart3_SeriesLabels = new Stimulsoft.Report.Chart.StiValueAxisLabels();
} else {
	this.Chart3_SeriesLabels = new Stimulsoft.Report.Chart.StiInsideBaseAxisLabels();
}
I am changing the Label to "Value" when Packages = 200
otherwise change it to "InsideBase"



Great Thanks

Re: programmatically set labels

Posted: Wed May 04, 2022 6:24 am
by Lech Kulikowski
Hello,

You should use "this.Chart.SeriesLabels" not "this.Chart_SeriesLabels"

Thank you.

Re: programmatically set labels

Posted: Wed May 04, 2022 9:43 am
by dmasterplan
Hurray! It perfectly works!
Great thanks!

My code:

Code: Select all

if(vTotalPackages >= 200) {
	this.Chart3.SeriesLabels = new Stimulsoft.Report.Chart.StiValueAxisLabels();
} else {
	this.Chart3.SeriesLabels = new Stimulsoft.Report.Chart.StiInsideBaseAxisLabels();
}