5 Answers, 1 is accepted
0
Daniel
Top achievements
Rank 1
answered on 29 Oct 2010, 06:40 PM
Not possible?
0
Hi Daniel,
To be able to change Legend Item Marker's color you can manually generate legend items for the chart legend and then set custom color for them with item.Background property. This is shown in our help topic - http://www.telerik.com/help/silverlight/radchart-features-chart-legend.html (Manual Legend Items Generation).
Have in mind that using this approach you will change Item Markers colors but that won't affect Series colors (they will stay the default ones).
Greetings,
Evgenia
the Telerik team
To be able to change Legend Item Marker's color you can manually generate legend items for the chart legend and then set custom color for them with item.Background property. This is shown in our help topic - http://www.telerik.com/help/silverlight/radchart-features-chart-legend.html (Manual Legend Items Generation).
Have in mind that using this approach you will change Item Markers colors but that won't affect Series colors (they will stay the default ones).
Greetings,
Evgenia
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
Jeremy
Top achievements
Rank 1
answered on 03 Dec 2010, 03:38 AM
Hi
I am trying to do exactly the same thing dynamically and here is my code from following the above demo:
But it doesn't work! It sets the background colour of the legend label instead (pic attached). I've got the latest version (2010.Q3.1110), what am I doing wrong?
Also would like to know how to hide the legend header
Edit: sorry, it won't let me attach a 30K jpg
I am trying to do exactly the same thing dynamically and here is my code from following the above demo:
ChartLegendItem lgnd =
new
ChartLegendItem();
lgnd.Label = myObject.seriesName;
lgnd.Background =
new
SolidColorBrush(myObject
.seriesColour);
MyChartLegend.Items.Add(lgnd);
But it doesn't work! It sets the background colour of the legend label instead (pic attached). I've got the latest version (2010.Q3.1110), what am I doing wrong?
Also would like to know how to hide the legend header
Edit: sorry, it won't let me attach a 30K jpg
0
Hello Jeremy,
You are doing everything right. The problem is that in our latest version of RadChart 2010.3.1110 we added new property MarkerFill which will Change the LegendItemMarkers color. Background property which you tried is changing the LegendI tems Background. Here is how your code should look like when using our latest version:
It seems that our documenation article is not updated with the latest changes. The responsible people are notified and this will be fixed soon.
To be able to remove the Legend Header you should set empty string to Header property:
Kind regards,
Evgenia
the Telerik team
You are doing everything right. The problem is that in our latest version of RadChart 2010.3.1110 we added new property MarkerFill which will Change the LegendItemMarkers color. Background property which you tried is changing the LegendI tems Background. Here is how your code should look like when using our latest version:
RadChart1.DefaultView.ChartLegend.UseAutoGeneratedItems = false;
ChartLegendItem item1 = new ChartLegendItem();
item1.Label = "Item 1";
item1.MarkerFill = new SolidColorBrush(Colors.Blue);
RadChart1.DefaultView.ChartLegend.Items.Add(item1);
ChartLegendItem item2 = new ChartLegendItem();
item2.Label = "Item 2";
item2.MarkerFill = new SolidColorBrush(Colors.Green);
RadChart1.DefaultView.ChartLegend.Items.Add(item2);
It seems that our documenation article is not updated with the latest changes. The responsible people are notified and this will be fixed soon.
To be able to remove the Legend Header you should set empty string to Header property:
RadChart1.DefaultView.ChartLegend.Header = String.Empty;
Kind regards,
Evgenia
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Jeremy
Top achievements
Rank 1
answered on 08 Dec 2010, 12:39 AM
Works beautifully! Thanks!