We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create multiple legends for a chart control?

 

Essential Chart supports multiple legends in single chart control. It is used to view legend items more clearly when we have more number of series. To have multiple legends we need to create custom legends and add the series to it.

When we use custom legends we can also use default legend too. If we are not in need to default legend we can set ShowLegend property to false.

C#

// Creating Legends

ChartLegend legend1 = new ChartLegend(chartControl1);

ChartLegend legend2 = new ChartLegend(chartControl1);

legend1.Name = "legend1";

legend2.Name = "legend2";

legend1.Position = ChartDock.Bottom;

legend2.Position = ChartDock.Right;

//Adding to Chart Control

chartControl1.Legends.Add(legend1);

chartControl1.Legends.Add(legend2);

s1.LegendName = "legend1";

s5.LegendName = "legend2";

VB

' Creating Legends

Dim legend1 As ChartLegend = New ChartLegend(ChartControl1)

Dim legend2 As ChartLegend = New ChartLegend(ChartControl1)

legend1.Name = "legend1"

legend2.Name = "legend2"

legend1.Position = ChartDock.Bottom

legend2.Position = ChartDock.Right

' Adding to Chart Control

ChartControl1.Legends.Add(legend1)

ChartControl1.Legends.Add(legend2)

s1.LegendName = "legend1"

s5.LegendName = "legend2"

Article ID: Published Date: Last Revised Date: Platform: Control:
54 04/30/2011 07/10/2014 Windows Forms Chart
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon