public class Axis
Example:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Excel object
int sheetIndex = workbook.getWorksheets().add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet 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
int chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 25, 5);
//Accessing the instance of the newly added chart
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().setCrossType(CrossType.MAXIMUM);
//Set he number of categories or series between tick-mark labels.
chart.getCategoryAxis().setTickLabelSpacing(2);
//Saving the Excel file
workbook.save("C:\\book1.xls");
Property Getters/Setters Summary | ||
---|---|---|
Area | getArea() | |
Gets the |
||
boolean | getAxisBetweenCategories() | |
void | setAxisBetweenCategories(booleanvalue) | |
Represents if the value axis crosses the category axis between categories. | ||
java.util.ArrayList | getAxisLabels() | |
Gets the labels of the axis after call Chart.Calculate() methond.
|
||
Line | getAxisLine() | |
Gets the appearance of an Axis.
|
||
int | getBaseUnitScale() | |
void | setBaseUnitScale(intvalue) | |
Represents the base unit scale for the category axis. The value of the property is TimeUnit integer constant. | ||
int | getCategoryType() | |
void | setCategoryType(intvalue) | |
Represents the category axis type. The value of the property is CategoryType integer constant. | ||
double | getCrossAt() | |
void | setCrossAt(doublevalue) | |
Represents the point on the value axis where the category axis crosses it. | ||
int | getCrossType() | |
void | setCrossType(intvalue) | |
Represents the |
||
int | getCustUnit() | |
void | setCustUnit(intvalue) | |
Specifies a custom value for the display unit. | ||
int | getDisplayUnit() | |
void | setDisplayUnit(intvalue) | |
Represents the unit label for the specified axis. The value of the property is DisplayUnitType integer constant. | ||
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.
|
||
boolean | hasMultiLevelLabels() | |
void | setHasMultiLevelLabels(booleanvalue) | |
Indicates whether the labels shall be shown as multi level. | ||
boolean | isAutomaticMajorUnit() | |
void | setAutomaticMajorUnit(booleanvalue) | |
Indicates whether the major unit of the axis is automatically assigned. | ||
boolean | isAutomaticMaxValue() | |
void | setAutomaticMaxValue(booleanvalue) | |
Indicates whether the max value is automatically assigned. | ||
boolean | isAutomaticMinorUnit() | |
void | setAutomaticMinorUnit(booleanvalue) | |
Indicates whether the minor unit of the axis is automatically assigned. | ||
boolean | isAutomaticMinValue() | |
void | setAutomaticMinValue(booleanvalue) | |
Indicates whether the min value is automatically assigned. | ||
boolean | isAutoTickLabelSpacing() | |
void | setAutoTickLabelSpacing(booleanvalue) | |
Indicates whether ticklabel spacing is automatic | ||
boolean | isBaseUnitAuto() | |
void | setBaseUnitAuto(booleanvalue) | |
Represents whether the base unit is automatic. | ||
boolean | isDisplayUnitLabelShown() | |
void | setDisplayUnitLabelShown(booleanvalue) | |
Represents if the display unit label is shown on the specified axis. | ||
boolean | isLogarithmic() | |
void | setLogarithmic(booleanvalue) | |
Represents if the value axis scale type is logarithmic or not. | ||
boolean | isPlotOrderReversed() | |
void | setPlotOrderReversed(booleanvalue) | |
Represents if Microsoft Excel plots data points from last to first. | ||
boolean | isVisible() | |
void | setVisible(booleanvalue) | |
Represents if the axis is visible. | ||
double | getLogBase() | |
void | setLogBase(doublevalue) | |
Represents the logarithmic base. Default value is 10.Only applies for Excel2007. | ||
Line | getMajorGridLines() | |
Represents major gridlines on a chart axis.
|
||
int | getMajorTickMark() | |
void | setMajorTickMark(intvalue) | |
Represents the type of major tick mark for the specified axis. The value of the property is TickMarkType integer constant. | ||
double | getMajorUnit() | |
void | setMajorUnit(doublevalue) | |
Represents the major units for the axis. | ||
int | getMajorUnitScale() | |
void | setMajorUnitScale(intvalue) | |
Represents the major unit scale for the category axis. The value of the property is TimeUnit integer constant. | ||
java.lang.Object | getMaxValue() | |
void | setMaxValue(java.lang.Objectvalue) | |
Represents the maximum value on the value axis. | ||
Line | getMinorGridLines() | |
Represents minor gridlines on a chart axis.
|
||
int | getMinorTickMark() | |
void | setMinorTickMark(intvalue) | |
Represents the type of minor tick mark for the specified axis. The value of the property is TickMarkType integer constant. | ||
double | getMinorUnit() | |
void | setMinorUnit(doublevalue) | |
Represents the minor units for the axis. | ||
int | getMinorUnitScale() | |
void | setMinorUnitScale(intvalue) | |
Represents the major unit scale for the category axis. The value of the property is TimeUnit integer constant. | ||
java.lang.Object | getMinValue() | |
void | setMinValue(java.lang.Objectvalue) | |
Represents the minimum value on the value axis. | ||
int | getTickLabelPosition() | |
void | setTickLabelPosition(intvalue) | |
Represents the position of tick-mark labels on the specified axis. The value of the property is TickLabelPositionType integer constant. | ||
TickLabels | getTickLabels() | |
Returns a |
||
int | getTickLabelSpacing() | |
void | setTickLabelSpacing(intvalue) | |
Represents the number of categories or series between tick-mark labels. Applies only to category and series axes. | ||
int | getTickMarkSpacing() | |
void | setTickMarkSpacing(intvalue) | |
Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. | ||
Title | getTitle() | |
Gets the axis' title.
|
Method Summary | ||
---|---|---|
boolean | isAutoCross() | |
Indicates whether Microsoft Workbook automatically sets the axis crossing point.
|
||
boolean | isCrossAtMax() | |
Indicates whether Microsoft Workbook automatically sets the axis crossing point.
|
||
void | setAutoCross() | |
Sets the axis crossing point as automatic.
|
||
void | setCrossAtMax(boolean isCrossAtMax) | |
Sets whether the axis crosses at the maximum value.
|
public Area getArea()
public boolean isAutomaticMinValue() / public void setAutomaticMinValue(boolean value)
public java.lang.Object getMinValue() / public void setMinValue(java.lang.Object value)
public boolean isAutomaticMaxValue() / public void setAutomaticMaxValue(boolean value)
public java.lang.Object getMaxValue() / public void setMaxValue(java.lang.Object value)
public boolean isAutomaticMajorUnit() / public void setAutomaticMajorUnit(boolean value)
public double getMajorUnit() / public void setMajorUnit(double value)
public boolean isAutomaticMinorUnit() / public void setAutomaticMinorUnit(boolean value)
public double getMinorUnit() / public void setMinorUnit(double value)
public Line getAxisLine()
public int getMajorTickMark() / public void setMajorTickMark(int value)
public int getMinorTickMark() / public void setMinorTickMark(int value)
public int getTickLabelPosition() / public void setTickLabelPosition(int value)
public double getCrossAt() / public void setCrossAt(double value)
public int getCrossType() / public void setCrossType(int value)
public double getLogBase() / public void setLogBase(double value)
public boolean isLogarithmic() / public void setLogarithmic(boolean value)
public boolean isPlotOrderReversed() / public void setPlotOrderReversed(boolean value)
public boolean getAxisBetweenCategories() / public void setAxisBetweenCategories(boolean value)
public TickLabels getTickLabels()
public int getTickLabelSpacing() / public void setTickLabelSpacing(int value)
public boolean isAutoTickLabelSpacing() / public void setAutoTickLabelSpacing(boolean value)
public int getTickMarkSpacing() / public void setTickMarkSpacing(int value)
public int getDisplayUnit() / public void setDisplayUnit(int value)
public int getCustUnit() / public void setCustUnit(int value)
public DisplayUnitLabel getDisplayUnitLabel()
public boolean isDisplayUnitLabelShown() / public void setDisplayUnitLabelShown(boolean value)
public Title getTitle()
public int getCategoryType() / public void setCategoryType(int value)
public int getBaseUnitScale() / public void setBaseUnitScale(int value)
public boolean isBaseUnitAuto() / public void setBaseUnitAuto(boolean value)
public int getMajorUnitScale() / public void setMajorUnitScale(int value)
Example:
chart.getCategoryAxis().setCategoryType(CategoryType.TIME_SCALE); chart.getCategoryAxis().setMajorUnitScale(TimeUnit.MONTHS); chart.getCategoryAxis().setMajorUnit(2);
public int getMinorUnitScale() / public void setMinorUnitScale(int value)
Example:
chart.getCategoryAxis().setCategoryType(CategoryType.TIME_SCALE); chart.getCategoryAxis().setMinorUnitScale(TimeUnit.MONTHS); chart.getCategoryAxis().setMinorUnit(2);
public boolean isVisible() / public void setVisible(boolean value)
public Line getMajorGridLines()
Example:
chart.getValueAxis().getMajorGridLines().setVisible(false); chart.getCategoryAxis().getMajorGridLines().setVisible(true);
public Line getMinorGridLines()
public boolean hasMultiLevelLabels() / public void setHasMultiLevelLabels(boolean value)
public java.util.ArrayList getAxisLabels()
public boolean isAutoCross()
public boolean isCrossAtMax()
public void setAutoCross()
public void setCrossAtMax(boolean isCrossAtMax)