VerticatGridLines color

2 posts, 0 answers
  1. Maxim
    Maxim avatar
    10 posts
    Member since:
    May 2009

    Posted 29 Jul 2009 Link to this post

    Hello

    How can I change color of vertical and horizontal gridlines in chart?


    Thank You.
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 31 Jul 2009 Link to this post

    Hi Maxim,

    You can achieve the desired effect like this:

    <UserControl x:Class="SilverlightApplication1.Page"  
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"   
        xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
     
        <Grid x:Name="LayoutRoot" Background="White"
            <Grid.Resources> 
                <Style x:Name="CustomGridLineStyle" TargetType="telerikCharting:GridLine2DBase" > 
                    <Setter Property="Stroke" Value="Yellow" /> 
                </Style> 
            </Grid.Resources> 
             
            <telerik:RadChart x:Name="RadChart1" /> 
        </Grid> 
    </UserControl> 

    RadChart1.DefaultView.ChartArea.AxisX.AxisStyles.GridLineStyle = this.CustomGridLineStyle; 
    RadChart1.DefaultView.ChartArea.AxisY.AxisStyles.GridLineStyle = this.CustomGridLineStyle; 
    RadChart1.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible; 
    RadChart1.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible; 
     
    RadChart1.ItemsSource = new[] {21, 14, 1, 44, 6, 21, 43, 1, 60}; 


    More information on axis styling can be found here.


    Kind regards,
    Manuel
    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.
Back to Top