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

Marker Fill Color in Legend?

4 Answers 105 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Jeff Kershner
Top achievements
Rank 1
Jeff Kershner asked on 15 Sep 2010, 05:46 PM

I am setting ChartLegend.UseAutoGeneratedItems = false, and manually adding in the LegendItems like this:

ChartLegendItem cli = new ChartLegendItem();
cli.Label = data.company;
cli.MarkerShape = MarkerShape.Circle;
cli.Foreground = chart.PaletteBrushes[i++];

I get the attached image.

What I would like to do is to remove the text "Legend" and change the circles to the correct series colors.  The cli.Forground is correctly setting the legend text color, but I would like to set the market color in both the chart and the legend.

4 Answers, 1 is accepted

Sort by
0
Jeff Kershner
Top achievements
Rank 1
answered on 17 Sep 2010, 11:19 PM
Can anyone see how I might do this?
0
Sia
Telerik team
answered on 20 Sep 2010, 10:45 AM
Hello Jeff Kershner,

Straight to your questions:

  • To remove the title, just add one line in your code behind:
RadChart1.DefaultView.ChartLegend.Header = "";

  • To set color to your ChartLegendItem:
cli.Background = new SolidColorBrush(Colors.Red); //chart.PaletteBrushes[i++]

Please, try these and tell us if you need something else to be changed.
Sincerely yours,
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 20 Sep 2010, 05:35 PM
That worked for getting the legend colors correct.

How do I get the marker colors correct in the chart?  (In the attachment you can see they are still white circles).
0
Accepted
Sia
Telerik team
answered on 21 Sep 2010, 04:25 PM
Hi Jeff Kershner,

It could be done as follows:
DataSeries dataSeries = new DataSeries();
dataSeries.Definition.Appearance.PointMark.Fill = new SolidColorBrush(Colors.Red);
Hope this helps.

All the best,
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
Jeff Kershner
Top achievements
Rank 1
Answers by
Jeff Kershner
Top achievements
Rank 1
Sia
Telerik team
Share this question
or