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 manipulate Chart Legend?

 

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)

Article ID: Published Date: Last Revised Date: Platform: Control:
55 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