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)