Articles in this section
Category / Section

How to display chart axes label in custom format?

2 mins read

 

Essential Chart supports customizing Chart Axes Labels. We can customize its label, line and range type.Y axis can be customized using subset properties of PrimaryYAxis property. X axis can be customized using subset properties of PrimaryXAxis property.

Range & RangeType properties are used to set the Range of the Axis. Ticks are used to point the Axes value points. TickColor & TickSize properties are used to set the tick size and color for ticks.

When the label for axes value is longer, the labels get overlapped. To avoid this we can rotate it and make it readable. LabelRotate gives access to rotate the label to the angle specified in LabelRotateAngle property.

C#

// Specifying Axis Range

this.chartControl1.PrimaryXAxis.RangeType = ChartAxisRangeType.Set;

this.chartControl1.PrimaryXAxis.Range = new MinMaxInfo(1999, 2005, 1);

this.chartControl1.PrimaryXAxis.RangePaddingType = ChartAxisRangePaddingType.Calculate;

// Setting Font Properties

this.chartControl1.PrimaryXAxis.Font = new Font("Verdana", 8f, FontStyle.Bold);

this.chartControl1.PrimaryXAxis.ForeColor = Color.Green;

// Specifying Tick Properties

this.chartControl1.PrimaryXAxis.TickColor = Color.Blue;

this.chartControl1.PrimaryXAxis.TickSize = new Size(3, 3);

// Specifying Label Properties

this.chartControl1.PrimaryXAxis.LabelRotate = true;

this.chartControl1.PrimaryXAxis.LabelRotateAngle = 45;

VB

' Specifying Axis Range

Me.ChartControl1.PrimaryXAxis.RangeType = ChartAxisRangeType.Set

Me.ChartControl1.PrimaryXAxis.Range = New MinMaxInfo(1999, 2005, 1)

Me.ChartControl1.PrimaryXAxis.RangePaddingType = ChartAxisRangePaddingType.Calculate

' Setting Font Properties

Me.ChartControl1.PrimaryXAxis.Font = New Font("Verdana", 8.0F, FontStyle.Bold)

Me.ChartControl1.PrimaryXAxis.ForeColor = Color.Green

' Specifying Tick Properties

Me.ChartControl1.PrimaryXAxis.TickColor = Color.Blue

Me.ChartControl1.PrimaryXAxis.TickSize = New Size(3, 3)

' Specifying Label Properties

Me.ChartControl1.PrimaryXAxis.LabelRotate = True

Me.ChartControl1.PrimaryXAxis.LabelRotateAngle = 45

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