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

Custom Chart Series Colors stopped working

1 Answer 65 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Mark Anderson
Top achievements
Rank 1
Mark Anderson asked on 19 Mar 2010, 06:37 PM
I upgraded to the latest 2010 WPF RadCharts and the custom colors for the series are not displayed anymore.  I was doing this for a pie chart and a bar chart that needed specific green and red colors.  Now it displays what I assume is the default colors.  Here is the style for the pie chart, it is similar for the bar chart.  How do I get this to work with the new Charting. 

<Grid.Resources> 
    <SolidColorBrush x:Key="CustomBrush" Color="#FF4ED843" /> 
    <SolidColorBrush x:Key="CustomBrush2" Color="#FFFF9393" /> 
 
    <TelerikCharting:StylesPalette x:Key="{TelerikControls:ThemeResourceKey ElementType={x:Type TelerikCharting:ChartArea}, ResourceId={x:Static TelerikCharting:ResourceHelper.ResourceKeyRadialStyle}, ThemeType={x:Type TelerikControls:Office_BlackTheme}}">  
    <Style TargetType="{x:Type Shape}">  
        <Setter Property="Stroke" Value="Gray" /> 
        <Setter Property="StrokeThickness" Value="1" /> 
        <Setter Property="Fill" Value="{DynamicResource CustomBrush}" /> 
    </Style> 
    <Style TargetType="{x:Type Shape}">  
        <Setter Property="Stroke" Value="Gray" /> 
        <Setter Property="StrokeThickness" Value="1" /> 
        <Setter Property="Fill" Value="{DynamicResource CustomBrush2}" /> 
    </Style> 
    </TelerikCharting:StylesPalette> 
 
</Grid.Resources> 
 

1 Answer, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 24 Mar 2010, 04:27 PM
Hello Mark Anderson,

With our Q1.2010 release we have introduced a new approach for changing the default fill for all different series types through the RadChart.PaletteBrushes property as follows:

<telerik:RadChart x:Name="RadChart1" PaletteBrushesRepeat="False">
    <telerik:RadChart.PaletteBrushes>
        <SolidColorBrush Color="#FF4ED843" />
        <SolidColorBrush Color="#FFFF9393" />
    </telerik:RadChart.PaletteBrushes>
</telerik:RadChart>

If the "PaletteBrushesRepeat" property is set to False, the two defined brushes will be used for the first two series and the default fills will be set to the rest of them. If this property is set to True, your new colors will be used for all series.

The Stroke and the Strokethickness can be set in your code behind as follows:
series1.Definition.Appearance.Stroke = new SolidColorBrush(Colors.Gray);
series1.Definition.Appearance.StrokeThickness = 1;
where "series1" is one of your series. You can use the same approach for Bar and  Pie Series.

I hope this helps.


All the best,
Sia
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Chart
Asked by
Mark Anderson
Top achievements
Rank 1
Answers by
Sia
Telerik team
Share this question
or