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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to manipulate Chart Legend?

Platform: WinForms |
Control: Chart |
Published Date: April 30, 2011 |
Last Revised Date: June 25, 2019

 

The chart legend can be displayed by setting ShowLegend property as true. ShowItemsShadow is used to display shadow. BackInterior property specifies the gradient style and background style of the legend. DockingFree property allows us to dock the legend anywhere in the chart area.

C#

// Displays Legend

this.chartControl1.ShowLegend = true;

this.chartControl1.Legend.BackInterior = new BrushInfo(GradientStyle.ForwardDiagonal, Color.White, Color.LightBlue);

// Setting Border Properties

this.chartControl1.Legend.Border.ForeColor = Color.Red;

this.chartControl1.Legend.Border.DashStyle = DashStyle.Dot;

this.chartControl1.Legend.Border.Width = 2;

this.chartControl1.Legend.DockingFree = true;

this.chartControl1.Legend.ShowItemsShadow = false;

this.chartControl1.Legend.ShowSymbol = false;

// Setting Text Properties

this.chartControl1.Legend.Text = "MyLegend";

this.chartControl1.Legend.TextColor = Color.Brown;

this.chartControl1.Legend.Font = new Font("Verdana", 8f, FontStyle.Bold);

VB

' Displays Legend

Me.ChartControl1.ShowLegend = True

Me.ChartControl1.Legend.BackInterior = New BrushInfo(GradientStyle.ForwardDiagonal, System.Drawing.Color.White, System.Drawing.Color.LightBlue)

' Setting Border Properties

Me.ChartControl1.Legend.Border.ForeColor = System.Drawing.Color.Red

Me.ChartControl1.Legend.Border.DashStyle = DashStyle.Dot

Me.ChartControl1.Legend.Border.Width = 2

Me.ChartControl1.Legend.DockingFree = True

Me.ChartControl1.Legend.ShowItemsShadow = False

Me.ChartControl1.Legend.ShowSymbol = False

' Setting Text Properties

Me.ChartControl1.Legend.Text = "MyLegend"

Me.ChartControl1.Legend.TextColor = Color.Brown

Me.ChartControl1.Legend.Font = New Font("Verdana", 8.0F, FontStyle.Bold)

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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