Axis Labels

The Axis Label displays text along a graph's axis. If the chart sets the AutoLayout property to true, the XAxisLabels and YAxisLabels automatically creates the labels automatically using the given data. An Axis has LabelListFormat property based on which the Axis Labels are displayed. For setting LabelListFormat, refer to the two Axis label types, Date format strings and Number format strings.

XAxisLabel

Use the XAxisLabel to display along an x-axis. Note that you can rotate the XAxisLabel at different angles and set the label using the XAxisLabelPosition enumeration.

NOTE: The XAxisLabelPosition enumeration default value is BelowXAxis.

DateTimeXAxisLabel
DateTimeXAxis displays text on the DateTimeXAxisLabel using the XAxis.

Adding DateTimeXAxisLabel to DateTimeZAxis

The following code illustrates adding a DateTimeXAxisLabel to a DateTimeXAxis:

DateTimeXAxis xAxis = new DateTimeXAxis();
xAxis.Labels.Add(new DateTimeXAxisLabel("Tues",new DateTime(2008,1,1)));
xAxis.Labels.Add(new DateTimeXAxisLabel("Wednes", new DateTime(2008,1,2)));
xAxis.Labels.Add(new DateTimeXAxisLabel("Thurs", new DateTime(2008,1,3)));
xAxis.Labels.Add(new DateTimeXAxisLabel("Fri", new DateTime(2008,1,4)));        
Dim MyXAxis As DateTimeXAxis = New DateTimeXAxis()
MyXAxis.Labels.Add(New DateTimeXAxisLabel("Tues", New Date(2008, 1, 1)))
MyXAxis.Labels.Add(New DateTimeXAxisLabel("Wednes", New Date(2008, 1, 2)))
MyXAxis.Labels.Add(New DateTimeXAxisLabel("Thurs", New Date(2008, 1, 3)))
MyXAxis.Labels.Add(New DateTimeXAxisLabel("Fri", New Date(2008, 1, 4)))       
IndexedXAxisLabel
IndexedXAxis use IndexedXAxisLabel to display the text along the XAxis.

The below code shows how to add an IndexedXAxisLabel to an IndexedXAxis:

IndexedXAxis xAxis = new IndexedXAxis();
xAxis.Labels.Add(new IndexedXAxisLabel("Q1", 0));
xAxis.Labels.Add(new IndexedXAxisLabel("Q2", 1));
xAxis.Labels.Add(new IndexedXAxisLabel("Q3", 2));
xAxis.Labels.Add(new IndexedXAxisLabel("Q4", 3));        
Dim MyXAxis As IndexedXAxis = New IndexedXAxis()
MyXAxis.Labels.Add(New IndexedXAxisLabel("Q1", 0))
MyXAxis.Labels.Add(New IndexedXAxisLabel("Q2", 1))
MyXAxis.Labels.Add(New IndexedXAxisLabel("Q3", 2))
MyXAxis.Labels.Add(New IndexedXAxisLabel("Q4", 3))       
NumericXAxisLabel
NumericXAxis use NumericXAxisLabel to display text along the XAxis.

The below code shows how to add a NumericXAxisLabel to a NumericXAxis:

NumericXAxis xAxis = new NumericXAxis();
xAxis.Labels.Add(new NumericXAxisLabel("1", 10));
xAxis.Labels.Add(new NumericXAxisLabel("2", 20));
xAxis.Labels.Add(new NumericXAxisLabel("3", 30));
xAxis.Labels.Add(new NumericXAxisLabel("4", 40));        
Dim MyXAxis As NumericXAxis = New NumericXAxis()
MyXAxis.Labels.Add(New NumericXAxisLabel("1", 10))
MyXAxis.Labels.Add(New NumericXAxisLabel("2", 20))
MyXAxis.Labels.Add(New NumericXAxisLabel("3", 30))
MyXAxis.Labels.Add(New NumericXAxisLabel("4", 40))
PercentageXAxisLabel
PercentageXAxis use PercentageXAxisLabel to display the text along the XAxis. It displays the text in percentage format.

The below code shows how to add a PercentageXAxisLabel to a PercentageXAxis:

PercentageXAxis xAxis = new PercentageXAxis();
xAxis.Labels.Add(new PercentageXAxisLabel("10%",10));
xAxis.Labels.Add(new PercentageXAxisLabel("20%",20));
xAxis.Labels.Add(new PercentageXAxisLabel("30%",30));
xAxis.Labels.Add(new PercentageXAxisLabel("40%",40));        
Dim MyXAxis As PercentageXAxis = New PercentageXAxis()
MyXAxis.Labels.Add(New PercentageXAxisLabel("10%", 10))
MyXAxis.Labels.Add(New PercentageXAxisLabel("20%", 20))
MyXAxis.Labels.Add(New PercentageXAxisLabel("30%", 30))
MyXAxis.Labels.Add(New PercentageXAxisLabel("40%", 40)) 

YAxisLabel

YAxisLabel is text that gets displayed along the YAxis. The YAxisLabel can be rotated at different angles. The position of the label can be set using the YAxisLabelPosition enumeration. The default value of YAxisLabelPosition enumeration is LeftOfYAxis.

DateTimeYAxisLabel
DateTimeYAxis use DateTimeYAxisLabel to display the text along the YAxis.

The below code shows how to add a DateTimeYAxisLabel to a DateTimeYAxis:

DateTimeYAxis yAxis = new DateTimeYAxis();
yAxis.Labels.Add(new DateTimeYAxisLabel("Tues",new DateTime(2008,1,1)));
yAxis.Labels.Add(new DateTimeYAxisLabel("Wednes", new DateTime(2008,1,2)));
yAxis.Labels.Add(new DateTimeYAxisLabel("Thurs", new DateTime(2008,1,3)));
yAxis.Labels.Add(new DateTimeYAxisLabel("Fri", new DateTime(2008,1,4)));        
Dim MyYAxis As DateTimeYAxis = New DateTimeYAxis()
MyYAxis.Labels.Add(New DateTimeYAxisLabel("Tues", New Date(2008, 1, 1)))
MyYAxis.Labels.Add(New DateTimeYAxisLabel("Wednes", New Date(2008, 1, 2)))
MyYAxis.Labels.Add(New DateTimeYAxisLabel("Thurs", New Date(2008, 1, 3)))
MyYAxis.Labels.Add(New DateTimeYAxisLabel("Fri", New Date(2008, 1, 4)))      
IndexedYAxisLabel
IndexedYAxis use IndexedYAxisLabel to display the text along the YAxis.

The below code shows how to add an IndexedYAxisLabel to an IndexedYAxis:

IndexedYAxis yAxis = new IndexedYAxis();
yAxis.Labels.Add(new IndexedYAxisLabel("Q1", 0));
yAxis.Labels.Add(new IndexedYAxisLabel("Q2", 1));
yAxis.Labels.Add(new IndexedYAxisLabel("Q3", 2));
yAxis.Labels.Add(new IndexedYAxisLabel("Q4", 3));        
Dim MyYAxis As IndexedYAxis = New IndexedYAxis()
MyYAxis.Labels.Add(New IndexedYAxisLabel("Q1", 0))
MyYAxis.Labels.Add(New IndexedYAxisLabel("Q2", 1))
MyYAxis.Labels.Add(New IndexedYAxisLabel("Q3", 2))
MyYAxis.Labels.Add(New IndexedYAxisLabel("Q4", 3))      
NumericYAxisLabel
NumericYAxis use NumericYAxisLabel to display text along the YAxis.

The below code shows how to add a NumericYAxisLabel to a NumericYAxis:

NumericYAxis yAxis = new NumericYAxis();
yAxis.Labels.Add(new NumericYAxisLabel("1", 10));
yAxis.Labels.Add(new NumericYAxisLabel("2", 20));
yAxis.Labels.Add(new NumericYAxisLabel("3", 30));
yAxis.Labels.Add(new NumericYAxisLabel("4", 40));        
Dim MyYAxis As NumericYAxis = New NumericYAxis()
MyYAxis.Labels.Add(New NumericYAxisLabel("1", 10))
MyYAxis.Labels.Add(New NumericYAxisLabel("2", 20))
MyYAxis.Labels.Add(New NumericYAxisLabel("3", 30))
MyYAxis.Labels.Add(New NumericYAxisLabel("4", 40))             
PercentageYAxisLabel
PercentageYAxis use PercentageYAxisLabel to display the text along the YAxis. It displays the text in percentage format.

The below code shows how to add a PercentageYAxisLabel to a PercentageYAxis:

PercentageYAxis yAxis = new PercentageYAxis();
yAxis.Labels.Add(new PercentageYAxisLabel("10%",10));
yAxis.Labels.Add(new PercentageYAxisLabel("20%",20));
yAxis.Labels.Add(new PercentageYAxisLabel("30%",30));
yAxis.Labels.Add(new PercentageYAxisLabel("40%",40));        
Dim MyYAxis As PercentageYAxis = New PercentageYAxis()
MyYAxis.Labels.Add(New PercentageYAxisLabel("10%", 10))
MyYAxis.Labels.Add(New PercentageYAxisLabel("20%", 20))
MyYAxis.Labels.Add(New PercentageYAxisLabel("30%", 30))
MyYAxis.Labels.Add(New PercentageYAxisLabel("40%", 40))      

In this topic