We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to display chart axes label in custom format?

 

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

Article ID: Published Date: Last Revised Date: Platform: Control:
75 04/30/2011 07/10/2014 Windows Forms Chart
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.