We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

how to set the grid color

Thread ID:

Created:

Updated:

Platform:

Replies:

130186 Apr 26,2017 11:04 AM May 2,2017 12:00 AM UWP 6
loading
Tags: SfChart
Theo
Asked On April 26, 2017 11:04 AM

Hi, How can I set the grid colors (major)? They do not take the color of the custom axis, so how can I set this in C#/VB.net?
Thanks.


Devi Aruna Maharasi Murugan [Syncfusion]
Replied On April 27, 2017 04:31 AM

Hi Theo, 
  
Thanks for contacting Syncfusion Support. 
  
We can customize the axis gridline color with the MajorGridLineStyle property of chart axis and it can be set as shown in the below code snippet, 
SfChart chart = new SfChart(); 
chart.PrimaryAxis = new NumericalAxis(); 
chart.SecondaryAxis = new NumericalAxis(); 
 
Style gridLineStyle1 = new Style(typeof(Line)); 
gridLineStyle1.Setters.Add(new Setter(Line.StrokeProperty, new  
                          SolidColorBrush(Colors.OrangeRed))); 
Style gridLineStyle2 = new Style(typeof(Line)); 
gridLineStyle2.Setters.Add(new Setter(Line.StrokeProperty, new  
                             SolidColorBrush(Colors.DeepSkyBlue))); 
 
chart.PrimaryAxis.MajorGridLineStyle = gridLineStyle1; 
chart.SecondaryAxis.MajorGridLineStyle = gridLineStyle2; 
  
Please find the output screenshot, 
 
 
  
We have prepared a simple demo sample for your reference and it can be downloaded from below link, 
  
Sample: GridLineColor 
  
Regards, 
Devi 
 





Theo
Replied On April 28, 2017 01:42 PM

Hi Devi,

Thanks....however, I can not get the style "Style(typeof(Line))" on my side. Am I missing something? Inside my development I do not have the option "line" as a type of style.
Sorry if I didn't mention but it is UWP (not sure if this is the issue).

Any ideas?

Regards

Santhiya Arulsamy [Syncfusion]
Replied On May 1, 2017 10:49 AM

Hi Theo,

Thanks for the update.

We are unable to reproduce the problem in our end. Line is the Framework element and it is under the Windows.UI.Xaml.Shapes namespace. Could you please check with your sample? If the issue still persists, then revert us the modified sample based on your application along with replication procedure to validate the issue.

Thanks,
Santhiya A

Santhiya Arulsamy [Syncfusion]
Replied On May 1, 2017 10:51 AM

Hi Theo,

Thanks for the update.

We are unable to reproduce the problem in our end. Line is the Framework element and it is under the Windows.UI.Xaml.Shapes namespace. Could you please check with your sample? If the issue still persists, then revert us the modified sample based on your application along with replication procedure to validate the issue.

Thanks,
Santhiya A

Theo
Replied On May 1, 2017 01:59 PM

Hi,

Oke, I got it...sorry...had too many problems with VS2017 to think straight (!)....I added the namespace manually, and got it - thanks!

Regards,


Devi Aruna Maharasi Murugan [Syncfusion]
Replied On May 2, 2017 12:00 AM

Hi Theo, 
  
Thanks for your update. 
  
Please let us know, if you need any further assistance on this. 
  
Regards, 
Devi 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;