Dundas Chart for Windows Forms
Axis Labeling Methods
See Also Send comments on this topic.
Using Dundas Chart > Labels > Axis Labeling Methods



Glossary Item Box

Overview

The following three ways can be used to label axes. We have listed them from lowest to highest priority.

 

To label an axis you can use:

 

These methods differ primarily in how the label text is generated. Different methods can be used for each individual axis. For example, you could use a set of custom labels for your Y axis, and then use data point labels for your X axis). Following, is a discussion of each of the three methods mentioned above, along with relevant code samples.

 

Using the Axis Scale

The axis scale is used to generate labels if custom labels are not used, and the data points being plotted do not have their own labels. The label text displayed depends on the maximum and minimum axis values, as well as the axis scale itself. Labels generated in this manner can be displayed in the first label row along with labels that originate from data points.

For more information on using labels, see the topic on Label Rows and Offsets.

 

Note
Since using the axis scale method of setting label text has the lowest priority, if a label from a data point is specified as a custom label, it will get used instead.

 

Using Data Points

Labels for non-value axes can be generated from data points. All data points can have a label associated with them, this is done using their AxisLabel property. Labels from data points can also be combined with labels that are created using the axis scale.

 

Note
Labels created using this method have a higher priority than labels generated using the axis scale.

 

Example

This example demonstrates how to set data point axis labels.

Visual Basic Copy Code
Imports Dundas.Charting.WinControl
   ...

' Set two data point axis labels.
Chart1.Series("Default").Points(0).AxisLabel = "First Point"
Chart1.Series("Default").Points(1).AxisLabel = "Second Point"

C# Copy Code
using Dundas.Charting.WinControl;
   ...

// Set two data point axis labels.
Chart1.Series["Default"].Points[0].AxisLabel = "First Point";
Chart1.Series["Default"].Points[1].AxisLabel = "Second Point";

 

Using Custom Labels

Custom labels are used to provide custom text for axes. Custom labels are implemented using the CustomLabels collection property. This collection can be accessed at design-time by using the CustomLabel Collection Editor which is found within the Axis Collection Editor.

When using CustomLabel objects, you must set the To and From properties of each custom label, and these properties must specify the width of the label's plotting area. Do not assign the same value to both of these properties because they represent a range. To position a custom label directly beneath a data point, and its associated tick mark, set the From property to the value of that data point's axis minus half of the tick mark interval, and set the To property to the value of that data point's axis plus half of the tick mark interval. For example, if an axis has an interval of 1 (e.g. 1, 2, 3, etc.), and a custom label is required for the value of "2", then set the To and From properties to 1.5 and 2.5, respectively.

 

The RowIndex property specifies on which row the custom label will be displayed. If a custom label is used in the first label row, then every label in this first row must also be a custom label. The only type of labels permitted in the second row of labels and on, are custom labels.

See Also

©2009. All Rights Reserved.