This is a migrated thread and some comments may be shown as answers.

how to change the PlotArea appearence ???

5 Answers 133 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gerald
Top achievements
Rank 1
Gerald asked on 19 May 2009, 11:09 AM
Dear community,

for what ever reason it seems to be impossible to change the PlotArea color or to show major gridlines. I want my PlotArea plain white and major gridlines in grey. That's why I used the following code to achieve that:

 

_gideonChart.PlotArea.Appearance.FillStyle.MainColor = Color.White;  
_gideonChart.PlotArea.Appearance.FillStyle.SecondColor = Color.White;  
 
_gideonChart.PlotArea.YAxis.Appearance.MajorGridLines.Color = Color.Gray;  
_gideonChart.PlotArea.YAxis.Appearance.MajorGridLines.Width = 1;  
_gideonChart.PlotArea.YAxis.Appearance.MajorGridLines.PenStyle = DashStyle.Solid; 

 

 

Unfortunately the above code has no effect. Am I using the wrong properties? What are the right once then?
What else might prevent the changes from showing up?

Help would be highly appreciated.
Thanks in advance and kind regards,

Gerald

 

 

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 19 May 2009, 01:00 PM
Hello Gerald,

The code you've pasted here is correct, I've just tried this one in a sample report:

 this.chart1.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.Color.White; 
 this.chart1.PlotArea.Appearance.FillStyle.SecondColor = System.Drawing.Color.White; 
 this.chart1.PlotArea.XAxis.Appearance.MajorGridLines.Color = System.Drawing.Color.Gray; 
 this.chart1.PlotArea.YAxis.Appearance.MajorGridLines.Color = System.Drawing.Color.Gray; 

and it works properly as can be seen from the attached screenshot. Is_gideonChart your definition chart item and are you setting this in the report constructor? Note that all these properties can be set from the chart property grid as well in case they would be hardcoded.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Gerald
Top achievements
Rank 1
answered on 19 May 2009, 01:16 PM
Hi Steve,

I set the properties in the constructor after the InitializeComponent() call, then one step after the constructor - in the RenderingBegin event handler of the report viewer. And I also tried it in the NeedDataSource event handler.

Is there something else that might influence that properties? Maybe some Styles entries in the InitializeComponent() function? I found some Styles entries but nothing specifically related to PlotArea.

If you can think of something that can cause side effects please let me know.

Kind regards, Gerald
0
Steve
Telerik team
answered on 19 May 2009, 01:29 PM
Hi Gerald,

The RenderingBegin event handler is setup so that you can cancel the rendering if needed. It is not intended for report changing purposes and it would not work. This code however should work properly in both report constructor (i.e. the same as setting it through the designer) and in NeedDataSource event. I cannot think of what might interfere with it and you can try placing a chart item from scratch, setup those Appearance settings first and then all the other customization you're doing to pinpoint where the chain breaks.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Gerald
Top achievements
Rank 1
answered on 19 May 2009, 02:09 PM
Thanks Steve,

I did as you proposed. I edited the InitializeComponent() function and commented everything out that had to do with Styles.
And voila ... it worked. The downside is that I lost my margin settings.
Seems that it's not possible to explicitly override the Styles settings of the PlotArea.

Btw, I didn't insert any Styles stuff on purpose. It just happened somehow.

Thanks for your support, Gerald
0
Steve
Telerik team
answered on 19 May 2009, 02:27 PM
Hi Gerald,

It is still not clear what are the settings that caused the problem. The chart I've shown in the previous attachment is based on a "bare-bone" chart I used from scratch i.e. I have not applied anything else to it. So it must be something else that you've set that causes the issue. If still having problems, you can either paste you whole chart declaration here or give us a link to your report.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Gerald
Top achievements
Rank 1
Answers by
Steve
Telerik team
Gerald
Top achievements
Rank 1
Share this question
or