Page 1 of 1

how to programmatically hide intervals?

Posted: Thu Apr 21, 2022 8:52 am
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

Re: how to programmatically hide intervals?

Posted: Thu Apr 21, 2022 9:15 am
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.

Re: how to programmatically hide intervals?

Posted: Thu Apr 21, 2022 10:21 am
by dmasterplan
I put it in Chart's Before Print event but it triggered 5 errors. Please help!

Re: how to programmatically hide intervals?

Posted: Thu Apr 21, 2022 10:38 am
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

Re: how to programmatically hide intervals?

Posted: Thu Apr 21, 2022 12:53 pm
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.

Re: how to programmatically hide intervals?

Posted: Thu Apr 21, 2022 3:12 pm
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.

Re: how to programmatically hide intervals?

Posted: Fri Apr 22, 2022 12:03 am
by dmasterplan
Great thanks! You guys are enormous help!

Re: how to programmatically hide intervals?

Posted: Fri Apr 22, 2022 11:51 am
by Max Shamanov
Hello,

You are welcome.