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

Set line color of CartesianChartGrid

1 Answer 318 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Gitle
Top achievements
Rank 1
Gitle asked on 04 Sep 2018, 11:21 AM

Hi, I have a chart that display gridlines using the cartesianchartgrid, defined like this in xaml:

<telerik:RadCartesianChart.Grid>
    <telerik:CartesianChartGrid MajorLinesVisibility="XY"/>
</telerik:RadCartesianChart.Grid>

 

But I can't figure out how to change the color of the gridlines. I don't see any brush or color properties for it on the class, changing the foreground etc brush does not work.

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 07 Sep 2018, 09:37 AM
Hi Gitle,

The color of the grid lines can be changed by applying custom MajorYLineStyle and MajorXLineStyle as shown below:

<telerik:CartesianChartGrid MajorLinesVisibility="XY">
    <telerik:CartesianChartGrid.MajorYLineStyle>
        <Style TargetType="{x:Type Line}">
            <Setter Property="Stroke" Value="Red"/>
        </Style>
    </telerik:CartesianChartGrid.MajorYLineStyle>
    <telerik:CartesianChartGrid.MajorXLineStyle>
        <Style TargetType="{x:Type Line}">
            <Setter Property="Stroke" Value="Green"/>
        </Style>
    </telerik:CartesianChartGrid.MajorXLineStyle>
</telerik:CartesianChartGrid>

Hope this helps. If you have any other questions - please let us know.

Regards,
Kalin
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ChartView
Asked by
Gitle
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or