Articles in this section

How to add and customize titles for chart control, chart series, chart axes, and chart legend in WinForms Chart?

Essential Chart supports assigning titles to various objects within the Chart Control, such as the Chart, Series, Axes, and Legend. These titles can also be customized in WinForms Charts

this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.Category;

//Update the X axis title
this.chartControl1.PrimaryXAxis.Title = "Year";
this.chartControl1.PrimaryXAxis.TitleAlignment = StringAlignment.Center;

this.chartControl1.PrimaryYAxis.ValueType = ChartValueType.Double;

//Update the Y axis title
this.chartControl1.PrimaryYAxis.Title = "Sales Data";
this.chartControl1.PrimaryYAxis.TitleAlignment = StringAlignment.Center;

CategoryAxisDataBindModel dataSeriesModel = new CategoryAxisDataBindModel(dataSource);
dataSeriesModel.CategoryName = "Year";
dataSeriesModel.YNames = new string[] { "Sales" };
ChartSeries chartSeries = new ChartSeries("Sales");
chartSeries.Type = ChartSeriesType.Column;
chartSeries.CategoryModel = dataSeriesModel;

//Update the series title
chartSeries.Text = "Product Sold";
this.chartControl1.Series.Add(chartSeries);

this.chartControl1.Legend.Visible = true;

//Update the legend title
this.chartControl1.Legend.Text = "Products";
this.chartControl1.Legend.Font = new Font("Arial", 8f, FontStyle.Bold);
this.chartControl1.LegendAlignment = ChartAlignment.Center;
this.chartControl1.Legend.Position = ChartDock.Top;
this.chartControl1.LegendsPlacement = ChartPlacement.Outside;

//Update the chart title
ChartTitle title = new ChartTitle();
title.Visible = true;
title.Text = "Sales Performance";
title.Alignment = ChartAlignment.Center;
title.ForeColor = Color.RoyalBlue;
title.Font = new Font("Arial", 14.0f);
title.ShowBorder = true;
title.Border.ForeColor = Color.DarkBlue;
title.Border.Width = 2;
title.Border.DashStyle = DashStyle.Dot;
this.chartControl1.Titles.Add(title);
columnChart.PrimaryXAxis.ValueType = ChartValueType.Category

'Update the X axis title
columnChart.PrimaryXAxis.Title = "Year"
columnChart.PrimaryXAxis.TitleAlignment = StringAlignment.Center

columnChart.PrimaryYAxis.ValueType = ChartValueType.Double

'Update the X axis title
columnChart.PrimaryYAxis.Title = "Sales Data"
columnChart.PrimaryYAxis.TitleAlignment = StringAlignment.Center

Dim dataSeriesModel = New CategoryAxisDataBindModel(viewModel.PlantDetails)
dataSeriesModel.CategoryName = "Year"
dataSeriesModel.YNames = New String() {"Sales"}
ChartSeries1.CategoryModel = dataSeriesModel

'Update the chart series title
ChartSeries1.Text = "Product Sold"

columnChart.Series.Add(ChartSeries1)

columnChart.Legend.Visible = True

'Update the legend title
columnChart.Legend.Text = "Products"
columnChart.Legend.Font = New Font("Arial", 8.0F, FontStyle.Bold)

columnChart.LegendAlignment = ChartAlignment.Center
columnChart.Legend.Position = ChartDock.Top
columnChart.LegendsPlacement = ChartPlacement.Outside

'Configure the chart title
Dim title = New ChartTitle()
title.Visible = True
title.Text = "Sales Performance"
title.Alignment = ChartAlignment.Center
title.ForeColor = Color.RoyalBlue
title.Font = New Font("Arial", 14.0F)
title.ShowBorder = True
title.Border.ForeColor = Color.DarkBlue
title.Border.Width = 2
title.Border.DashStyle = DashStyle.Dot
columnChart.Titles.Add(title)

Output:

add and customize titles

Conclusion

I hope you enjoyed learning about how to add and customize titles for Chart Control, Chart Series, Chart Axes, and 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