Axis Class

Encapsulates the object that represents a chart's axis.
Inheritance Hierarchy
SystemObject
  Aspose.Cells.ChartsAxis

Namespace:  Aspose.Cells.Charts
Assembly:  Aspose.Cells (in Aspose.Cells.dll) Version: 20.10.0.0 (20.10)
Syntax
public class Axis

The Axis type exposes the following members.

Properties
  NameDescription
Public propertyArea
Gets the Area.
Public propertyAxisBetweenCategories
Represents if the value axis crosses the category axis between categories.
Public propertyAxisLabels
Gets the labels of the axis after call Chart.Calculate() method.
Public propertyAxisLine
Gets the appearance of an Axis.
Public propertyBaseUnitScale
Represents the base unit scale for the category axis.
Public propertyCategoryType
Represents the category axis type.
Public propertyCrossAt
Represents the point on the value axis where the category axis crosses it.
Public propertyCrossType
Represents the CrossType on the specified axis where the other axis crosses.
Public propertyCustUnit
Specifies a custom value for the display unit.
Public propertyDisplayUnit
Represents the unit label for the specified axis.
Public propertyDisplayUnitLabel
Represents a unit label on an axis in the specified chart. Unit labels are useful for charting large values¡ª for example, in the millions or billions.
Public propertyHasMultiLevelLabels
Indicates whether the labels shall be shown as multi level.
Public propertyIsAutomaticMajorUnit
Indicates whether the major unit of the axis is automatically assigned.
Public propertyIsAutomaticMaxValue
Indicates whether the max value is automatically assigned.
Public propertyIsAutomaticMinorUnit
Indicates whether the minor unit of the axis is automatically assigned.
Public propertyIsAutomaticMinValue
Indicates whether the min value is automatically assigned.
Public propertyIsAutoTickLabelSpacing
Indicates whether ticklabel spacing is automatic
Public propertyIsDisplayUnitLabelShown
Represents if the display unit label is shown on the specified axis.
Public propertyIsLogarithmic
Represents if the value axis scale type is logarithmic or not.
Public propertyIsPlotOrderReversed
Represents if Microsoft Excel plots data points from last to first.
Public propertyIsVisible
Represents if the axis is visible.
Public propertyLogBase
Represents the logarithmic base. Default value is 10.Only applies for Excel2007.
Public propertyCode exampleMajorGridLines
Represents major gridlines on a chart axis.
Public propertyMajorTickMark
Represents the type of major tick mark for the specified axis.
Public propertyMajorUnit
Represents the major units for the axis.
Public propertyCode exampleMajorUnitScale
Represents the major unit scale for the category axis.
Public propertyMaxValue
Represents the maximum value on the value axis.
Public propertyMinorGridLines
Represents minor gridlines on a chart axis.
Public propertyMinorTickMark
Represents the type of minor tick mark for the specified axis.
Public propertyMinorUnit
Represents the minor units for the axis.
Public propertyCode exampleMinorUnitScale
Represents the major unit scale for the category axis.
Public propertyMinValue
Represents the minimum value on the value axis.
Public propertyTickLabelPosition
Represents the position of tick-mark labels on the specified axis.
Public propertyTickLabels
Returns a TickLabels object that represents the tick-mark labels for the specified axis.
Public propertyTickLabelSpacing
Represents the number of categories or series between tick-mark labels. Applies only to category and series axes.
Public propertyTickMarkSpacing
Returns or sets the number of categories or series between tick marks. Applies only to category and series axes.
Public propertyTitle
Gets the axis' title.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
[C#]

//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Excel object
int sheetIndex = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//Adding a sample value to "A1" cell
worksheet.Cells["A1"].PutValue(50);
//Adding a sample value to "A2" cell
worksheet.Cells["A2"].PutValue(100);
//Adding a sample value to "A3" cell
worksheet.Cells["A3"].PutValue(150);
//Adding a sample value to "B1" cell
worksheet.Cells["B1"].PutValue(4);
//Adding a sample value to "B2" cell
worksheet.Cells["B2"].PutValue(20);
//Adding a sample value to "B3" cell
worksheet.Cells["B3"].PutValue(50);
//Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 25, 5);
//Accessing the instance of the newly added chart
Chart chart = worksheet.Charts[chartIndex];
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", true);
//Set the max value of value axis
chart.ValueAxis.MaxValue = 200;
//Set the min value of value axis
chart.ValueAxis.MinValue = 0;
//Set the major unit
chart.ValueAxis.MajorUnit = 25;
//Category(X) axis crosses at the maxinum value.
chart.ValueAxis.Crosses = CrossType.Maximum;
//Set he number of categories or series between tick-mark labels. 
chart.CategoryAxis.TickLabelSpacing = 2;
//Saving the Excel file
workbook.Save("C:\\book1.xls");

[Visual Basic]

'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Adding a new worksheet to the Excel object
Dim sheetIndex As Int32 = workbook.Worksheets.Add()
'Obtaining the reference of the newly added worksheet by passing its sheet index
Dim worksheet As Worksheet = workbook.Worksheets(sheetIndex)
'Adding a sample value to "A1" cell
worksheet.Cells("A1").PutValue(50)
'Adding a sample value to "A2" cell
worksheet.Cells("A2").PutValue(100)
'Adding a sample value to "A3" cell
worksheet.Cells("A3").PutValue(150)
'Adding a sample value to "B1" cell
worksheet.Cells("B1").PutValue(4)
'Adding a sample value to "B2" cell
worksheet.Cells("B2").PutValue(20)
'Adding a sample value to "B3" cell
worksheet.Cells("B3").PutValue(50)
'Adding a chart to the worksheet
Dim chartIndex As Int32 = worksheet.Charts.Add(ChartType.Column, 5, 0, 25, 5)
'Accessing the instance of the newly added chart
Dim chart As Chart = worksheet.Charts(chartIndex)
'Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", True)
'Set the max value of value axis
chart.ValueAxis.MaxValue = 200
'Set the min value of value axis
chart.ValueAxis.MinValue = 0
'Set the major unit
chart.ValueAxis.MajorUnit = 25
'Category(X) axis crosses at the maxinum value.
chart.ValueAxis.Crosses = CrossType.Maximum
'Set he number of categories or series between tick-mark labels. 
chart.CategoryAxis.TickLabelSpacing = 2
'Saving the Excel file
workbook.Save("C:\book1.xls")
See Also