asposecells.api
Class Axis

Encapsulates the object that represents a chart's axis.

Example:

# Instantiating a Workbook object
workbook = Workbook()
# Adding a new worksheet to the Excel object
sheetIndex = workbook.getWorksheets().add()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.getWorksheets().get(sheetIndex)
# Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50)
# Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100)
# Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150)
# Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(4)
# Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(20)
# Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50)
# Adding a chart to the worksheet
chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 25, 5)
# Accessing the instance of the newly added chart
chart = worksheet.getCharts().get(chartIndex)
# Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.getNSeries().add("A1:B3", True)
# Set the max value of value axis
chart.getValueAxis().setMaxValue(200)
# Set the min value of value axis
chart.getValueAxis().setMinValue(0)
# Set the major unit
chart.getValueAxis().setMajorUnit(25)
# Category(X) axis crosses at the maxinum value.
chart.getValueAxis().setCrosses(CrossType.MAXIMUM)
# Set he number of categories or series between tick-mark labels. 
chart.getCategoryAxis().setTickLabelSpacing(2)
# Saving the Excel file
workbook.save("Book1.xlsx")

Property Getters/Setters Summary
methodgetArea()
           Gets the Area.
methodgetAxisBetweenCategories()
methodsetAxisBetweenCategories(value)
           Represents if the value axis crosses the category axis between categories.
methodgetAxisLabels()
           Gets the labels of the axis after call Chart.Calculate() methond.
methodgetAxisLine()
           Gets the appearance of an Axis.
methodgetBaseUnitScale()
methodsetBaseUnitScale(value)
           Represents the base unit scale for the category axis. The value of the property is TimeUnit integer constant.
methodgetCategoryType()
methodsetCategoryType(value)
           Represents the category axis type. The value of the property is CategoryType integer constant.
methodgetCrossAt()
methodsetCrossAt(value)
           Represents the point on the value axis where the category axis crosses it.
methodgetCrossType()
methodsetCrossType(value)
           Represents the CrossType on the specified axis where the other axis crosses. The value of the property is CrossType integer constant.
methodgetCustUnit()
methodsetCustUnit(value)
           Specifies a custom value for the display unit.
methodgetDisplayUnit()
methodsetDisplayUnit(value)
           Represents the unit label for the specified axis. The value of the property is DisplayUnitType integer constant.
methodgetDisplayUnitLabel()
           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.
methodhasMultiLevelLabels()
methodsetHasMultiLevelLabels(value)
           Indicates whether the labels shall be shown as multi level.
methodisAutomaticMajorUnit()
methodsetAutomaticMajorUnit(value)
           Indicates whether the major unit of the axis is automatically assigned.
methodisAutomaticMaxValue()
methodsetAutomaticMaxValue(value)
           Indicates whether the max value is automatically assigned.
methodisAutomaticMinorUnit()
methodsetAutomaticMinorUnit(value)
           Indicates whether the minor unit of the axis is automatically assigned.
methodisAutomaticMinValue()
methodsetAutomaticMinValue(value)
           Indicates whether the min value is automatically assigned.
methodisAutoTickLabelSpacing()
methodsetAutoTickLabelSpacing(value)
           Indicates whether ticklabel spacing is automatic
methodisBaseUnitAuto()
methodsetBaseUnitAuto(value)
           Represents whether the base unit is automatic.
methodisDisplayUnitLabelShown()
methodsetDisplayUnitLabelShown(value)
           Represents if the display unit label is shown on the specified axis.
methodisLogarithmic()
methodsetLogarithmic(value)
           Represents if the value axis scale type is logarithmic or not.
methodisPlotOrderReversed()
methodsetPlotOrderReversed(value)
           Represents if Microsoft Excel plots data points from last to first.
methodisVisible()
methodsetVisible(value)
           Represents if the axis is visible.
methodgetLogBase()
methodsetLogBase(value)
           Represents the logarithmic base. Default value is 10.Only applies for Excel2007.
methodgetMajorGridLines()
           Represents major gridlines on a chart axis.
methodgetMajorTickMark()
methodsetMajorTickMark(value)
           Represents the type of major tick mark for the specified axis. The value of the property is TickMarkType integer constant.
methodgetMajorUnit()
methodsetMajorUnit(value)
           Represents the major units for the axis.
methodgetMajorUnitScale()
methodsetMajorUnitScale(value)
           Represents the major unit scale for the category axis. The value of the property is TimeUnit integer constant.
methodgetMaxValue()
methodsetMaxValue(value)
           Represents the maximum value on the value axis.
methodgetMinorGridLines()
           Represents minor gridlines on a chart axis.
methodgetMinorTickMark()
methodsetMinorTickMark(value)
           Represents the type of minor tick mark for the specified axis. The value of the property is TickMarkType integer constant.
methodgetMinorUnit()
methodsetMinorUnit(value)
           Represents the minor units for the axis.
methodgetMinorUnitScale()
methodsetMinorUnitScale(value)
           Represents the major unit scale for the category axis. The value of the property is TimeUnit integer constant.
methodgetMinValue()
methodsetMinValue(value)
           Represents the minimum value on the value axis.
methodgetTickLabelPosition()
methodsetTickLabelPosition(value)
           Represents the position of tick-mark labels on the specified axis. The value of the property is TickLabelPositionType integer constant.
methodgetTickLabels()
           Returns a TickLabels object that represents the tick-mark labels for the specified axis.
methodgetTickLabelSpacing()
methodsetTickLabelSpacing(value)
           Represents the number of categories or series between tick-mark labels. Applies only to category and series axes.
methodgetTickMarkSpacing()
methodsetTickMarkSpacing(value)
           Returns or sets the number of categories or series between tick marks. Applies only to category and series axes.
methodgetTitle()
           Gets the axis' title.
 
Method Summary
methodisAutoCross()
           Indicates whether Microsoft Workbook automatically sets the axis crossing point.
methodisCrossAtMax()
           Indicates whether Microsoft Workbook automatically sets the axis crossing point.
methodsetAutoCross()
           Sets the axis crossing point as automatic.
methodsetCrossAtMax(isCrossAtMax)
           Sets whether the axis crosses at the maximum value.
 

Property Getters/Setters Detail

getArea : Area 

Area getArea()
Gets the Area.

isAutomaticMinValue/setAutomaticMinValue : boolean 

boolean isAutomaticMinValue() / setAutomaticMinValue(value)
Indicates whether the min value is automatically assigned.

getMinValue/setMinValue : Object 

Object getMinValue() / setMinValue(value)
Represents the minimum value on the value axis. The minValue type only can be double or DateTime

isAutomaticMaxValue/setAutomaticMaxValue : boolean 

boolean isAutomaticMaxValue() / setAutomaticMaxValue(value)
Indicates whether the max value is automatically assigned.

getMaxValue/setMaxValue : Object 

Object getMaxValue() / setMaxValue(value)
Represents the maximum value on the value axis. The maxValue type only can be double or DateTime

isAutomaticMajorUnit/setAutomaticMajorUnit : boolean 

boolean isAutomaticMajorUnit() / setAutomaticMajorUnit(value)
Indicates whether the major unit of the axis is automatically assigned.

getMajorUnit/setMajorUnit : float 

float getMajorUnit() / setMajorUnit(value)
Represents the major units for the axis. The major units must be greater than zero.

isAutomaticMinorUnit/setAutomaticMinorUnit : boolean 

boolean isAutomaticMinorUnit() / setAutomaticMinorUnit(value)
Indicates whether the minor unit of the axis is automatically assigned.

getMinorUnit/setMinorUnit : float 

float getMinorUnit() / setMinorUnit(value)
Represents the minor units for the axis. The minor units must be greater than zero.

getAxisLine : Line 

Line getAxisLine()
Gets the appearance of an Axis.

getMajorTickMark/setMajorTickMark : int 

int getMajorTickMark() / setMajorTickMark(value)
Represents the type of major tick mark for the specified axis. The value of the property is TickMarkType integer constant.

getMinorTickMark/setMinorTickMark : int 

int getMinorTickMark() / setMinorTickMark(value)
Represents the type of minor tick mark for the specified axis. The value of the property is TickMarkType integer constant.

getTickLabelPosition/setTickLabelPosition : int 

int getTickLabelPosition() / setTickLabelPosition(value)
Represents the position of tick-mark labels on the specified axis. The value of the property is TickLabelPositionType integer constant.

getCrossAt/setCrossAt : float 

float getCrossAt() / setCrossAt(value)
Represents the point on the value axis where the category axis crosses it. The number should be a integer when it applies to category axis. And the value must be between 1 and 31999.

getCrossType/setCrossType : int 

int getCrossType() / setCrossType(value)
Represents the CrossType on the specified axis where the other axis crosses. The value of the property is CrossType integer constant.

getLogBase/setLogBase : float 

float getLogBase() / setLogBase(value)
Represents the logarithmic base. Default value is 10.Only applies for Excel2007.

isLogarithmic/setLogarithmic : boolean 

boolean isLogarithmic() / setLogarithmic(value)
Represents if the value axis scale type is logarithmic or not.

isPlotOrderReversed/setPlotOrderReversed : boolean 

boolean isPlotOrderReversed() / setPlotOrderReversed(value)
Represents if Microsoft Excel plots data points from last to first.

getAxisBetweenCategories/setAxisBetweenCategories : boolean 

boolean getAxisBetweenCategories() / setAxisBetweenCategories(value)
Represents if the value axis crosses the category axis between categories. This property applies only to category axes, and it doesn't apply to 3-D charts.

getTickLabels : TickLabels 

TickLabels getTickLabels()
Returns a TickLabels object that represents the tick-mark labels for the specified axis.

getTickLabelSpacing/setTickLabelSpacing : int 

int getTickLabelSpacing() / setTickLabelSpacing(value)
Represents the number of categories or series between tick-mark labels. Applies only to category and series axes. The number must be between 1 and 31999.

isAutoTickLabelSpacing/setAutoTickLabelSpacing : boolean 

boolean isAutoTickLabelSpacing() / setAutoTickLabelSpacing(value)
Indicates whether ticklabel spacing is automatic

getTickMarkSpacing/setTickMarkSpacing : int 

int getTickMarkSpacing() / setTickMarkSpacing(value)
Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. The number must be between 1 and 31999.

getDisplayUnit/setDisplayUnit : int 

int getDisplayUnit() / setDisplayUnit(value)
Represents the unit label for the specified axis. The value of the property is DisplayUnitType integer constant.

getCustUnit/setCustUnit : int 

int getCustUnit() / setCustUnit(value)
Specifies a custom value for the display unit.

getDisplayUnitLabel : DisplayUnitLabel 

DisplayUnitLabel getDisplayUnitLabel()
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.

isDisplayUnitLabelShown/setDisplayUnitLabelShown : boolean 

boolean isDisplayUnitLabelShown() / setDisplayUnitLabelShown(value)
Represents if the display unit label is shown on the specified axis. The default value is True.

getTitle : Title 

Title getTitle()
Gets the axis' title.

getCategoryType/setCategoryType : int 

int getCategoryType() / setCategoryType(value)
Represents the category axis type. The value of the property is CategoryType integer constant.

getBaseUnitScale/setBaseUnitScale : int 

int getBaseUnitScale() / setBaseUnitScale(value)
Represents the base unit scale for the category axis. The value of the property is TimeUnit integer constant.Setting this property only takes effect when the CategoryType property is set to TimeScale.

isBaseUnitAuto/setBaseUnitAuto : boolean 

boolean isBaseUnitAuto() / setBaseUnitAuto(value)
Represents whether the base unit is automatic.

getMajorUnitScale/setMajorUnitScale : int 

int getMajorUnitScale() / setMajorUnitScale(value)
Represents the major unit scale for the category axis. The value of the property is TimeUnit integer constant.

Example:

workbook = Workbook()
# Adding a new worksheet to the Excel object
sheetIndex = workbook.getWorksheets().add()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.getWorksheets().get(sheetIndex)
# Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50)
# Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100)
# Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150)
# Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(4)
# Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(20)
# Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50)
# Adding a chart to the worksheet
chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 25, 5)
# Accessing the instance of the newly added chart
chart = worksheet.getCharts().get(chartIndex)
chart.getCategoryAxis().setCategoryType(CategoryType.TIME_SCALE)
chart.getCategoryAxis().setMajorUnitScale(TimeUnit.MONTHS)
chart.getCategoryAxis().setMajorUnit(2)

getMinorUnitScale/setMinorUnitScale : int 

int getMinorUnitScale() / setMinorUnitScale(value)
Represents the major unit scale for the category axis. The value of the property is TimeUnit integer constant.

Example:

workbook = Workbook()
# Adding a new worksheet to the Excel object
sheetIndex = workbook.getWorksheets().add()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.getWorksheets().get(sheetIndex)
# Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50)
# Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100)
# Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150)
# Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(4)
# Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(20)
# Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50)
# Adding a chart to the worksheet
chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 25, 5)
# Accessing the instance of the newly added chart
chart = worksheet.getCharts().get(chartIndex)
chart.getCategoryAxis().setCategoryType(CategoryType.TIME_SCALE)
chart.getCategoryAxis().setMinorUnitScale(TimeUnit.MONTHS)
chart.getCategoryAxis().setMinorUnit(2)

isVisible/setVisible : boolean 

boolean isVisible() / setVisible(value)
Represents if the axis is visible.

getMajorGridLines : Line 

Line getMajorGridLines()
Represents major gridlines on a chart axis.

Example:

workbook = Workbook()
# Adding a new worksheet to the Excel object
sheetIndex = workbook.getWorksheets().add()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.getWorksheets().get(sheetIndex)
# Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50)
# Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100)
# Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150)
# Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(4)
# Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(20)
# Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50)
# Adding a chart to the worksheet
chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 25, 5)
# Accessing the instance of the newly added chart
chart = worksheet.getCharts().get(chartIndex)
chart.getValueAxis().getMajorGridLines().setVisible(False)
chart.getCategoryAxis().getMajorGridLines().setVisible(True)

getMinorGridLines : Line 

Line getMinorGridLines()
Represents minor gridlines on a chart axis.

hasMultiLevelLabels/setHasMultiLevelLabels : boolean 

boolean hasMultiLevelLabels() / setHasMultiLevelLabels(value)
Indicates whether the labels shall be shown as multi level. Only valid for category axis.

getAxisLabels : ArrayList 

ArrayList getAxisLabels()
Gets the labels of the axis after call Chart.Calculate() methond.

Method Detail

isAutoCross

boolean isAutoCross()
Indicates whether Microsoft Workbook automatically sets the axis crossing point. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Charts.Axis.CrossType property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.

isCrossAtMax

boolean isCrossAtMax()
Indicates whether Microsoft Workbook automatically sets the axis crossing point. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Charts.Axis.CrossType property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.

setAutoCross

 setAutoCross()
Sets the axis crossing point as automatic. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Charts.Axis.CrossType property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.

setCrossAtMax

 setCrossAtMax(isCrossAtMax)
Sets whether the axis crosses at the maximum value. NOTE: This member is now obsolete. Instead, please use Aspose.Cells.Charts.Axis.CrossType property. This property will be removed 12 months later since JANUARY 2012. Aspose apologizes for any inconvenience you may have experienced.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.