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

Standard Legend Problem

1 Answer 12 Views
Documentation and Tutorials
This is a migrated thread and some comments may be shown as answers.
Fabrice
Top achievements
Rank 1
Fabrice asked on 09 Oct 2013, 12:50 PM

I have an Question, about standard Legend for RadChart.

How can I change it (Color: Blue from Anzahl Gesamt: 438) that’s the Column from my DataTable. I want to have my custom legend but I can’t remove the standard Legend Item

 

Can you help me ?

 

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 14 Oct 2013, 11:25 AM
Hi Fabrice,

You can use RadChart's BeforeLayout event to clear the auto-generated legend items and add custom ones. Here's an example:
this.RadChart1.BeforeLayout += RadChart1_BeforeLayout;
 
 
void RadChart1_BeforeLayout(object sender, EventArgs e)
{
    this.RadChart1.Legend.Clear();
    this.RadChart1.Legend.AddCustomItemToLegend("Custom legend item 1",
        new Telerik.Charting.Styles.FillStyle(Color.Red, Telerik.Charting.Styles.FillType.Solid), "Ellipse");
    this.RadChart1.Legend.AddCustomItemToLegend("Custom legend item 2",
        new Telerik.Charting.Styles.FillStyle(Color.Blue, Telerik.Charting.Styles.FillType.Solid), "Ellipse");
    this.RadChart1.Legend.AddCustomItemToLegend("Custom legend item 3",
        new Telerik.Charting.Styles.FillStyle(Color.Green, Telerik.Charting.Styles.FillType.Solid), "Ellipse");
    this.RadChart1.Legend.AddCustomItemToLegend("Custom legend item 4",
       new Telerik.Charting.Styles.FillStyle(Color.Orange, Telerik.Charting.Styles.FillType.Solid), "Ellipse");
}

Regards,
Petar Kirov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Documentation and Tutorials
Asked by
Fabrice
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or