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

Doughtnut label color

1 Answer 65 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Enill
Top achievements
Rank 1
Enill asked on 10 May 2010, 03:45 AM
Hi,
i applied an image texture on the different slice of a 2D doughnut chart with a custompalette.

The problem is that the image used for the texture is also the used in the background of every slice label. How can i change the background color of the different label?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 12 May 2010, 08:34 AM
Hello Enill,

Here is a sample code snippet:
private Brush[] brushes = new Brush[] {
    new SolidColorBrush(Colors.Red),
    new SolidColorBrush(Color.FromArgb(64, 0, 255, 255)),
    new SolidColorBrush(Color.FromArgb(128, 255, 0, 255))
};
  
public MainPage()
{
    InitializeComponent();
  
    this.radChart1.CreateItemStyleDelegate = CustomItemStyle;
}
  
private Style CustomItemStyle(Control item, Style baseStyle, DataPoint dataPoint, DataSeries dataSeries)
{
    Style style = baseStyle;
  
    if (item is SeriesItemLabel)
    {
        SeriesItemLabel itemLabel = item as SeriesItemLabel;
        style = new Style(baseStyle.TargetType);
        style.BasedOn = baseStyle;
  
        Brush brush = brushes[dataSeries.IndexOf(dataPoint) % brushes.Length];
  
        style.Setters.Add(new Setter(SeriesItemLabel.FillProperty, brush));
    }
    return style;
}

Best,
Joshua
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
Dwight
Telerik team
Share this question
or