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

RadChart and Windows7

1 Answer 91 Views
This is a migrated thread and some comments may be shown as answers.
George Felipe
Top achievements
Rank 1
George Felipe asked on 21 Apr 2010, 03:35 PM

I really like the Window7 theme when it comes to the entire application, however, the colors for the charts are truly awful. The pastel colors really do not fit well.

The problem I'm having is trying to overwrite the Windows7 colors. I have tried to set the ChartArea theme to Office_Blue, hoping to use those colors for the series, but Windows7 theme for the container, but this does not seem to work. I have done a search and have found that other users have suffered this same problem.

I have also tried to set a palette brush colors and end up with mutant pastel colors. For example, in a bar series, if I set palette brush colors to green and red, I get bars that start with orange and end with green, and I get bars that start with pink and end in red. Furthermore, the Legend does not show the updated palette colors. Please see the attached image for an example.

I did not try the MVVM approach as I thought it would be the same problem as palette colors.

Is there any other way I can change these Series colors? When can we expect a fix for Theme overrides for charts?

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 22 Apr 2010, 03:21 PM
Hello George Felipe,

The issue you ran into is due to the complexity of the gradients and the colors in the Windows 7 theme. With the latest version of our controls (latest internal build or the SP1 expected any moment) you can set the "PaletteBrushesUseSolidColors" property to be true and you will get rid of the ugly colors in your application.

Here you can find an example how to change the default Series' colors of the Windows7 theme.
DataSeries series1 = new DataSeries();
series1.Add(new DataPoint(10));
series1.Definition = new HorizontalBarSeriesDefinition();
series1.Definition.Appearance.StrokeThickness = 0;
series1.Definition.SeriesItemLabelStyle = Resources["CustomLabel"] as Style;
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 116, 192, 211)))
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 227, 99, 117)));
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 236, 182, 46)));
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 120, 193, 121)));
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 221, 105, 42)));
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 193, 42, 42)));
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 63, 199, 204)));
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 180, 191, 32)));
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 90, 99, 120)));
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 193, 193, 193)));
RadChart1.PaletteBrushesUseSolidColors = true;
where RadChart1 is the Name of your RadChart.

The colors above are the default ones from our Office Blue theme.

Unfortunately at the present time if you want to change the default background of the labels for Windows7 theme you need to retemplate them. The "CustomLabel" Style should be set in your xaml as follows:
    <Style x:Name="CustomLabel" TargetType="charting:SeriesItemLabel">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="2,0" />
        <Setter Property="IsHitTestVisible" Value="False"/>
        <Setter Property="Template" >
                <ControlTemplate TargetType="charting:SeriesItemLabel">
                           Visibility="{TemplateBinding ConnectorVisibility}"
                           Style="{TemplateBinding ConnectorStyle}"
                           Stroke="{TemplateBinding Stroke}"
                           StrokeThickness="{TemplateBinding StrokeThickness}">
                                <PathGeometry >
                                        <PathFigure x:Name="PART_Connector">
                                                <PolyLineSegment />
                        <Border x:Name="PART_TextContainer"
                         Style="{TemplateBinding LabelStyle}"
                         BorderBrush="{TemplateBinding Stroke}"
                            <TextBlock TextAlignment="{TemplateBinding HorizontalContentAlignment}"
                           Margin="{TemplateBinding Padding}"
                           Text="{TemplateBinding Content}" />

I have notified our developers of this issue and it will be fixed as soon as possible.

Hope this helps.

Kind regards,
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.
Asked by
George Felipe
Top achievements
Rank 1
Answers by
Telerik team
Share this question