Hi,
We are trying to set custom colors for Silces in a pie chart as given below .
But our spider labels are showing up in a different color( Obviously set by default rendering )
Any help on how to solve this?
Thanks
Rosh
We are trying to set custom colors for Silces in a pie chart as given below .
private static Style CreateItemStyle(Control control, Style baseStyle, DataPoint dataPoint, DataSeries dataSeries)
{
if (control is ChartLegendItem)
return baseStyle;
if (dataPoint == null)
return baseStyle;
Style newStyle = new Style(baseStyle.TargetType);
newStyle.BasedOn = baseStyle;
if (control is BaseChartItem2D)
{
Brush brush = Utils.CustomDrawChart.Palette[ColorCount];
newStyle.Setters.Add(new Setter(Shape.FillProperty, brush));
}
ColorCount++;
return newStyle;
}
But our spider labels are showing up in a different color( Obviously set by default rendering )
Any help on how to solve this?
Thanks
Rosh
4 Answers, 1 is accepted
0
Cap
Top achievements
Rank 1
answered on 21 Jul 2010, 07:24 AM
Helloooooooooooooo helloo.... (echo)
Any little help here ? - admin? Vladimir ??
Any little help here ? - admin? Vladimir ??
0
Hi Cap,
You need to add another if condition concerning the labels in your code as follows:
Of course you need to use the same color as the one for the slices:
Regards,
Sia
the Telerik team
You need to add another if condition concerning the labels in your code as follows:
if
(control
is
SeriesItemLabel)
{
Brush brush =
new
SolidColorBrush(Colors.Red);
newStyle.Setters.Add(
new
Setter(SeriesItemLabel.FillProperty, brush));
newStyle.Setters.Add(
new
Setter(SeriesItemLabel.StrokeProperty, brush));
}
Of course you need to use the same color as the one for the slices:
Brush brush = Utils.CustomDrawChart.Palette[ColorCount];
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
0
Jeff Kershner
Top achievements
Rank 1
answered on 08 Sep 2010, 01:00 AM
I have a similar problem where I am using the chart.CreateItemStyleDelegate. My spider lines and backgrounds are also the wrong colors.
private
Style BuildCustomItemStyle(Control item, Style style, DataPoint point, DataSeries dataSeries)
{
if
((item
as
BaseChartItem) ==
null
)
return
style;
Style newStyle =
new
Style();
newStyle.BasedOn = style;
newStyle.TargetType =
typeof
(Shape);
Brush brush;
switch
((item
as
BaseChartItem).CurrentIndex % 7)
{
case
0:
brush =
new
SolidColorBrush(Color.FromArgb(255, 2, 123, 8));
break
;
case
1:
brush =
new
SolidColorBrush(Color.FromArgb(255, 238, 192, 5));
break
;
case
2:
brush =
new
SolidColorBrush(Color.FromArgb(255, 238, 97, 6));
break
;
case
3:
brush =
new
SolidColorBrush(Color.FromArgb(255, 1, 240, 6));
break
;
case
4:
brush =
new
SolidColorBrush(Color.FromArgb(255, 238, 240, 6));
break
;
case
5:
brush =
new
SolidColorBrush(Color.FromArgb(255, 179, 181, 183));
break
;
default
:
//case 6:
brush =
new
SolidColorBrush(Color.FromArgb(255, 237, 240, 242));
break
;
}
newStyle.Setters.Add(
new
Setter(Shape.FillProperty, brush));
return
newStyle;
}
0
Hello Jeff Kershner,
Please check my answer here.
Greetings,
Sia
the Telerik team
Please check my answer here.
Greetings,
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