public class ChartHandle extends Object implements ChartConstants
WorkBookHandle| Modifier and Type | Class and Description |
|---|---|
static class |
ChartHandle.ChartOptions
Chart Options.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
AREA |
static int |
AREACHART |
static int |
BAR |
static int |
BARCHART |
static int |
BUBBLE |
static int |
BUBBLECHART |
static int |
COL |
static int |
COLCHART |
static int |
CONE |
static int |
CONEBAR |
static int |
CONEBARCHART |
static int |
CONECHART |
static int |
CYLINDER |
static int |
CYLINDERBAR |
static int |
CYLINDERBARCHART |
static int |
CYLINDERCHART |
static int |
DOUGHNUT |
static int |
DOUGHNUTCHART |
static int |
HEIGHT |
static int |
LINE |
static int |
LINECHART |
static int |
OFPIECHART |
static int |
PIE |
static int |
PIECHART |
static int |
PYRAMID |
static int |
PYRAMIDBAR |
static int |
PYRAMIDBARCHART |
static int |
PYRAMIDCHART |
static int |
RADAR |
static int |
RADARAREA |
static int |
RADARAREACHART |
static int |
RADARCHART |
static int |
SCATTER |
static int |
SCATTERCHART |
static int |
STOCKCHART |
static int |
SURFACE |
static int |
SURFACECHART |
protected WorkBookHandle |
wbh |
static int |
WIDTH |
static int |
X |
static int |
XAXIS |
static int |
XVALAXIS |
static int |
Y |
static int |
YAXIS |
static int |
ZAXIS |
SHAPECOLUMN, SHAPECONE, SHAPECONETOMAX, SHAPECYLINDER, SHAPEDEFAULT, SHAPEPYRAMID, SHAPEPYRAMIDTOMAX| Constructor and Description |
|---|
ChartHandle(Chart c,
WorkBookHandle wb)
Constructor which creates a new ChartHandle from an existing Chart Object
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAllSeries(String[] valueRanges,
String[] legendCells,
String[] bubbleSizeRanges,
String categoryRange)
updates (replaces) every Chart Series (bar, line or wedge on the Chart) with
the data from the array of values, legends, bubble sizes (optional) and
category range.
|
void |
addChartEmbed(String[] ce)
sets external information linked to or "embedded" in this OOXML chart; can be
a chart user shape, an image ...
|
ChartSeriesHandle |
addSeriesRange(CellHandle legendCell,
CellRange categoryRange,
CellRange seriesRange,
CellRange bubbleRange)
Adds a new Series to the chart via CellHandles and CellRange Objects.
|
ChartSeriesHandle |
addSeriesRange(CellHandle legendCell,
CellRange categoryRange,
CellRange seriesRange,
CellRange bubbleRange,
int nChart)
Adds a new Series to the chart via CellHandles and CellRange Objects.
|
ChartSeriesHandle |
addSeriesRange(String legendCell,
String categoryRange,
String seriesRange,
String bubbleRange)
Adds a new Series to the chart.
|
ChartSeriesHandle |
addSeriesRange(String legendCell,
String categoryRange,
String seriesRange,
String bubbleRange,
int nChart)
Adds a new Series to the chart.
|
void |
appendRowCategoryToChart()
Append a row of categories to the bottom of the chart.
|
void |
appendRowCategoryToChart(int nChart)
Append a row of categories to the bottom of the chart.
|
ChartSeriesHandle |
appendRowSeriesToChart()
Appends a series one row below the last series in the chart.
|
ChartSeriesHandle |
appendRowSeriesToChart(int nChart)
Appends a series one row below the last series in the chart for the desired
chart
|
boolean |
changeCategoryRange(String originalrange,
String newrange)
Change the Cell Range representing the Categories in the Chart.
|
boolean |
changeSeriesRange(String originalrange,
String newrange)
Change the Cell Range referenced by one of the Series (a bar, line or wedge
of data) in the Chart.
|
boolean |
changeTextValue(String originalval,
String newval)
Change the value of a Chart object.
|
static ChartHandle |
createNewChart(WorkSheetHandle sheet,
int chartType,
EnumSet<ChartHandle.ChartOptions> options)
Static method to create a new chart on WorkSheet sheet of type chartType with
chart Options options
After creating, you can set the chart title via ChartHandle.setTitle and Position via ChartHandle.setRelativeBounds (row/col-based) or ChartHandle.setCoords (pixel-based) as well as several other customizations possible |
ChartSeriesHandle[] |
getAllChartSeriesHandles()
Returns an array of ChartSeriesHandle Objects, one for each bar, line or
wedge of data.
|
ChartSeriesHandle[] |
getAllChartSeriesHandles(int nChart)
Returns an array of ChartSeriesHandle Objects for the desired chart, one for
each bar, line or wedge of data.
|
String |
getAllSeriesDataJSON()
returns a JSON representation of all Series Data (Legend, Categogies, Series
Values) for the chart
This is an internal method that is not useful to the end user. |
Axis |
getAxis(int type) |
boolean |
getAxisAutomaticScale()
Returns true if the Y Axis (Value axis) is set to automatic scale
|
boolean |
getAxisAutomaticScale(int axisType)
Returns true if the desired Value axis is set to automatic scale
|
Font |
getAxisFont()
return the Font associated with the Chart Axes
|
int |
getAxisMajorUnit()
Returns the major tick unit of the Y Axis (Value Axis)
|
int |
getAxisMajorUnit(int axisType)
Returns the major tick unit of the desired Value axis
|
double |
getAxisMaxScale()
Returns the maximum value of the Y Axis (Value Axis) scale
|
double |
getAxisMaxScale(int axisType)
Returns the maximum scale value of the desired Value axis
|
int |
getAxisMinorUnit()
Returns the minor tick unit of the Y Axis (Value Axis)
|
int |
getAxisMinorUnit(int axisType)
Returns the minor tick unit of the desired Value axis
|
double |
getAxisMinScale()
Returns the minimum value of the Y Axis (Value Axis) scale
|
double |
getAxisMinScale(int axisType)
Returns the minimum scale value of the the desired Value axis
|
int |
getAxisPlacement(int Axis)
Returns the Axis Label Placement or position as an int
|
short[] |
getBounds()
returns the coordinates or bounds (position, width and height) of this chart
in pixels
|
String[] |
getCategories()
Returns an ordered array of strings representing all the category ranges in
the chart.
|
byte[] |
getChartBytes()
Get the Chart's bytes
This is an internal method that is not useful to the end user.
|
String |
getChartDrawingOOXML(int id)
generates the OOXML specific for DrawingML, specifying offsets and
identifying the chart object.
|
ArrayList<?> |
getChartEmbeds()
returns the drawingml file name which defines the userShape (if any)
a userShape is a drawing or shape ontop of a chart associated with this chart |
String |
getChartFontRecsXML()
returns Chart-specific Font Records in XML form
|
String |
getChartFontsXML()
Return non-axis Chart font ids in XML form
|
ChartSeriesHandle |
getChartSeriesHandle(int idx)
Get the ChartSeriesHandle representing Chart Series Data (Series and
Categories) for the specified Series index
|
ChartSeriesHandle |
getChartSeriesHandle(String seriesRange)
Get the ChartSeriesHandle representing Chart Series Data (Series and
Categories) for the specified Series range
|
ChartSeriesHandle |
getChartSeriesHandleByName(String legend)
Get the ChartSeriesHandle representing Chart Series Data (Series and
Categories) for the Series specified by label (legend)
|
int |
getChartType()
Return an int corresponding to this ChartHandle's Chart Type for the default
chart
To see possible Chart Types, view the public static int's in ChartHandle. |
int |
getChartType(int nChart)
Return an int corresponding to this ChartHandle's Chart Type for the
specified chart
To see possible Chart Types, view the public static int's in ChartHandle. |
short |
getColOffset()
returns the offset within the column in pixels
|
short[] |
getCoords()
returns the coordinates (position, width and height) of this chart in Excel
size units
|
org.json.JSONObject |
getCurrentSeries()
retrieves current series and axis scale info in JSONObject form used upon
chart updating
This is an internal method that is not useful to the end user. |
String |
getDataRangeJSON()
returns the data range used by the chart
|
int[] |
getEncompassingDataRange() |
static int[] |
getEncompassingDataRange(org.json.JSONObject jsonDataRange)
returns the encompassing range for this chart, or null if the chart data is
too complex to represent
|
int |
getId()
returns the ordinal id associated with the underlying Chart Object
|
protected String |
getJavaScript()
returns the svg for javascript for highlight and restore
|
String |
getJSON()
returs the JSON representation of this chart, based upon
Dojo-charting-specifics
|
String |
getOOXML(int rId)
Generates OOXML (chartML) for this chart object.
|
int |
getPlotAreaBgColor()
return the background color of this chart's Plot Area as an int
|
String |
getPlotAreaBgColorStr() |
short[] |
getRelativeBounds()
get the bounds of the chart using coordinates relative to row/cols and their
offsets
|
byte[] |
getSerialBytes() |
String[] |
getSeries()
Returns an ordered array of strings representing all the series ranges in the
Chart.
|
org.json.JSONArray |
getSeriesJSON()
retrieves the saved Series JSON for comparisons
This is an internal method that is not useful to the end user. |
Boundsheet |
getSheet()
returns the underlhying Sheet Object this Chart is attached to
For Internal Use |
String |
getSVG()
TODO: Less Common Charts: STOCK RADAR SURFACE COLUMN- 3D, CONE, CYLINDER,
PYRAMID BAR- 3D, CONE, CYLINDER, PYRAMID 3D PIE 3D LINE 3D AREA
LINE CHART APPEARS THAT STARTS AND ENDS A BIT TOO EARLY ***************** Z
Axis
CHART OPTIONS: STACKED CLUSTERED
|
String |
getSVG(double scale)
/** Take current Chart object and return the SVG code necessary to define it,
scaled to the desired percentage e.g.
|
String |
getThreeDXML() |
String |
getTitle()
Returns the title of the Chart
|
Font |
getTitleFont()
returns the Font associated with the Chart Title
|
WorkBook |
getWorkBook() |
WorkBookHandle |
getWorkBookHandle() |
WorkSheetHandle |
getWorkSheetHandle() |
String |
getXAxisLabel()
returns the X axis Title
|
String |
getXML()
returns an XML representation of this chart
|
String |
getYAxisLabel()
returns the Y axis Title
|
String |
getZAxisLabel()
returns the Z axis Title, if any
|
boolean |
hasDataLegend()
returns true if Chart has a Data Legend Key showing
|
protected void |
inputJSONObject(org.json.JSONObject source,
org.json.JSONObject input)
utility to add a JSON object
This is an internal method that is not useful to the end user. |
boolean |
is100PercentStacked() |
boolean |
isClustered() |
boolean |
isStacked() |
boolean |
isThreeD() |
boolean |
isThreeD(int nChart) |
void |
make100PercentStacked(int nChart)
Deprecated.
|
void |
make100PercentStacked3D(int nChart)
Deprecated.
|
void |
make3D()
Deprecated.
use setChartType(chartType, 0, is3d, isStacked,
is100PercentStacked) instead
|
void |
make3D(int nChart)
Deprecated.
use setChartType(chartType, nChart, is3d, isStacked,
is100%Stacked) instead
|
void |
makeClustered3D(int nChart)
Deprecated.
|
void |
makeExploded()
Deprecated.
|
void |
makeExploded3D(int nChart)
Deprecated.
|
void |
makeStacked(int nChart)
Deprecated.
|
void |
makeStacked3D(int nChart)
makes this Chart Stacked with a 3D Effect
sets the group of options necessary to create a Stacked 3D chart For Chart Types: BAR, COL, AREA |
void |
parseOOXML(InputStream ii)
defines this chart object based on a Chart ML (OOXML) input Stream (root
element=c:chartSpace)
This is an internal method that is not useful to the end user. |
void |
parseXML(WorkSheetHandle sht,
org.xmlpull.v1.XmlPullParser xpp,
HashMap<?,?> maps)
given a XmlPullParser positioned at the chart element, parse all chart
elements to create desired chart
|
void |
removeAxis(int axisType)
removes the desired Axis from the Chart
|
void |
removeLegend() |
void |
removeSeries(int index)
remove the Series (bar, line or wedge) at the desired index
|
void |
removeSeries(int index,
int nChart)
remove the Series (bar, line or wedge) at the desired index
|
void |
resetFonts()
resets all fonts in the chart to the default font of the workbook
|
void |
setAxisAutomaticScale(boolean b)
Sets the automatic scale option on or off for the Y Axis (Value axis)
|
void |
setAxisAutomaticScale(int axisType,
boolean b)
Sets the automatic scale option on or off for the desired Value axis
|
void |
setAxisFont(Font f)
set the font for all axes on the Chart
|
void |
setAxisFont(String name,
int height,
boolean bold,
boolean italic,
boolean underline)
set the font for all axes on the chart
|
void |
setAxisMax(int MaxValue)
Sets the maximum value of the Y Axis (Value Axis) Scale
|
void |
setAxisMax(int axisType,
int MaxValue)
Sets the maximum scale value of the desired Value axis
|
void |
setAxisMin(int MinValue)
Sets the minimum value of the Y Axis (Value Axis) Scale
|
void |
setAxisMin(int axisType,
int MinValue)
Sets the minimum scale value of the desired Value axis
|
void |
setAxisOption(int axisType,
String op,
String val)
sets an option for this axis
|
void |
setAxisPlacement(int Axis,
int Placement)
Sets the Axis labels position or placement to the desired value (these match
Excel placement options)
|
void |
setAxisTitle(int axisType,
String ttl)
sets or removes the axis title
|
void |
setBounds(short[] bounds)
sets the coordinates or bounds (position, width and height) of this chart in
pixels
|
void |
setChartFont(String type,
String val)
Set non-axis chart font id for title, default, etc
For Internal Use Only |
void |
setChartOption(String op,
String val)
Method for setting Chart-Type-specific options in a generic fashion e.g.
|
void |
setChartType(int chartType)
Sets the Chart type to the specified basic type (no 3d, no stacked ...)
To see possible Chart Types, view the public static int's in ChartHandle. |
void |
setChartType(int chartType,
int nChart)
Sets the basic chart type (no 3d, stacked...) for multiple or overlay Charts.
|
void |
setChartType(int chartType,
int nChart,
EnumSet<ChartHandle.ChartOptions> options)
Sets the Chart type to the specified type (no 3d, no stacked ...)
To see possible Chart Types, view the public static int's in ChartHandle. |
void |
setCoords(short[] coords)
sets the coordinates (position, width and height) for this chart in Excel
size units
|
void |
setDataLabel(String type,
boolean bShowLegendKey) |
protected void |
setDimensionsRecord()
set the chart DIMENSIONS record based on the series ranges in the chart
APPEARS THAT for charts, the DIMENSIONS record merely notes the range of
values: 0, #points in series, 0, #series
|
void |
setEditMovement(String editMovement)
Specifies how to resize or move this Chart upon edit
This is an internal method that is not useful to the end user. |
void |
setMarkerFormat(int imf)
set the marker format style for this chart
one of: 0 = no marker 1 = square 2 = diamond 3 = triangle 4 = X 5 = star 6 = Dow-Jones 7 = standard deviation 8 = circle 9 = plus sign For Chart Types: LINE, SCATTER |
void |
setOOXMLName(String name)
set the Excel 7/OOXML-specific name for this chart
|
void |
setPlotAreaBgColor(int bg)
sets the Plot Area background color
|
void |
setRelativeBounds(short[] bounds)
sets the bounds of the chart using coordinates relative to row/cols and their
offsets
|
ChartSeriesHandle |
setSeries(int index,
String legendCell,
String categoryRange,
String seriesRange,
String bubbleRange)
Changes or adds a Series to the chart via Series Index.
|
ChartSeriesHandle |
setSeries(int index,
String legendCell,
String legendText,
String categoryRange,
String seriesRange,
String bubbleRange)
Changes or adds a Series to the chart via Series Index.
|
ChartSeriesHandle |
setSeries(int index,
String legendCell,
String legendText,
String categoryRange,
String seriesRange,
String bubbleRange,
int nChart)
Changes or adds a Series to the desired Chart (either default or overlay) via
Series Index.
|
void |
setSeriesJSON(org.json.JSONArray s)
sets the saved Series JSON
This is an internal method that is not useful to the end user. |
void |
setTitle(String title)
Sets the title of the Chart
|
void |
setTitleFont(Font f)
set the font for the Chart Title
|
void |
setTitleFont(String name,
int height,
boolean bold,
boolean italic,
boolean underline)
set the font for the chart title
|
void |
setXAxisLabel(String xTitle)
Sets the XAxisTitle
|
void |
setYAxisLabel(String yTitle)
Sets the Y axis Title
|
void |
setZAxisLabel(String zTitle)
set the Z AxisTitle
|
void |
showDataTable(boolean bShow)
shows or removes the Data Table for this chart
|
void |
showLegend(boolean bShow,
boolean vertical)
shows or hides the Chart legend key
|
String |
toString()
returns the string representation of this ChartHandle
|
void |
WriteMainChartRecs(String fName)
debugging utility remove when done
|
public static final int BARCHART
public static final int COLCHART
public static final int LINECHART
public static final int PIECHART
public static final int AREACHART
public static final int SCATTERCHART
public static final int RADARCHART
public static final int SURFACECHART
public static final int DOUGHNUTCHART
public static final int BUBBLECHART
public static final int OFPIECHART
public static final int PYRAMIDCHART
public static final int CYLINDERCHART
public static final int CONECHART
public static final int PYRAMIDBARCHART
public static final int CYLINDERBARCHART
public static final int CONEBARCHART
public static final int RADARAREACHART
public static final int STOCKCHART
public static final int BAR
public static final int COL
public static final int LINE
public static final int PIE
public static final int AREA
public static final int SCATTER
public static final int RADAR
public static final int SURFACE
public static final int DOUGHNUT
public static final int BUBBLE
public static final int RADARAREA
public static final int PYRAMID
public static final int CYLINDER
public static final int CONE
public static final int PYRAMIDBAR
public static final int CYLINDERBAR
public static final int CONEBAR
public static final int XAXIS
public static final int YAXIS
public static final int ZAXIS
public static final int XVALAXIS
public static final int X
public static final int Y
public static final int WIDTH
public static final int HEIGHT
protected WorkBookHandle wbh
public ChartHandle(Chart c, WorkBookHandle wb)
Chart - c - the source Chart objectWorkBookHandle - wb - the parent WorkBookHandlepublic String getTitle()
public void setTitle(String title)
String - title - Chart titlepublic String getDataRangeJSON()
public int[] getEncompassingDataRange()
public static int[] getEncompassingDataRange(org.json.JSONObject jsonDataRange)
jsonDataRange - public int getId()
WorkBookHandle.getChartByIdpublic String toString()
public String[] getSeries()
ChartHandle.getCategoriespublic String[] getCategories()
ChartHandle.getSeriespublic ChartSeriesHandle[] getAllChartSeriesHandles()
ChartSeriesHandlepublic ChartSeriesHandle[] getAllChartSeriesHandles(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)ChartSeriesHandlepublic ChartSeriesHandle getChartSeriesHandle(String seriesRange)
String - seriesRange - For example, "Sheet1!A12:A21"ChartSeriesHandlepublic ChartSeriesHandle getChartSeriesHandle(int idx)
int - idx - the index (0 based) of the seriesChartSeriesHandlepublic ChartSeriesHandle getChartSeriesHandleByName(String legend)
String - legend - label for the desired seriesChartSeriesHandlepublic void setAxisTitle(int axisType,
String ttl)
axisType - one of: XAXIS, YAXIS, ZAXISttl - String new title or null to removepublic String getYAxisLabel()
public void setYAxisLabel(String yTitle)
String - yTitle - new Y Axis titlepublic String getXAxisLabel()
public void setXAxisLabel(String xTitle)
String - xTitle - new X Axis titlepublic String getZAxisLabel()
public void setZAxisLabel(String zTitle)
String - zTitle - new Z Axis Titlepublic void setAxisAutomaticScale(int axisType,
boolean b)
The Value axis contains numbers rather than labels, and is normally the Y axis, but Scatter and Bubble charts may have a value axis on the X Axis as well
Automatic Scaling automatically sets the scale maximum, minimum and tick units upon data changes, and is the default setting for charts
int - axisType - one of ChartHandle.YAXIS, ChartHandle.XAXIS,
ChartHandle.ZAXISboolean - b - true if set Automatic scaling on, false otherwisesetAxisAutomaticScale(boolean b)public double getAxisMinScale(int axisType)
The Value axis contains numbers rather than labels, and is normally the Y axis, but Scatter and Bubble charts may have a value axis on the X Axis as well
int - axisType - one of ChartHandle.YAXIS, ChartHandle.XAXIS,
ChartHandle.ZAXISgetAxisMinScale()public double getAxisMaxScale(int axisType)
The Value axis contains numbers rather than labels, and is normally the Y axis, but Scatter and Bubble charts may have a value axis on the X Axis as well
int - axisType - one of ChartHandle.YAXIS, ChartHandle.XAXIS,
ChartHandle.ZAXISgetAxisMaxScale()public int getAxisMajorUnit(int axisType)
The Value axis contains numbers rather than labels, and is normally the Y axis, but Scatter and Bubble charts may have a value axis on the X Axis as well
int - axisType - one of ChartHandle.YAXIS, ChartHandle.XAXIS,
ChartHandle.ZAXISgetAxisMajorUnit()public int getAxisMinorUnit(int axisType)
The Value axis contains numbers rather than labels, and is normally the Y axis, but Scatter and Bubble charts may have a value axis on the X Axis as well
int - axisType - one of ChartHandle.YAXIS, ChartHandle.XAXIS,
ChartHandle.ZAXISgetAxisMinorUnit()public void setAxisMax(int axisType,
int MaxValue)
The Value axis contains numbers rather than labels, and is normally the Y axis, but Scatter and Bubble charts may have a value axis on the X Axis as well
Note: The default scale setting for charts is known as Automatic Scaling
When data changes, the chart automatically adjusts the scale as necessary
Setting the scale manually (either Minimum or Maximum Value) removes
Automatic Scaling
int - axisType - one of ChartHandle.YAXIS, ChartHandle.XAXIS,
ChartHandle.ZAXISint - MaxValue - desired maximum value of the desired axissetAxisMax(int MaxValue)public void setAxisMin(int axisType,
int MinValue)
The Value axis contains numbers rather than labels, and is normally the Y axis, but Scatter and Bubble charts may have a value axis on the X Axis as well
Note: The default setting for charts is known as Automatic Scaling
When data values change, the chart automatically adjusts the scale as
necessary
Setting the scale manually (either Minimum or Maximum Value) removes
Automatic Scaling
int - axisType - one of ChartHandle.YAXIS, ChartHandle.XAXIS,
ChartHandle.ZAXISint - MinValue - the desired Minimum scale valuesetAxisMin(int MinValue)public boolean getAxisAutomaticScale(int axisType)
The Value axis contains numbers rather than labels, and is normally the Y axis, but Scatter and Bubble charts may have a value axis on the X Axis as well
Note: The default setting for charts is known as Automatic Scaling
When data changes, the chart automatically adjusts the scale as necessary
Setting the scale manually (either Minimum or Maximum Value) removes
Automatic Scaling
int - axisType - one of ChartHandle.YAXIS, ChartHandle.XAXIS,
ChartHandle.ZAXISgetAxisAutomaticScale()public boolean getAxisAutomaticScale()
The default setting for charts is known as Automatic Scaling
When data changes, the chart automatically adjusts the scale (minimum,
maximum values plus major and minor tick units) as necessary
getAxisAutomaticScale(int axisType)public void setAxisAutomaticScale(boolean b)
Automatic Scaling will automatically set the scale maximum, minimum and tick units upon data changes, and is the default chart setting
b - setAxisAutomaticScale(int axisType boolean b)public double getAxisMinScale()
getAxisMinScale(int axisType)public double getAxisMaxScale()
getAxisMaxScale(int axisType)public int getAxisMajorUnit()
getAxisMajorUnit(int axisType)public int getAxisMinorUnit()
getAxisMinorUnit(int axisType)public void setAxisMax(int MaxValue)
Note: The default scale setting for charts is known as Automatic Scaling
When data changes, the chart automatically adjusts the scale as necessary
Setting the scale manually (either Minimum or Maximum Value) removes
Automatic Scaling
int - MaxValue - the desired maximum scale valueChartHandle.setAxisMax(int axisType, int MaxValue)public void setAxisMin(int MinValue)
Note: The default setting for charts is known as Automatic Scaling
When data changes, the chart automatically adjusts the scale as necessary
Setting the scale manually (either Minimum or Maximum Value) removes
Automatic Scaling
int - MinValue - the desired minimum scale valueChartHandle.setAxisMin(int axisType, int MinValue)public void setAxisOption(int axisType,
String op,
String val)
axisType - one of: XAXIS, YAXIS, ZAXISop - option name; one of: CatCross, LabelCross, Marks, CrossBetween,
CrossMax, MajorGridLines, AddArea, AreaFg, AreaBg or Linked Text
Display options: Label, ShowKey, ShowValue, ShowLabelPct, ShowPct,
ShowCatLabel, ShowBubbleSizes, TextRotation, Fontval - option valuepublic void setTitleFont(String name, int height, boolean bold, boolean italic, boolean underline)
String - name - font nameint - height - font height in 1/20 point unitsboolean - bold - true if boldboolean - italic - true if italicboolean - underline - true if underlinedpublic void setTitleFont(Font f)
io.starter.Formats.XLS.Font - f - desired font for the Chart TitleFontpublic Font getTitleFont()
Fontpublic void setAxisFont(String name, int height, boolean bold, boolean italic, boolean underline)
String - name - font nameint - height - font height in 1/20 point unitsboolean - bold - true if boldboolean - italic - true if italicboolean - underline - true if underlinedpublic void setAxisFont(Font f)
io.starter.Formats.XLS.Font - f - desired font for the Chart axesFontpublic Font getAxisFont()
Fontpublic void resetFonts()
public Boundsheet getSheet()
public int getPlotAreaBgColor()
constantspublic String getPlotAreaBgColorStr()
public void setPlotAreaBgColor(int bg)
int - bg - color constantconstantspublic boolean changeTextValue(String originalval, String newval)
String - originalval - One of: "Template Chart Title", "Category X" or
"Value Y"Sring - newval - the new settingpublic void setChartType(int chartType)
int - chartType - representing the chart typepublic static ChartHandle createNewChart(WorkSheetHandle sheet, int chartType, EnumSet<ChartHandle.ChartOptions> options)
book - WorkBookHandlesheet - WorkSheetHandlechartType - one of: options - EnumSetChartHandle.ChartOptions,
setChartTypepublic void setChartType(int chartType,
int nChart,
EnumSet<ChartHandle.ChartOptions> options)
int - chartType - representing the chart typenChart - - 0 (default) or 1-9 for complex overlay chartsEnumSet - 0 or more chart options (Such as Stacked, Exploded ...)ChartHandle.ChartOptionspublic void setChartType(int chartType,
int nChart)
int - chartType - representing the chart typechartType - nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)public int getChartType()
static Chart Type Constants,
ChartHandle.setChartTypepublic int getChartType(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)static Chart Type Constants,
ChartHandle.setChartTypepublic boolean changeSeriesRange(String originalrange, String newrange)
String - originalrange - the original Series (bar, line or wedge of data)
to alterString - newrange -the new data rangepublic boolean changeCategoryRange(String originalrange, String newrange)
String - originalrange - Original Category RangeString - newrange - New Category Rangepublic ChartSeriesHandle setSeries(int index, String legendCell, String categoryRange, String seriesRange, String bubbleRange) throws CellNotFoundException
int - index - the series index. If greater than the number of series
already present in the chart, the series will be added to the endString - legendCell - String representation of Legend Cell AddressString - categoryRange - String representation of Category Range (should be
same for all series)String - seriesRange - String representation of the Series Data Range for
this seriesString - bubbleRange - String representation of Bubble Range (representing
bubble sizes), if bubble chart. null if notCellNotFoundExceptionpublic ChartSeriesHandle setSeries(int index, String legendCell, String legendText, String categoryRange, String seriesRange, String bubbleRange) throws CellNotFoundException
int - index - the series index. If greater than the number of series
already present in the chart, the series will be added to the endString - legendCell - String representation of Legend Cell AddressString - legendText - String Legend textString - categoryRange - String representation of Category Range (should be
same for all series)String - seriesRange - String representation of the Series Data Range for
this seriesString - bubbleRange - String representation of Bubble Range (representing
bubble sizes), if bubble chart. null if notCellNotFoundExceptionpublic ChartSeriesHandle setSeries(int index, String legendCell, String legendText, String categoryRange, String seriesRange, String bubbleRange, int nChart) throws CellNotFoundException
int - index - the series index. If greater than the number of series
already present in the chart, the series will be added to the endString - legendCell - String representation of Legend Cell AddressString - legendText - String Legend textString - categoryRange - String representation of Category Range (should be
same for all series)String - seriesRange - String representation of the Series Data Range for
this seriesString - bubbleRange - String representation of Bubble Range (representing
bubble sizes), if bubble chart. null if notnChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)CellNotFoundExceptionpublic ChartSeriesHandle addSeriesRange(String legendCell, String categoryRange, String seriesRange, String bubbleRange) throws CellNotFoundException
ChartHandle.addSeriesRange("Sheet1!A3", "Sheet1!B1:E1", "Sheet1:B3:E3",
null);
ChartHandle.addSeriesRange("Sheet1!A4", "Sheet1!B1:E1", "Sheet1:B4:E4",
null);
ChartHandle.addSeriesRange("Sheet1!A5", "Sheet1!B1:E1", "Sheet1:B5:E5",
null);
etc...
Note that the category does not change, it is usually constant through
series.
Also note that the example above is for a non-bubble-type chart.
String - legendCell - Cell reference for the legend cell (e.g. Sheet1!A1)String - categoryRange - Category Cell range (e.g. Sheet1!B1:B1);String - seriesRange - Series Data range (e.g. Sheet1!B3:E3);String - bubbleRange - Cell Range representing Bubble sizes (e.g.
Sheet1!A2:A5); or null if chart is not of type Bubble.CellNotFoundExceptionpublic ChartSeriesHandle addSeriesRange(String legendCell, String categoryRange, String seriesRange, String bubbleRange, int nChart) throws CellNotFoundException
ChartHandle.addSeriesRange("Sheet1!A3", "Sheet1!B1:E1", "Sheet1:B3:E3",
null);
ChartHandle.addSeriesRange("Sheet1!A4", "Sheet1!B1:E1", "Sheet1:B4:E4",
null);
ChartHandle.addSeriesRange("Sheet1!A5", "Sheet1!B1:E1", "Sheet1:B5:E5",
null);
etc...
Note that the category does not change, it is usually constant through
series.
Also note that the example above is for a non-bubble-type chart.
String - legendCell - Cell reference for the legend cell (e.g. Sheet1!A1)String - categoryRange - Category Cell range (e.g. Sheet1!B1:B1);String - seriesRange - Series Data range (e.g. Sheet1!B3:E3);String - bubbleRange - Cell Range representing Bubble sizes (e.g.
Sheet1!A2:A5); or null if chart is not of type Bubble.nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)CellNotFoundExceptionpublic ChartSeriesHandle addSeriesRange(CellHandle legendCell, CellRange categoryRange, CellRange seriesRange, CellRange bubbleRange)
CellHandle - legendCell - references the legend cell for this seriesCellRange - categoryRange - The CellRange referencing the category (should be
the same for all Series)CelLRange - seriesRange - The CellRange referencing the data points for one
bar, line or wedge in the chartCellRange - bubbleRange -The CellRange referencing bubble sizes for this
series, or null if chart is not of type BUBBLEChartHandle.addSeriesRange(String legendCell, String categoryRange,
String seriesRange, String bubbleRange)public ChartSeriesHandle addSeriesRange(CellHandle legendCell, CellRange categoryRange, CellRange seriesRange, CellRange bubbleRange, int nChart)
CellHandle - legendCell - references the legend cell for this seriesCellRange - categoryRange - The CellRange referencing the category (should be
the same for all Series)CelLRange - seriesRange - The CellRange referencing the data points for one
bar, line or wedge in the chartCellRange - bubbleRange -The CellRange referencing bubble sizes for this
series, or null if chart is not of type BUBBLEnChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)ChartHandle.addSeriesRange(String legendCell, String categoryRange,
String seriesRange, String bubbleRange)public void removeSeries(int index)
int - index - series index (valid values: 0 to
getAllChartSeriesHandles().length-1)getAllChartSeriesHandlespublic void removeSeries(int index,
int nChart)
int - index - series index (valid values: 0 to
getAllChartSeriesHandles().length-1)nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)getAllChartSeriesHandlespublic void addAllSeries(String[] valueRanges, String[] legendCells, String[] bubbleSizeRanges, String categoryRange)
NOTE: String arrays come in reverse order from plugins, so this method adds series LIFO i.e. reversed
String[] - valueRanges - Array of Cell Ranges representing the Values or Data
points for each series (bar, line or wedge) on the ChartString[] - legendCells - Array of Cell Addresses representing the legends for
each SeriesString[] - bubbleSizeRanges - Array of Cell ranges representing the bubble
sizes for the Chart, or null if chart is not of type BUBBLEString - categoryRange - The Cell Range representing the categories (X
Axis) for the entire Chartpublic ChartSeriesHandle appendRowSeriesToChart()
This can be utilized when programmatically adding rows of data that should be
reflected in the chart.
Legend cell will be incremented by one row if a reference. Category range
will stay the same.
In order for this method to work properly the chart must have row-based
series. If your chart utilizes column-based series, then you need to append a
category.
ChartHandle.appendRowCategoryToChartpublic ChartSeriesHandle appendRowSeriesToChart(int nChart)
This can be utilized when programmatically adding rows of data that should be
reflected in the chart.
Legend cell will be incremented by one row if a reference. Category range
will stay the same.
In order for this method to work properly the chart must have row-based
series. If your chart utilizes column-based series, then you need to append a
category.
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)ChartHandle.appendRowCategoryToChartpublic void appendRowCategoryToChart()
ChartHandle.appendRowSeriesToChartpublic void appendRowCategoryToChart(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)ChartHandle.appendRowSeriesToChartpublic byte[] getChartBytes()
public byte[] getSerialBytes()
public void parseXML(WorkSheetHandle sht, org.xmlpull.v1.XmlPullParser xpp, HashMap<?,?> maps)
sht - WorkSheetHandlexpp - XmlPullParserpublic String getXML()
public String getOOXML(int rId)
int - rId -reference ID for this chartpublic String getChartDrawingOOXML(int id)
int - id - the reference id for this chartpublic void parseOOXML(InputStream ii)
inputStream - ii - representing chart OOXMLpublic void setEditMovement(String editMovement)
editMovement - String OOXML-specific edit movement settingpublic void setOOXMLName(String name)
String - namepublic ArrayList<?> getChartEmbeds()
public void addChartEmbed(String[] ce)
String[] - embedType, filename e.g. {"userShape", "userShape file name"}protected void setDimensionsRecord()
public void setChartOption(String op, String val)
Note: since most Chart Type Options are interdependent, there are several makeXX methods that set the desired group of options e.g. makeStacked(); use setChartOption with care
Note that not all Chart Types will have every option available
Possible Options:
"Stacked" - true or false - set Chart Series to be Stacked
"Cluster" - true or false - set Clustered for Column and Bar Chart Types
"PercentageDisplay" - true or false - Each Category is broken down as a
percentge
"Percentage" - Distance of pie slice from center of pie as % for Pie Charts
(0 for all others)
"donutSize" - Donut size for Donut Charts Only
"Overlap" - Space between bars (default= 0%)
"Gap" - Space between categories (%) (default=50%)
"SmoothedLine" - true or false - the Line series has a smoothed line
"AnRot" - Rotation Angle (0 to 360 degrees), usually 0 for pie, 20 for others
(3D option)
"AnElev" - Elevation Angle (-90 to 90 degrees) (15 is default) (3D option)
"ThreeDScaling" - true or false - 3d effect
"TwoDWalls" - true if 2D walls (3D option)
"PcDist" - Distance from eye to chart (0 to 100) (30 is default) (3D option)
"ThreeDBubbles" - true or false - Draw bubbles with a 3d effect
"ShowLdrLines" - true or false - Show Pie and Donut charts Leader Lines
"MarkerFormat" - "0" thru "9" for various marker options @see
ChartHandle.setMarkerFormat
"ShowLabel" - true or false - show Series/Data Label
"ShowCatLabel" - true or false - show Category Label
"ShowLabelPct" - true or false - show percentage labels for Pie charts
"ShowBubbleSizes" - true or false - show bubble sizes for Bubble charts
NOTE: all values must be in String form
ChartHandle.getXMLpublic boolean isThreeD(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)public boolean isThreeD()
public boolean isStacked()
public boolean is100PercentStacked()
public boolean isClustered()
public String getThreeDXML()
public int getAxisPlacement(int Axis)
One of:
Axis.INVISIBLE - axis is hidden
Axis.LOW - low end of plot area
Axis.HIGH - high end of plot area
Axis.NEXTTO- next to axis (default)
int - Axis - one of the Axis constants (XAXIS, YAXIS or ZAXIS)public void setAxisPlacement(int Axis,
int Placement)
Possible options:
Axis.INVISIBLE - hides the axis
Axis.LOW - low end of plot area
Axis.HIGH - high end of plot area
Axis.NEXTTO- next to axis (default)
int - Axis - one of the Axis constants (XAXIS, YAXIS or ZAXIS)Placement - - int one of the Axis placement constants listed abovepublic void removeAxis(int axisType)
int - axisType - one of the Axis constants (XAXIS, YAXIS or ZAXIS)public String getChartFontRecsXML()
public String getChartFontsXML()
public void setChartFont(String type, String val)
String - type - font typeString - val - font idpublic WorkBook getWorkBook()
public WorkBookHandle getWorkBookHandle()
public WorkSheetHandle getWorkSheetHandle()
public void setBounds(short[] bounds)
short[4] - bounds - left or x value, top or y value, width, heightChartHandle.X, ChartHandle.Y, ChartHandle.WIDTH, ChartHandle.HEIGHTpublic short[] getBounds()
ChartHandle.X, ChartHandle.Y, ChartHandle.WIDTH, ChartHandle.HEIGHTpublic void setCoords(short[] coords)
ChartHandle.X, ChartHandle.Y, ChartHandle.WIDTH, ChartHandle.HEIGHTpublic short[] getCoords()
ChartHandle.X, ChartHandle.Y, ChartHandle.WIDTH, ChartHandle.HEIGHTpublic short[] getRelativeBounds()
public short getColOffset()
public void setRelativeBounds(short[] bounds)
short[8] - bounds - COL, COLOFFSET, ROW, ROWOFFST, COL1, COLOFFSET1, ROW1,
ROWOFFSET1public void setDataLabel(String type, boolean bShowLegendKey)
public void showDataTable(boolean bShow)
boolean - bShow - true if show data tablepublic void showLegend(boolean bShow,
boolean vertical)
booean - bShow - true if show legend, false to hideboolean - vertical - true if show vertically, false for horizontalpublic boolean hasDataLegend()
public void removeLegend()
@Deprecated public void makeStacked(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)@Deprecated public void make100PercentStacked(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)public void makeStacked3D(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)@Deprecated public void make100PercentStacked3D(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)@Deprecated public void make3D()
@Deprecated public void make3D(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)@Deprecated public void makeClustered3D(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)@Deprecated public void makeExploded()
@Deprecated public void makeExploded3D(int nChart)
nChart - number and drawing order of the desired chart (default= 0 max=9
where 1-9 indicate an overlay chart)public void setMarkerFormat(int imf)
int - imf - marker format constant from list abovepublic String getJSON()
protected void inputJSONObject(org.json.JSONObject source,
org.json.JSONObject input)
source - input - public org.json.JSONArray getSeriesJSON()
public void setSeriesJSON(org.json.JSONArray s)
throws org.json.JSONException
JSONArray - s -org.json.JSONExceptionpublic org.json.JSONObject getCurrentSeries()
public String getAllSeriesDataJSON()
public String getSVG()
public String getSVG(double scale)
scale - double scale factorprotected String getJavaScript()
public void WriteMainChartRecs(String fName)
public Axis getAxis(int type)
Copyright © 2002–2019 Starter Inc.. All rights reserved.