Marker Fill Color in Legend?

5 posts, 1 answers
  1. Jeff Kershner
    Jeff Kershner avatar
    62 posts
    Member since:
    Aug 2009

    Posted 15 Sep 2010 Link to this post

    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.
  2. Jeff Kershner
    Jeff Kershner avatar
    62 posts
    Member since:
    Aug 2009

    Posted 17 Sep 2010 Link to this post

    Can anyone see how I might do this?
  3. Sia
    Admin
    Sia avatar
    745 posts

    Posted 20 Sep 2010 Link to this post

    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
  4. Jeff Kershner
    Jeff Kershner avatar
    62 posts
    Member since:
    Aug 2009

    Posted 20 Sep 2010 Link to this post

    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).
  5. Answer
    Sia
    Admin
    Sia avatar
    745 posts

    Posted 21 Sep 2010 Link to this post

    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
Back to Top