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

RadCarthesianChart Grid Background not set

1 Answer 106 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Waut
Top achievements
Rank 1
Waut asked on 19 Sep 2013, 02:43 PM
Hello

I'm trying to set the background for my chart to a specific backgroundcolor. But I don't want the whole chart to be that color, just the grid itself. But if I set that background, the color doesn't change.

<telerik:RadCartesianChart.Grid>
 <telerik:CartesianChartGrid MajorLinesVisibility="X" MajorXLineStyle="{StaticResource StripLinesStyle}" Background="#D8D3D0"/>
 </telerik:RadCartesianChart.Grid>


Also I was trying to set the color of the axis, and I couldn't find that option. Attached is an image of what I'm trying to make, not minding the graphs itself ;)

Thanks
Waut

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 20 Sep 2013, 01:10 PM
Hi Waut,

Most of the chart elements are derived from classes from the WPF framework like Control or FrameworkElement which have large number properties/methods/events, many of which are are not applicable to the problem domain of the particular chart element. In many cases ChartView classes define their own members, or/and the framework members do not work.

To your questions:
1. To set a background, you need to set the Background property of the chart, instead of the chart grid. 
2. To set the axis color, you need to use the ElementBrush property. If you need to change the axis label color, you need use the LabelTemplate property.

Here's an example:
<telerik:RadCartesianChart x:Name="chart" Background="#D8D3D0">
    <telerik:RadCartesianChart.Grid>
        <telerik:CartesianChartGrid MajorLinesVisibility="X"
        MajorXLineStyle="{StaticResource StripLinesStyle}" />
    </telerik:RadCartesianChart.Grid>
    <telerik:LinearAxis ElementBrush="Blue">
        <telerik:LinearAxis.LabelTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding}" Foreground="Orange"/>
            </DataTemplate>
        </telerik:LinearAxis.LabelTemplate>
    </telerik:LinearAxis>


Regards,
Petar Kirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ChartView
Asked by
Waut
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or