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

Remove alternance in chartarea background?

1 Answer 90 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Enill
Top achievements
Rank 1
Enill asked on 30 May 2010, 05:06 PM
Hi,
is there a way to remove the "Default" rows color alternance in chartarea background? Currently the row alternate between white-gray-white-gray-etc...

I would like to have this background in plain white but still keep the grid line.

Also, how can i change the label color of a seriesmapping in doughnutseriesdefinition? I tried the code below but it doesnt work, the label text color stay white.

                    SeriesMapping smMats = new SeriesMapping() 
                    { 
                        SeriesDefinition = new DoughnutSeriesDefinition() 
                        { 
                            ShowItemLabels = true
                            ShowItemToolTips = true
                            RadiusFactor = 0.75, 
                            LabelSettings = new RadialLabelSettings() 
                            { 
                                SpiderModeEnabled = true
                                ShowConnectors = true 
                            } 
                        } 
                    }; 
                    smMats.ItemMappings.Add(new ItemMapping("AxisPointY", DataPointMember.YValue)); 
                    smMats.ItemMappings.Add(new ItemMapping("pointLabel", DataPointMember.Label)); 
                    smMats.ItemMappings.Add(new ItemMapping("pointToolTip", DataPointMember.Tooltip)); 
                    smMats.SeriesDefinition.Appearance.Foreground = new SolidColorBrush(labelForeColor); 
 
                    rc.SeriesMappings.Add(smMats); 


Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 02 Jun 2010, 08:46 AM
Hello Jean-Philippe Savard,

The Striplines in the RadChart control are visible by default but the Gridlines are hidden. You can show them as follows:
//hides the striplines
rc.DefaultView.ChartArea.AxisY.StripLinesVisibility = Visibility.Collapsed;
 
//makes the gridlines visible
rc.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
rc.DefaultView.ChartArea.AxisY.MinorGridLinesVisibility = Visibility.Visible;

The code above is for the gridlines and striplines which are related to the Y axis. The same properties are available for the X axis.

If you need to change the Labels' foreground, you need to set:
rc.DefaultSeriesDefinition.SeriesItemLabelStyle = this.Resources["CustomLabelStyle"] as Style;
where you have to set your custom Style in your XAML:
<Style TargetType="chart:SeriesItemLabel" x:Key="CustomLabelStyle">
        <Setter Property="Foreground" Value="Red" />
</Style>

If you want to change the background of the labels, please use the approach described in the "Styling RadChart for WPF and Silverlight gets easier" blog post. In order for that approach to work, you will need to download the latest available release of our controls.

Regards,
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
Enill
Top achievements
Rank 1
Answers by
Sia
Telerik team
Share this question
or