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().setCrossType(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 | ||
---|---|---|
method | getArea() | |
Gets the |
||
method | getAxisBetweenCategories() | |
method | setAxisBetweenCategories(value) | |
Represents if the value axis crosses the category axis between categories. | ||
method | getAxisLabels() | |
Gets the labels of the axis after call Chart.Calculate() method.
|
||
method | getAxisLine() | |
Gets the appearance of an Axis.
|
||
method | getBaseUnitScale() | |
method | setBaseUnitScale(value) | |
Represents the base unit scale for the category axis. The value of the property is TimeUnit integer constant. | ||
method | getBins() | |
Represents bins on a chart(Histogram/Pareto) axis
|
||
method | getCategoryType() | |
method | setCategoryType(value) | |
Represents the category axis type. The value of the property is CategoryType integer constant. | ||
method | getCrossAt() | |
method | setCrossAt(value) | |
Represents the point on the value axis where the category axis crosses it. | ||
method | getCrossType() | |
method | setCrossType(value) | |
Represents the |
||
method | getCustomUnit() | |
method | setCustomUnit(value) | |
Specifies a custom value for the display unit. | ||
method | getCustUnit() | |
method | setCustUnit(value) | |
Specifies a custom value for the display unit. | ||
method | getDisplayUnit() | |
method | setDisplayUnit(value) | |
Represents the unit label for the specified axis. The value of the property is DisplayUnitType integer constant. | ||
method | 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.
|
||
method | hasMultiLevelLabels() | |
method | setHasMultiLevelLabels(value) | |
Indicates whether the labels shall be shown as multi level. | ||
method | isAutomaticMajorUnit() | |
method | setAutomaticMajorUnit(value) | |
Indicates whether the major unit of the axis is automatically assigned. | ||
method | isAutomaticMaxValue() | |
method | setAutomaticMaxValue(value) | |
Indicates whether the max value is automatically assigned. | ||
method | isAutomaticMinorUnit() | |
method | setAutomaticMinorUnit(value) | |
Indicates whether the minor unit of the axis is automatically assigned. | ||
method | isAutomaticMinValue() | |
method | setAutomaticMinValue(value) | |
Indicates whether the min value is automatically assigned. | ||
method | isAutoTickLabelSpacing() | |
method | setAutoTickLabelSpacing(value) | |
Indicates whether the spacing of tick label is automatic | ||
method | isBaseUnitAuto() | |
method | setBaseUnitAuto(value) | |
Represents whether the base unit is automatic. | ||
method | isDisplayUnitLabelShown() | |
method | setDisplayUnitLabelShown(value) | |
Represents if the display unit label is shown on the specified axis. | ||
method | isLogarithmic() | |
method | setLogarithmic(value) | |
Represents if the value axis scale type is logarithmic or not. | ||
method | isPlotOrderReversed() | |
method | setPlotOrderReversed(value) | |
Represents if Microsoft Excel plots data points from last to first. | ||
method | isVisible() | |
method | setVisible(value) | |
Represents if the axis is visible. | ||
method | getLogBase() | |
method | setLogBase(value) | |
Represents the logarithmic base. Default value is 10.Only applies for Excel2007. | ||
method | getMajorGridLines() | |
Represents major gridlines on a chart axis.
|
||
method | getMajorTickMark() | |
method | setMajorTickMark(value) | |
Represents the type of major tick mark for the specified axis. The value of the property is TickMarkType integer constant. | ||
method | getMajorUnit() | |
method | setMajorUnit(value) | |
Represents the major units for the axis. | ||
method | getMajorUnitScale() | |
method | setMajorUnitScale(value) | |
Represents the major unit scale for the category axis. The value of the property is TimeUnit integer constant. | ||
method | getMaxValue() | |
method | setMaxValue(value) | |
Represents the maximum value on the value axis. | ||
method | getMinorGridLines() | |
Represents minor gridlines on a chart axis.
|
||
method | getMinorTickMark() | |
method | setMinorTickMark(value) | |
Represents the type of minor tick mark for the specified axis. The value of the property is TickMarkType integer constant. | ||
method | getMinorUnit() | |
method | setMinorUnit(value) | |
Represents the minor units for the axis. | ||
method | getMinorUnitScale() | |
method | setMinorUnitScale(value) | |
Represents the major unit scale for the category axis. The value of the property is TimeUnit integer constant. | ||
method | getMinValue() | |
method | setMinValue(value) | |
Represents the minimum value on the value axis. | ||
method | getTickLabelPosition() | |
method | setTickLabelPosition(value) | |
Represents the position of tick-mark labels on the specified axis. The value of the property is TickLabelPositionType integer constant. | ||
method | getTickLabels() | |
Returns a |
||
method | getTickLabelSpacing() | |
method | setTickLabelSpacing(value) | |
Represents the number of categories or series between tick-mark labels. Applies only to category and series axes. | ||
method | getTickMarkSpacing() | |
method | setTickMarkSpacing(value) | |
Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. | ||
method | getTitle() | |
Gets the axis' title.
|
Method Summary | ||
---|---|---|
method | getAxisTexts() | |
Gets the labels of the axis after call Chart.Calculate() method.
|
boolean isAutomaticMinValue() / setAutomaticMinValue(value)
Object getMinValue() / setMinValue(value)
boolean isAutomaticMaxValue() / setAutomaticMaxValue(value)
Object getMaxValue() / setMaxValue(value)
boolean isAutomaticMajorUnit() / setAutomaticMajorUnit(value)
float getMajorUnit() / setMajorUnit(value)
boolean isAutomaticMinorUnit() / setAutomaticMinorUnit(value)
float getMinorUnit() / setMinorUnit(value)
int getMajorTickMark() / setMajorTickMark(value)
int getMinorTickMark() / setMinorTickMark(value)
int getTickLabelPosition() / setTickLabelPosition(value)
float getCrossAt() / setCrossAt(value)
int getCrossType() / setCrossType(value)
float getLogBase() / setLogBase(value)
boolean isLogarithmic() / setLogarithmic(value)
boolean isPlotOrderReversed() / setPlotOrderReversed(value)
boolean getAxisBetweenCategories() / setAxisBetweenCategories(value)
TickLabels getTickLabels()
int getTickLabelSpacing() / setTickLabelSpacing(value)
boolean isAutoTickLabelSpacing() / setAutoTickLabelSpacing(value)
int getTickMarkSpacing() / setTickMarkSpacing(value)
int getDisplayUnit() / setDisplayUnit(value)
int getCustUnit() / setCustUnit(value)
int getCustomUnit() / setCustomUnit(value)
DisplayUnitLabel getDisplayUnitLabel()
boolean isDisplayUnitLabelShown() / setDisplayUnitLabelShown(value)
int getCategoryType() / setCategoryType(value)
int getBaseUnitScale() / setBaseUnitScale(value)
boolean isBaseUnitAuto() / setBaseUnitAuto(value)
int getMajorUnitScale() / setMajorUnitScale(value)
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)
int getMinorUnitScale() / setMinorUnitScale(value)
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)
boolean isVisible() / setVisible(value)
Line getMajorGridLines()
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)
boolean hasMultiLevelLabels() / setHasMultiLevelLabels(value)
ArrayList getAxisLabels()