how to programmatically hide intervals?

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

how to programmatically hide intervals?

Post by dmasterplan »

Hello,

How to programmatically hide intervals?
These:
Area> Visible = True
Area > Y Axis > Line Color = Transparent

and how to do it if I want to set other properties?
How to figure it out?
View Code? How? (I'm not sure if I am asking the right question)


Great Thanks
Max Shamanov
Posts: 792
Joined: Tue Sep 07, 2021 10:11 am

Re: how to programmatically hide intervals?

Post by Max Shamanov »

Hello,

Use the following code:

Code: Select all

StiChart chart = report.GetComponentByName("Chart1") as StiChart;
StiClusteredBarArea area = chart.Area as StiClusteredBarArea;
// disable Y Axis visible
area.YAxis.Visible = false;
// or change labels color
area.YAxis.Labels.Color = Color.Transparent;
Thank you.
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: how to programmatically hide intervals?

Post by dmasterplan »

I put it in Chart's Before Print event but it triggered 5 errors. Please help!
Attachments
errors.png
errors.png (159.7 KiB) Viewed 386 times
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: how to programmatically hide intervals?

Post by dmasterplan »

I tried this and it worked. Is this the correct way of doing it?

this.Chart2_Area.BorderColor = System.Drawing.Color.Transparent;
this.Chart2_Area.YAxis.Visible = false;

Thanks
Last edited by dmasterplan on Thu Apr 21, 2022 12:59 pm, edited 1 time in total.
Max Shamanov
Posts: 792
Joined: Tue Sep 07, 2021 10:11 am

Re: how to programmatically hide intervals?

Post by Max Shamanov »

Hello,

Yes, this is the right way, if you want to hide the Y-axis, you can use your code in the Before Print event.

Thank you.
ulli82
Posts: 47
Joined: Tue Jul 06, 2021 6:46 am

Re: how to programmatically hide intervals?

Post by ulli82 »

Please note the following:
When a component will be rendered/prepared, a copy of the component may be created before. To ensure you are working on the right instance of the component, in the events you should use the object of the input parametert "sender" (which is of type object), which contains the current chart element in your sample. So better use something like "StiChart chart = sender as StiChart;" and make youre changes on this instance.
User avatar
dmasterplan
Posts: 143
Joined: Thu Mar 17, 2022 4:04 am
Location: Philippines

Re: how to programmatically hide intervals?

Post by dmasterplan »

Great thanks! You guys are enormous help!
Max Shamanov
Posts: 792
Joined: Tue Sep 07, 2021 10:11 am

Re: how to programmatically hide intervals?

Post by Max Shamanov »

Hello,

You are welcome.
Post Reply