Example:
# Instantiating a Workbook object workbook = Workbook() # Obtaining the reference of the first worksheet worksheet = workbook.getWorksheets().get(0) # 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(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 chart to the worksheet chartIndex = worksheet.getCharts().add(ChartType.PIE_EXPLODED, 5, 0, 25, 10) # 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) # Show Data Labels chart.getNSeries().get(0).getDataLabels().setShowValue(True) for i in range(0, chart.getNSeries().get(0).getPoints().getCount()): # Get Data Point point = chart.getNSeries().get(0).getPoints().get(i) # Set Pir Explosion point.setExplosion(15) # Set Border Color point.getBorder().setColor(Color.getRed()) # Saving the Excel file workbook.save("Book1.xls")
Property Getters/Setters Summary | ||
---|---|---|
method | getArcEndPointXPx() | |
Gets the x coordinate of ending point for the pie section after calls Chart.Calculate() method.
Applies to Pie and Doughnut chart.
|
||
method | getArcEndPointYPx() | |
Gets the y coordinate of ending point for the pie section after calls Chart.Calculate() method.
Applies to Pie and Doughnut chart.
|
||
method | getArcStartPointXPx() | |
Gets the x coordinate of starting point for the pie section after calls Chart.Calculate() method.
Applies to Pie and Doughnut chart.
|
||
method | getArcStartPointYPx() | |
Gets the y coordinate of starting point for the pie section after calls Chart.Calculate() method.
Applies to Pie and Doughnut chart.
|
||
method | getArea() | |
Gets the |
||
method | getBorder() | |
Gets the |
||
method | getBorderWidthPx() | |
Gets the width of border in units of pixels after calls Chart.Calculate() method.
|
||
method | getDataLabels() | |
Returns a |
||
method | getEndAngle() | |
Gets the ending angle for the pie section, measured in degrees clockwise from the x-axis after calls Chart.Calculate() method.
Applies to Pie chart.
|
||
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 | getInnerArcEndPointXPx() | |
Gets the x coordinate of ending point for the pie section after calls Chart.Calculate() method.
Applies to Doughnut chart.
|
||
method | getInnerArcEndPointYPx() | |
Gets the y coordinate of ending point for the pie section after calls Chart.Calculate() method.
Applies to Doughnut chart.
|
||
method | getInnerArcStartPointXPx() | |
Gets the x coordinate of starting point for the pie section after calls Chart.Calculate() method.
Applies to Doughnut chart.
|
||
method | getInnerArcStartPointYPx() | |
Gets the y coordinate of starting point for the pie section after calls Chart.Calculate() method.
Applies to Doughnut chart.
|
||
method | getInnerRadiusPx() | |
Gets the inner radius of doughnut slice in units of pixels after calls Chart.Calculate() method.
Applies to Doughnut chart.
|
||
method | isInSecondaryPlot() | |
method | setInSecondaryPlot(value) | |
Gets or sets a value indicates whether this data points is in the second pie or bar on a pie of pie or bar of pie chart | ||
method | getMarker() | |
Gets the |
||
method | getRadiusPx() | |
Gets the radius of bubble, pie or doughnut in units of pixels after calls Chart.Calculate() method.
|
||
method | getShadow() | |
method | setShadow(value) | |
True if the chartpoint has a shadow. | ||
method | getShapeHeight() | |
Gets the height in units of 1/4000 of chart's height after calls Chart.Calculate() method.
|
||
method | getShapeHeightPx() | |
Gets the height in units of pixels after calls Chart.Calculate() method.
|
||
method | getShapeProperties() | |
Gets the |
||
method | getShapeWidth() | |
Gets the width in units of 1/4000 of chart's width after calls Chart.Calculate() method.
|
||
method | getShapeWidthPx() | |
Gets the width in units of pixels after calls Chart.Calculate() method.
|
||
method | getShapeX() | |
Gets the x coordinate of the upper left corner in units of 1/4000 of chart's width after calls Chart.Calculate() method.
|
||
method | getShapeXPx() | |
Gets the x coordinate of the upper left corner in units of pixels after calls Chart.Calculate() method.
|
||
method | getShapeY() | |
Gets the y coordinate of the upper left corner in units of 1/4000 of chart's height after calls Chart.Calculate() method.
|
||
method | getShapeYPx() | |
Gets the y coordinate of the upper left corner in units of pixels after calls Chart.Calculate() method.
|
||
method | getStartAngle() | |
Gets the starting angle for the pie section, measured in degrees clockwise from the x-axis after calls Chart.Calculate() method.
Applies to Pie chart.
|
||
method | getXValue() | |
method | setXValue(value) | |
Gets or sets the X value of the chart point. | ||
method | getXValueType() | |
Gets X value type of the chart point.
The value of the property is CellValueType integer constant. |
||
method | getYValue() | |
method | setYValue(value) | |
Gets or sets the Y value of the chart point. | ||
method | getYValueType() | |
Gets Y value type of the chart point.
The value of the property is CellValueType integer constant. |
Method Summary | ||
---|---|---|
method | getBottomPointCount() | |
Gets the number of bottom points after calls Chart.Calculate() method.
|
||
method | getBottomPointXPx(index) | |
Gets x-coordinate of the bottom point of shape after calls Chart.Calculate() method.
Applies 3D charts: Column3D, Bar3D, Cone, Cylinder, Pyramid
|
||
method | getBottomPointYPx(index) | |
Gets y-coordinate of the bottom point of shape after calls Chart.Calculate() method.
Applies 3D charts: Column3D, Bar3D, Cone, Cylinder, Pyramid
|
||
method | getOnCategoryAxisPointCount() | |
Gets the number of the points on category axis after calls Chart.Calculate() method. Only applies to area chart.
|
||
method | getOnCategoryAxisPointXPx(index) | |
Gets x-coordinate of the point on category axis after calls Chart.Calculate() method. Only applies to Area chart.
|
||
method | getOnCategoryAxisPointYPx(index) | |
Gets y-coordinate of the point on category axis after calls Chart.Calculate() method. Only applies to Area chart.
|
||
method | getTopPointCount() | |
Gets the number of top points after calls Chart.Calculate() method.
|
||
method | getTopPointXPx(index) | |
Gets x-coordinate of the top point of shape after calls Chart.Calculate() method.
Applies 3D charts: Column3D, Bar3D, Cone, Cylinder, Pyramid and Area3D
|
||
method | getTopPointYPx(index) | |
Gets y-coordinate of the top point of shape after calls Chart.Calculate() method.
Applies 3D charts: Column3D, Bar3D, Cone, Cylinder, Pyramid and Area3D
|
int getExplosion() / setExplosion(value)
boolean getShadow() / setShadow(value)
DataLabels getDataLabels()
Object getYValue() / setYValue(value)
int getYValueType()
Object getXValue() / setXValue(value)
int getXValueType()
ShapePropertyCollection getShapeProperties()
boolean isInSecondaryPlot() / setInSecondaryPlot(value)
int getShapeX()
int getShapeY()
int getShapeWidth()
int getShapeHeight()
int getShapeXPx()
int getShapeYPx()
int getShapeWidthPx()
int getShapeHeightPx()
int getBorderWidthPx()
int getRadiusPx()
int getInnerRadiusPx()
float getStartAngle()
float getEndAngle()
float getArcStartPointXPx()
float getArcStartPointYPx()
float getArcEndPointXPx()
float getArcEndPointYPx()
float getInnerArcStartPointXPx()
float getInnerArcStartPointYPx()
float getInnerArcEndPointXPx()
float getInnerArcEndPointYPx()
int getTopPointCount()
float getTopPointXPx(index)
float getTopPointYPx(index)
int getBottomPointCount()
float getBottomPointXPx(index)
float getBottomPointYPx(index)
int getOnCategoryAxisPointCount()
float getOnCategoryAxisPointXPx(index)
float getOnCategoryAxisPointYPx(index)