Articles in this section

How to manipulate the chart legend in WinForms Chart?

 

The chart legend in Syncfusion® WinForms Chart, can be displayed by setting the Legend's Visibile property to true. The ShowItemsShadow property controls whether shadows are shown for the legend items. The BackInterior property specifies the gradient and background style of the legend. 


// Displays Legend
this.chartControl1.Legend.Visible = true;
this.chartControl1.LegendAlignment = ChartAlignment.Center;
this.chartControl1.Legend.Position = ChartDock.Top;
this.chartControl1.LegendsPlacement = ChartPlacement.Outside;
this.chartControl1.Legend.BackInterior = new BrushInfo(GradientStyle.ForwardDiagonal, Color.White, Color.LightBlue);

// Setting Border Properties
this.chartControl1.Legend.Border.ForeColor = Color.Blue;
this.chartControl1.Legend.Border.DashStyle = DashStyle.Dot;
this.chartControl1.Legend.Border.Width = 2;
this.chartControl1.Legend.ShowBorder = true;
this.chartControl1.Legend.ShowItemsShadow = false;
this.chartControl1.Legend.ShowSymbol = false;

// Setting Text Properties
this.chartControl1.Legend.Text = "Legend";
this.chartControl1.Legend.TextColor = Color.Brown;
this.chartControl1.Legend.Font = new Font("Verdana", 8f, FontStyle.Bold);
'Displays Legend
columnChart.Legend.Visible = True
columnChart.LegendAlignment = ChartAlignment.Center
columnChart.Legend.Position = ChartDock.Top
columnChart.LegendsPlacement = ChartPlacement.Outside
columnChart.Legend.BackInterior = New BrushInfo(GradientStyle.ForwardDiagonal, Color.White, Color.LightBlue)

'Setting border properties
columnChart.Legend.Border.ForeColor = Color.Blue
columnChart.Legend.Border.DashStyle = DashStyle.Dot
columnChart.Legend.Border.Width = 2
columnChart.Legend.ShowBorder = True
columnChart.Legend.ShowItemsShadow = False
columnChart.Legend.ShowSymbol = False

'Setting Text properties
columnChart.Legend.Text = "Legend"
columnChart.Legend.TextColor = Color.Brown
columnChart.Legend.Font = New Font("verdana", 8.0F, FontStyle.Bold)
Output:

manipulate the chart legend


Conclusion

I hope you enjoyed learning about how to manipulate the Chart Legend in WinForms Chart.

You can refer to our WinForms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms Chart examples to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you! 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied