programmatically set labels

Stimulsoft Reports.NET discussion
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

programmatically set labels

Post by dmasterplan »

How can I programmatically set Labels?
this.ChartName.?

I want my Label to be set to "Value"
Attachments
labels - value.png
labels - value.png (166.97 KiB) Viewed 1261 times
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: programmatically set labels

Post 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
ulli82
Posts: 47
Joined: Tue Jul 06, 2021 6:46 am

Re: programmatically set labels

Post by ulli82 »

A little patience would be advisable ;) This forum is not your personal coach...
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: programmatically set labels

Post 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!
Lech Kulikowski
Posts: 7338
Joined: Tue Mar 20, 2018 5:34 am

Re: programmatically set labels

Post 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.
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: programmatically set labels

Post 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)
Lech Kulikowski
Posts: 7338
Joined: Tue Mar 20, 2018 5:34 am

Re: programmatically set labels

Post by Lech Kulikowski »

Hello,

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

Thank you.
Attachments
Screenshot 2022-05-03 154744.png
Screenshot 2022-05-03 154744.png (76.59 KiB) Viewed 1205 times
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: programmatically set labels

Post 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
Lech Kulikowski
Posts: 7338
Joined: Tue Mar 20, 2018 5:34 am

Re: programmatically set labels

Post by Lech Kulikowski »

Hello,

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

Thank you.
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: programmatically set labels

Post 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();
}
Post Reply