Articles in this section
Category / Section

How to display the last partially visible label on an axis in WinForms Chart?

3 mins read

In Syncfusion® WinForms Chart, there may be instances where the last label along an axis is not drawn if it will not be completely visible. This default behavior is controlled by the HidePartialLabels property. By default, this property is set to True, which means partially visible labels will be hidden. To change this behavior and display even partially visible labels, set the HidePartialLabels property to False.

C#

//Assign the X and Y axes
this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.Category;
this.chartControl1.PrimaryYAxis.ValueType = ChartValueType.Double;
this.chartControl1.PrimaryXAxis.Range = new MinMaxInfo(0, 40, 10);
this.chartControl1.PrimaryXAxis.DrawGrid = false;

//Configure the chart series
CategoryAxisDataBindModel dataSeriesModel = new CategoryAxisDataBindModel(dataSource);
dataSeriesModel.CategoryName = "Year";
dataSeriesModel.YNames = new string[] { "Sales" };
ChartSeries chartSeries = new ChartSeries("Sales");
chartSeries.Type = ChartSeriesType.Line;
chartSeries.CategoryModel = dataSeriesModel;
this.chartControl1.Series.Add(chartSeries);

//Disable the hide partial labels
this.chartControl1.PrimaryXAxis.HidePartialLabels = false;

VB

'Assign the X and Y axes
lineChart.PrimaryYAxis.ValueType = ChartValueType.Double
lineChart.PrimaryXAxis.ValueType = ChartValueType.Category
lineChart.PrimaryXAxis.Range = New MinMaxInfo(0, 40, 10)
lineChart.PrimaryXAxis.DrawGrid = False

'Configure the chart series
Dim ChartDataBindModel1 As CategoryAxisDataBindModel = New CategoryAxisDataBindModel(viewModel.PlantDetails2)
ChartDataBindModel1.CategoryName = "Year"
ChartDataBindModel1.YNames = New String() {"Sales"}
Dim ChartSeries1 As ChartSeries = New ChartSeries("Sales")
ChartSeries1.CategoryModel = ChartDataBindModel1
ChartSeries1.Type = ChartSeriesType.Line
lineChart.Series.Add(ChartSeries1)

'Disable the hide partial labels
lineChart.PrimaryXAxis.HidePartialLabels = False

Output:

display the last partially visible label

Conclusion

I hope you enjoyed learning about how to display the last partially visible label on an axis 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)
Please  to leave a comment
Access denied
Access denied