public abstract class ChartType extends Object implements ChartConstants, Serializable
| Modifier and Type | Field and Description |
|---|---|
protected ChartFormat |
cf |
protected GenericChartObject |
chartobj |
protected int |
defaultShape |
protected Legend |
legend |
protected WorkBook |
wb |
AREACHART, BARCHART, BUBBLECHART, COLCHART, CONEBARCHART, CONECHART, CYLINDERBARCHART, CYLINDERCHART, DOUGHNUTCHART, LINECHART, OFPIECHART, PIECHART, PYRAMIDBARCHART, PYRAMIDCHART, RADARAREACHART, RADARCHART, SCATTERCHART, SHAPECOLUMN, SHAPECONE, SHAPECONETOMAX, SHAPECYLINDER, SHAPEDEFAULT, SHAPEPYRAMID, SHAPEPYRAMIDTOMAX, STOCKCHART, SURFACECHART, XAXIS, XVALAXIS, YAXIS, ZAXIS| Constructor and Description |
|---|
ChartType() |
ChartType(GenericChartObject charttype,
ChartFormat cf,
WorkBook wb) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLegend() |
void |
addLegend(Legend l) |
int |
convertShape(String shape)
Convert the user-friendly OOXML shape string to 2003-v int shape flag
|
static ChartType |
create(int chartType,
Chart parentChart,
ChartFormat cf)
creates a new chart type object of the desired chart type.
|
static ChartType |
createChartTypeObject(GenericChartObject ch,
ChartFormat cf,
WorkBook wb)
create and return the appropriate ChartType for the given
chart record (Bar, Radar, Line, etc)
|
static GenericChartObject |
createUnderlyingChartObject(int chartType,
Chart parentchart,
ChartFormat cf)
create a new low-level chart object which determines the ChartTypeObject, and update the existing chartobj
|
int |
getBarShape()
returns the bar shape for a column or bar type chart
can be one of:
ChartConstants.SHAPECOLUMN default ChartConstants.SHAPECONEd ChartConstants.SHAPECONETOMAX ChartConstants.SHAPECYLINDER ChartConstants.SHAPEPYRAMID ChartConstants.SHAPEPYRAMIDTOMAX |
String |
getChartOption(String op)
look up a generic chart option
|
String |
getChartOptionsXML()
return chart-type-specific options in XML form
|
int |
getChartType()
returns the chart type for the default chart
|
static String |
getDarkColor() |
protected int |
getDataLabel()
return the default data label setting for the chart, if any
NOTE: each series can override the default data label for the chart can be one or more of: VALUELABEL= 0x1; VALUEPERCENT= 0x2; CATEGORYPERCENT= 0x4; SMOOTHEDLINE= 0x8; CATEGORYLABEL= 0x10; BUBBLELABEL= 0x20; SERIESLABEL= 0x40; |
static String |
getDataLabelFontSVG()
Returns SVG used to define font for data labels
TODO: read correct value from chart recs
|
protected int[] |
getDataLabelInts()
return data label options for each series as an int array
each can be one or more of: VALUELABEL= 0x1; VALUEPERCENT= 0x2; CATEGORYPERCENT= 0x4; SMOOTHEDLINE= 0x8; CATEGORYLABEL= 0x10; BUBBLELABEL= 0x20; SERIESLABEL= 0x40; |
String |
getDataLabels()
return the Data Labels chosen for this chart, if any
can be one or more of:
Value ValuePerecentage CategoryPercentage CategoryLabel BubbleLabel SeriesLabel or an empty string if no data labels are chosen for the chart |
int |
getDataLabelsInt()
return data label options as an int
can be one or more of: VALUELABEL= 0x1; VALUEPERCENT= 0x2; CATEGORYPERCENT= 0x4; SMOOTHEDLINE= 0x8; CATEGORYLABEL= 0x10; BUBBLELABEL= 0x20; SERIESLABEL= 0x40; |
Legend |
getDataLegend()
return the data legend for this chart
|
static String |
getFillOpacity() |
protected String |
getFontSVG()
returns the SVG for the font style of this object
|
protected String |
getFontSVG(int sz)
returns the SVG for the font style of this object
|
int |
getGapDepth()
returns an int representing the space between points in a 3d area, bar or line chart, or 0 if not 3d
|
boolean |
getHasDropLines()
returns true if this chart has drop lines
|
boolean |
getHasLines()
returns true if this chart has lines (see Scatter, Line Charts amongst others)
|
boolean |
getHasSmoothLines()
returns true if this chart has smoothed lines
|
String |
getJSON() |
org.json.JSONObject |
getJSON(ChartSeries s,
WorkBookHandle wbh,
Double[] minMax) |
static String |
getLightColor() |
int |
getMarkerFormat()
returns type of marker for this chart, if any
0 = no marker 1 = square 2 = diamond 3 = triangle 4 = X 5 = star 6 = Dow-Jones 7 = standard deviation 8 = circle 9 = plus sign |
protected int[] |
getMarkerFormats()
return an array of the type of markers for each series:
0 = no marker 1 = square 2 = diamond 3 = triangle 4 = X 5 = star 6 = Dow-Jones 7 = standard deviation 8 = circle 9 = plus sign |
static String |
getMediumColor() |
StringBuffer |
getOOXML(String catAxisId,
String valAxisId,
String serAxisId)
gets the chart-type specific OOXML representation (representing child element of plotArea element)
|
org.json.JSONObject |
getOptionsJSON() |
Chart |
getParentChart() |
static String |
getScript(String range) |
protected SeriesList |
getSeriesList()
return the SeriesList record for this chart object
The SeriesList record maps the series for the chart.
|
String |
getShape()
convert the default shape flag to a user-friendly (OOXML-compliant) String
|
static String |
getStrokeSVG()
returns the SVG for the font style of this object
|
static String |
getStrokeSVG(float sz,
String strokeclr)
returns the SVG for the font style of this object
|
String |
getSVG() |
String |
getSVG(HashMap<String,Double> chartMetrics,
HashMap<String,Object> axisMetrics,
ChartSeries s)
returns SVG to represent the actual chart object (BAR, LINE, AREA, etc.)
|
String |
getSVGDataLabels(int[] datalabels,
HashMap<String,Object> axisMetrics,
double val,
double percentage,
int s,
String[] legends,
String cat)
returns the SVG-ready data label for the given set of data label options
TODO: get separator character
|
static String |
getTextColor() |
ThreeD |
getThreeDRec(boolean bCreate)
return the 3d record of the chart
Creates if not present, if bCreate is true |
String |
getThreeDXML()
return ThreeD settings for this chart in XML form
|
org.json.JSONObject |
getTypeJSON()
return Type JSON for generic chart types
|
boolean |
hasDataLegend()
return truth if Chart has a data legend key showing
|
ThreeD |
initThreeD(int charttype)
returns the 3d record of the desired chart
|
boolean |
is100PercentStacked()
return truth of "Chart is 100% Stacked"
|
boolean |
isClustered() |
boolean |
isStacked() |
boolean |
isThreeD() |
static ChartType |
parseOOXML(org.xmlpull.v1.XmlPullParser xpp,
WorkBookHandle wbh,
Chart parentChart,
int nChart)
parse the chart object OOXML element (barchart, area3DChart, etc.) and create the corresponding chart type objects
|
boolean |
setChartOption(String op,
String val)
interface for setting chart-type-specific options
in a generic fashion
|
void |
setHasDropLines()
sets this chart (Area, Line, Scatter) to have drop lines
|
void |
setHasSmoothLines(boolean b) |
void |
setIs100Psercent(boolean ispercentage) |
void |
setIsStacked(boolean isstacked) |
void |
setOptions(EnumSet<ChartHandle.ChartOptions> options) |
protected void |
setVaryColor(boolean b)
specifies whether
the color for each data point and the color and type for each data marker
vary
|
void |
showLegend(boolean bShow,
boolean vertical)
show or hide chart legend key
|
void |
WriteMainChartRecs(String fName) |
protected GenericChartObject chartobj
protected Legend legend
protected ChartFormat cf
protected transient WorkBook wb
protected int defaultShape
public ChartType()
public ChartType(GenericChartObject charttype, ChartFormat cf, WorkBook wb)
public Chart getParentChart()
public static ChartType create(int chartType, Chart parentChart, ChartFormat cf)
chartType - parentChart - cf - public static ChartType createChartTypeObject(GenericChartObject ch, ChartFormat cf, WorkBook wb)
ch - GenericChartObject representing the Chart Type
public static GenericChartObject createUnderlyingChartObject(int chartType, Chart parentchart, ChartFormat cf)
chartType - parentchart - chartgroup - public void setOptions(EnumSet<ChartHandle.ChartOptions> options)
public static ChartType parseOOXML(org.xmlpull.v1.XmlPullParser xpp, WorkBookHandle wbh, Chart parentChart, int nChart)
xpp - XmlPullParserwbh - workBookHandleparentChart - parent Chart ObjectnChart - chart grouping number, 0 for default, 1-9 for overlayprotected int[] getDataLabelInts()
AttachedLabelprotected int getDataLabel()
protected int[] getMarkerFormats()
protected void setVaryColor(boolean b)
b - public boolean getHasSmoothLines()
public void setHasSmoothLines(boolean b)
public int getChartType()
public void addLegend(Legend l)
public String getSVG()
public String getJSON()
public org.json.JSONObject getOptionsJSON()
public StringBuffer getOOXML(String catAxisId, String valAxisId, String serAxisId)
public org.json.JSONObject getJSON(ChartSeries s, WorkBookHandle wbh, Double[] minMax) throws org.json.JSONException
org.json.JSONExceptionpublic org.json.JSONObject getTypeJSON()
throws org.json.JSONException
org.json.JSONExceptionpublic String getSVG(HashMap<String,Double> chartMetrics, HashMap<String,Object> axisMetrics, ChartSeries s)
chartMetrics - maps chart coords in pixels x, y, w, h, canvasw, canvash, min, maxaxisMetrics - maps specific axis options such as xAxisReversed, xPattern ...s - ChartSeries - holds legends, categories, seriesdata ...public String getSVGDataLabels(int[] datalabels, HashMap<String,Object> axisMetrics, double val, double percentage, int s, String[] legends, String cat)
datalabel - int[] Data label options (indexed by current series # s)
series - ArrayList of series and category data: structure: category data, series 0-n data, series colors, series Labels (Eventually will be an object)val - double current series valuepercentage - double percentage value (pie charts only)s - int current series #cat - string current catpublic boolean hasDataLegend()
public Legend getDataLegend()
public void showLegend(boolean bShow,
boolean vertical)
bShow - boolean show or hidevertical - boolean show as vertical or horizontalpublic String getDataLabels()
public int getDataLabelsInt()
AttachedLabelpublic int getBarShape()
public int getMarkerFormat()
public boolean getHasLines()
public boolean getHasDropLines()
public void setHasDropLines()
public String getChartOption(String op)
op - public String getChartOptionsXML()
nChart - 0=default, 1-9= overlay chartspublic boolean setChartOption(String op, String val)
op - optionval - valueOpenXLS.handleChartElement,
ChartHandle.getXMLpublic boolean isThreeD()
public String getThreeDXML()
public ThreeD initThreeD(int charttype)
chartType - one of the chart type constantspublic ThreeD getThreeDRec(boolean bCreate)
public boolean isStacked()
public boolean is100PercentStacked()
public void setIsStacked(boolean isstacked)
public void setIs100Psercent(boolean ispercentage)
public boolean isClustered()
public void addLegend()
public static String getFillOpacity()
public static String getTextColor()
public static String getLightColor()
public static String getMediumColor()
public static String getDarkColor()
protected String getFontSVG()
public static String getDataLabelFontSVG()
public static String getStrokeSVG()
stroke - size in ptpublic static String getStrokeSVG(float sz, String strokeclr)
stroke - size in ptString - stroke color in HTML formatprotected String getFontSVG(int sz)
font - size in ptpublic int convertShape(String shape)
shape - public String getShape()
shape - intpublic int getGapDepth()
protected SeriesList getSeriesList()
public void WriteMainChartRecs(String fName)
fName - Copyright © 2002–2019 Starter Inc.. All rights reserved.