In the Aspose.Chart API, axes are represented by the Axis class. It provides properties that allow you to modify various aspects of a chart axis such as labels, grid, tick marks, minimum, maximum etc.
Setting Arrows
Each axis might contain arrows which are drawn at one of its ends or at both. The following properties are responsible for this:
- Arrow1 indicates what type of arrow is drawn at the left or top end of the axis.
- Arrow2 indicates what type of arrow is drawn at the right or bottom end of the axis.
These properties get or set an AxisArrowType enumeration value.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=66
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=5
Setting a Color
You can control the color of the axis line using the Color property. The default value is Color.Black.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=5
Setting a Width
Use the Width property to control the width of the axis line. The default value is 1 pixel.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=5
Setting a Style
You can control the style of the axis line using the Style property. The default style is DashStyle.Solid.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=5
Controlling Visibility
You can control visibility of the axis via the IsVisible property.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=89
Using Automatic Calculation
You can make the axis values such as minimum, maximum and interval for labels to be calculated automatically. To achieve this, use the default value of the IsAutoCalc property which is true. The system will then try to calculate the axis properties automatically to achieve the best scaling and label placement. If IsAutoCalc is set to false, the system will use the values specified in the Minimum , Maximum and Interval properties.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=15
Setting Minimum and Maximum Values
Use the Minimum and Maximum properties to set the minimum and maximum values of the axis.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=42
Setting an Interval
Use the Interval property to set the interval between the labels along the axis. The effect of the Interval property depends on the interval type specified in IntervalType . For example, if IntervalType is integer and Interval is 10, then the labels on the axis will appear for values 0, 10, 20 and so on. The default value of Interval is 1.
To get or set the type of the interval, use the IntervalType property. It specifies the data type of the values output along the axis. The default value is IntervalType.Auto and the system tries to automatically determine the appropriate interval type from the data points, but it is possible to explicitly specify the interval type by setting the IntervalType property.
When Axis values are DateTime values, you can additionally set the interval type by specifying the DateTimeIntervalType property. It allows to specify what time unit is used as an interval for an axis. For example, to specify the labels to appear for every 2nd day, set DateTimeIntervalType to DateTimeIntervalType.Days and set Interval to 2.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=11
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=34
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=35
Managing Tick Marks
Axis provides two types of tick marks - major and minor. They are represented by the TickMark objects which are returned by the MajorTickMark and MinorTickMark properties.
Please refer to the WorkingWithAxisObjects topic to learn more about tick marks.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=7
Managing Labels
Each axis label is represented by an AxisLabel object and all axis labels are stored in the AxisLabels collection. Axis supports as automatically generated as custom (user specified) axis labels.
The collection of automatically generated labels is returned by the AxisLabels property. It is automatically populated when the chart is drawn. Axis also provides the "default label" that serves as a template for axis labels; by setting properties of the default label before adding any series to the chart, you can control the look of all data labels that will be generated for the axis. The default label can be accessed through the DefaultLabel property.
The collection of user defined labels is returned by the CustomLabels property. Use it to add your own axis labels.
See the WorkingWithAxisObjects topic for more information.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=10
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=66
Managing Grids
Each Axis contains two types of grids – major and minor. Grids are represented by the Grid objects which are returned by the MajorGrid and MinorGrid properties. You can control grid visibility using the IsMajorGridVisible and IsMinorGridVisible properties.
See the WorkingWithAxisObjects topic to learn more about grids.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=68
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=11
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=10
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=4
Setting a Title
Axis supports a title which is represented by an AxisLabel object returned by the Title property. The axis title is drawn near the axis. See the WorkingWithAxisObjects topic to learn how to set up axis labels.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=4
Code Sample
[C#]
Axis axis = chartArea.AxisX;
// Setting arrows
axis.Arrow1 = AxisArrowType.LineArrow;
axis.Arrow2 = AxisArrowType.SharpTriangle;
// Setting color
axis.Color = Color.NavajoWhite;
// Setting width
axis.Width = 3;
// Setting style
axis.Style = DashStyle.Dot;
[VB .NET]
Dim axis As Axis = chartArea.AxisX
' Setting arrows
axis.Arrow1 = AxisArrowType.LineArrow
axis.Arrow2 = AxisArrowType.SharpTriangle
' Setting color
axis.Color = Color.NavajoWhite
' Setting width
axis.Width = 3
' Setting style
axis.Style = DashStyle.Dot
Clarifies working with axis objects like tick marks, axis labels, and grids.
10/28/2005 10:25:11 AM - -83.217.194.222
Clarifies working with axis objects like tick marks, axis labels, and grids.
10/28/2005 10:25:11 AM - -83.217.194.222
Clarifies working with axis objects like tick marks, axis labels, and grids.
10/28/2005 10:25:11 AM - -83.217.194.222
Clarifies working with axis objects like tick marks, axis labels, and grids.
10/28/2005 10:25:11 AM - -83.217.194.222