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

How to change color of bar individually??

2 Answers 183 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Sharmila
Top achievements
Rank 1
Sharmila asked on 26 Aug 2010, 01:08 PM
Hi,
 
   Can you please suggest me how can i change the color of a bars invidually in a bar series.I am working woith RadChart for silverlight.
I want the same requirement as mentioned in the link below which is for asp.net ajax.It is looping through all the points in the saries and assigning color to it.But i need to do the same in silverlight.
http://www.telerik.com/help/aspnet-ajax/howtoassigncolors.html 



Regards,
Sharmila

2 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 30 Aug 2010, 04:12 PM
Hello Sharmila,
You can achieve this functionality in several ways.
The first one is by setting the Legend Display Mode of the bar series to DataPointLabel like this:

<telerik:SeriesMapping.SeriesDefinition>
    <telerik:BarSeriesDefinition LegendDisplayMode="DataPointLabel" />
</telerik:SeriesMapping.SeriesDefinition>
By doing this each bar will be treated like a separate series - it will have a separate label in the legend and will have a different color. You can find additional information on legend display modes in our documentation here.

If you'd like to further customize the colors of the bars you can define your own color palette containing the colors you want for your bars like this:
<telerik:RadChart.PaletteBrushes>
    <SolidColorBrush Color="Red" />
    <SolidColorBrush Color="Green" />
    <SolidColorBrush Color="Yellow" />
</telerik:RadChart.PaletteBrushes>
You can find additional information on styling the series in the styling section of our documentation here.

Another way is through MVVM. You can find example of using MVVM to paint each bar in separate color in our demos here.

Sincerely yours,
Yavor Ivanov
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
Sharmila
Top achievements
Rank 1
answered on 31 Aug 2010, 05:55 AM
Hi,

  Thank you very much...That works !!!


Regards,
Sharmila
Tags
Chart
Asked by
Sharmila
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Sharmila
Top achievements
Rank 1
Share this question
or