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 "A4" cell worksheet.getCells().get("A4").putValue(200) # Adding a sample value to "B1" cell worksheet.getCells().get("B1").putValue(60) # Adding a sample value to "B2" cell worksheet.getCells().get("B2").putValue(32) # Adding a sample value to "B3" cell worksheet.getCells().get("B3").putValue(50) # Adding a sample value to "B4" cell worksheet.getCells().get("B4").putValue(40) # Adding a sample value to "C1" cell as category data worksheet.getCells().get("C1").putValue("Q1") # Adding a sample value to "C2" cell as category data worksheet.getCells().get("C2").putValue("Q2") # Adding a sample value to "C3" cell as category data worksheet.getCells().get("C3").putValue("Y1") # Adding a sample value to "C4" cell as category data worksheet.getCells().get("C4").putValue("Y2") # Adding a chart to the worksheet chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 15, 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 "B4" chart.getNSeries().add("A1:B4", True) # Setting the data source for the category data of NSeries chart.getNSeries().setCategoryData("C1:C4") series = chart.getNSeries().get(1) # Setting the values of the series. series.setValues("=B1:B4") # Changing the chart type of the series. series.setType(ChartType.LINE) # Setting marker properties. series.getMarker().setMarkerStyle(ChartMarkerType.CIRCLE) series.getMarker().setForegroundColorSetType(FormattingType.AUTOMATIC) series.getMarker().setForegroundColor(Color.getBlack()) series.getMarker().setBackgroundColorSetType(FormattingType.AUTOMATIC) # Saving the Excel file workbook.save("Book1.xls")
Property Getters/Setters Summary | ||
---|---|---|
method | getArea() | |
Represents the background area of Series object.
|
||
method | getBar3DShapeType() | |
method | setBar3DShapeType(value) | |
Gets or sets the 3D shape type used with the 3-D bar or column chart. The value of the property is Bar3DShapeType integer constant. | ||
method | getBarShape() | |
method | setBarShape(value) | |
Gets or sets the 3D shape type used with the 3-D bar or column chart. The value of the property is Bar3DShapeType integer constant. | ||
method | getBorder() | |
Represents border of Series object.
|
||
method | getBubbleScale() | |
method | setBubbleScale(value) | |
Gets or sets the scale factor for bubbles in the specified chart group. It can be an integer value from 0 (zero) to 300, corresponding to a percentage of the default size. Applies only to bubble charts. | ||
method | getBubbleSizeRepresents() | |
method | setBubbleSizeRepresents(value) | |
Gets what the bubble size represents on a bubble chart. The value of the property is BubbleSizeRepresents integer constant. | ||
method | getBubbleSizes() | |
method | setBubbleSizes(value) | |
Gets or sets the bubble sizes values of the chart series. | ||
method | getCountOfDataValues() | |
Gets the number of the data values.
|
||
method | getDataLabels() | |
Represents the DataLabels object for the specified ASeries.
|
||
method | getDisplayName() | |
Gets the series's name that displays on the chart graph.
|
||
method | getDoughnutHoleSize() | |
method | setDoughnutHoleSize(value) | |
Returns or sets the size of the hole in a doughnut chart group. The hole size is expressed as a percentage of the chart size, between 10 and 90 percent. | ||
method | getDownBars() | |
Returns a |
||
method | getDropLines() | |
Returns a |
||
method | getExplosion() | |
method | setExplosion(value) | |
The distance of an open pie slice from the center of the pie chart is expressed as a percentage of the pie diameter. | ||
method | getFirstSliceAngle() | |
method | setFirstSliceAngle(value) | |
Gets or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts, 0 to 360. | ||
method | getGapWidth() | |
method | setGapWidth(value) | |
Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. The value of this property must be between 0 and 500. | ||
method | getHas3DEffect() | |
method | setHas3DEffect(value) | |
True if the series has a three-dimensional appearance. Applies only to bubble charts. | ||
method | hasDropLines() | |
method | setHasDropLines(value) | |
True if the chart has drop lines. Applies only to line chart or area charts. | ||
method | hasHiLoLines() | |
method | setHasHiLoLines(value) | |
True if the line chart has high-low lines. Applies only to line charts. | ||
method | hasLeaderLines() | |
method | setHasLeaderLines(value) | |
True if the series has leader lines. | ||
method | hasRadarAxisLabels() | |
method | setHasRadarAxisLabels(value) | |
True if a radar chart has category axis labels. Applies only to radar charts. | ||
method | hasSeriesLines() | |
method | setHasSeriesLines(value) | |
True if a stacked column chart or bar chart has series lines or if a Pie of Pie chart or Bar of Pie chart has connector lines between the two sections. Applies only to stacked column charts, bar charts, Pie of Pie charts, or Bar of Pie charts. | ||
method | hasUpDownBars() | |
method | setHasUpDownBars(value) | |
True if a line chart has up and down bars. Applies only to line charts. | ||
method | getHiLoLines() | |
Returns a HiLoLines object that represents the high-low lines for a series on a line chart.
Applies only to line charts.
|
||
method | isAutoSplit() | |
Indicates whether the threshold value is automatic.
|
||
method | isColorVaried() | |
method | setColorVaried(value) | |
Represents if the color of points is varied. The chart must contain only one series. | ||
method | isVerticalValues() | |
Indicates whether the data source is vertical.
|
||
method | getLayoutProperties() | |
Represents the properties of layout.
|
||
method | getLeaderLines() | |
Represents leader lines on a chart. Leader lines connect data labels to data points.
This object isn’t a collection; there’s no object that represents a single leader line.
|
||
method | getLegendEntry() | |
Gets the legend entry according to this series.
|
||
method | getMarker() | |
Gets the |
||
method | getName() | |
method | setName(value) | |
Gets or sets the name of the data series. | ||
method | getOverlap() | |
method | setOverlap(value) | |
Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. | ||
method | getPlotOnSecondAxis() | |
method | setPlotOnSecondAxis(value) | |
Indicates if this series is plotted on second value axis. | ||
method | getPoints() | |
Gets the collection of points in a series in a chart.
|
||
method | getSecondPlotSize() | |
method | setSecondPlotSize(value) | |
Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. | ||
method | getSeriesLines() | |
Returns a SeriesLines object that represents the series lines for a stacked bar chart or a stacked column chart.
Applies only to stacked bar and stacked column charts.
|
||
method | getShadow() | |
method | setShadow(value) | |
True if the series has a shadow. | ||
method | getShapeProperties() | |
Gets the object that holds the visual shape properties of the Series.
|
||
method | getShowNegativeBubbles() | |
method | setShowNegativeBubbles(value) | |
True if negative bubbles are shown for the chart group. Valid only for bubble charts. | ||
method | getSizeRepresents() | |
method | setSizeRepresents(value) | |
Gets or sets what the bubble size represents on a bubble chart. The value of the property is BubbleSizeRepresents integer constant. | ||
method | getSmooth() | |
method | setSmooth(value) | |
Represents curve smoothing. True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and scatter connected by lines charts. | ||
method | getSplitType() | |
method | setSplitType(value) | |
Returns or sets a value that how to determine which data points are in the second pie or bar on a pie of pie or bar of pie chart. The value of the property is ChartSplitType integer constant. | ||
method | getSplitValue() | |
method | setSplitValue(value) | |
Returns or sets a value that shall be used to determine which data points are in the second pie or bar on a pie of pie or bar of pie chart. | ||
method | getTrendLines() | |
Returns an object that represents a collection of all the trendlines for the series.
|
||
method | getType() | |
method | setType(value) | |
Gets or sets a data series' type. The value of the property is ChartType integer constant. | ||
method | getUpBars() | |
Returns an DropBars object that represents the up bars on a line chart.
Applies only to line charts.
|
||
method | getValues() | |
method | setValues(value) | |
Represents the data of the chart series. | ||
method | getValuesFormatCode() | |
method | setValuesFormatCode(value) | |
Represents format code of Values‘s NumberList. | ||
method | getXErrorBar() | |
Represents X direction error bar of the series.
|
||
method | getXValues() | |
method | setXValues(value) | |
Represents the x values of the chart series. | ||
method | getYErrorBar() | |
Represents Y direction error bar of the series.
|
Method Summary | ||
---|---|---|
method | move(count) | |
Moves the series up or down.
|
SeriesLayoutProperties getLayoutProperties()
ChartPointCollection getPoints()
String getName() / setName(value)
Example:
workbook = Workbook() # Get the first worksheet. worksheet = workbook.getWorksheets().get(0) # Adding a chart to the worksheet chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 15, 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 "B4" chart.getNSeries().add("A1:B4", True) # Reference name to a cell chart.getNSeries().get(0).setName("=A1") # Set a string to name chart.getNSeries().get(0).setName("First Series")
String getDisplayName()
int getCountOfDataValues()
boolean isVerticalValues()
String getValues() / setValues(value)
String getValuesFormatCode() / setValuesFormatCode(value)
String getXValues() / setXValues(value)
String getBubbleSizes() / setBubbleSizes(value)
TrendlineCollection getTrendLines()
boolean getSmooth() / setSmooth(value)
boolean getShadow() / setShadow(value)
boolean getHas3DEffect() / setHas3DEffect(value)
int getBar3DShapeType() / setBar3DShapeType(value)
int getBarShape() / setBarShape(value)
DataLabels getDataLabels()
int getType() / setType(value)
boolean getPlotOnSecondAxis() / setPlotOnSecondAxis(value)
boolean hasHiLoLines() / setHasHiLoLines(value)
Line getHiLoLines()
boolean hasSeriesLines() / setHasSeriesLines(value)
Line getSeriesLines()
boolean hasDropLines() / setHasDropLines(value)
Line getDropLines()
boolean hasUpDownBars() / setHasUpDownBars(value)
DropBars getUpBars()
DropBars getDownBars()
boolean isColorVaried() / setColorVaried(value)
int getGapWidth() / setGapWidth(value)
int getFirstSliceAngle() / setFirstSliceAngle(value)
int getOverlap() / setOverlap(value)
int getSecondPlotSize() / setSecondPlotSize(value)
int getSplitType() / setSplitType(value)
float getSplitValue() / setSplitValue(value)
boolean isAutoSplit()
int getBubbleScale() / setBubbleScale(value)
int getSizeRepresents() / setSizeRepresents(value)
boolean getShowNegativeBubbles() / setShowNegativeBubbles(value)
int getDoughnutHoleSize() / setDoughnutHoleSize(value)
int getExplosion() / setExplosion(value)
boolean hasRadarAxisLabels() / setHasRadarAxisLabels(value)
boolean hasLeaderLines() / setHasLeaderLines(value)
Line getLeaderLines()
LegendEntry getLegendEntry()
ShapePropertyCollection getShapeProperties()
int getBubbleSizeRepresents() / setBubbleSizeRepresents(value)