Class Chart
"Sheet1!$B$2:$B$10"). Add with Sheet.addChart(...).
Types: column, bar, line, pie, area, scatter, doughnut, radar, bubble,
surface, stock, combo, waterfall, histogram, funnel, treemap, sunburst,
boxWhisker, pareto, map. Appearance the builder can set: legend placement and
visibility, axis visibility/titles/scale, per-series and per-point fill colors,
data labels, the Excel auto-title, and — on a combo chart — each series' plot
type (Chart.Builder.seriesType(java.lang.String)) and value axis (Chart.Builder.secondaryAxis(boolean)).
The color and style parts (colors1.xml, style1.xml) of a
classic chart are not modeled. For an extended chart (waterfall, funnel,
histogram, treemap, sunburst, box and whisker, pareto, map), pass them
through Chart.Builder.extendedApparatus(java.lang.String, java.lang.String, java.lang.String).
Read the charts of a sheet with Sheet.charts() (snapshots), or
edit one in place with Sheet.chart(int), which returns a
ChartView.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Chart.Builderarea()An area chart.static Chart.Builderbar()A horizontal bar chart: categories up the side, values along the bottom.barShape()The solid a 3-D bar or column is drawn as;"box"when the chart declares no shape, that being the attribute's default.static Chart.BuilderA box & whisker chart: distribution quartiles with outlier whiskers.static Chart.Builderbubble()A bubble chart; add series withChart.Builder.bubbleSeries(java.lang.String, java.lang.String, java.lang.String, java.lang.String)so each bubble has a size.The category (X) axis title, ornullwhen none is set.static Chart.Buildercolumn()A vertical clustered column chart.static Chart.Buildercombo()A combination chart: one plot holding column, line, area, horizontal bar and scatter series together (ECMA-376 Part 1 §21.2.2.145, one<c:plotArea>with several plot groups).static Chart.Builderdoughnut()A doughnut chart; set the hole withChart.Builder.holeSize(int).static ChartBuilds a chart spec from the engine's chart JSON, the form behindSheet.charts().static Chart.Builderfunnel()A funnel chart: values as progressively narrowing stages.static Chart.BuilderA histogram chart: values bucketed into frequency bins.booleanis3d()Whether the chart is drawn in 3-D.Legend placement;LegendPosition.RIGHTwhen the spec does not set one.static Chart.Builderline()A line chart.static Chart.Buildermap()A filled-region map chart: geographic regions colored by value.static Chart.BuilderA chart of any supported type token: column, bar, line, pie, area, scatter, doughnut, radar, bubble, surface, stock, combo, waterfall, histogram, funnel, treemap, sunburst, boxWhisker, pareto, map.static Chart.Builderpareto()A pareto chart: sorted histogram with a cumulative-percentage line.static Chart.Builderpie()A pie chart; Excel draws only the first series.The PivotChart binding this chart is driven by, in Excel's[WorkbookName]SheetName!PivotNameform (ECMA-376 §21.2.2.153), ornullfor a regular chart.static Chart.Builderradar()A radar chart.static Chart.Builderscatter()An XY scatter chart; each series'categoriesRefholds its X values.seriesBubbleSizes(int seriesIndex) The bubble-size (Z) reference of seriesseriesIndex, ornullwhen it has none or the index is out of range.intThe number of series in this spec.booleanseriesSecondaryAxis(int seriesIndex) Whether seriesseriesIndexis plotted against the secondary value axis of a combo chart;falsefor an index out of range.seriesType(int seriesIndex) The plot type of seriesseriesIndexin a combo chart:"column","line","area","bar"or"scatter", or the group type of an imported combo ("radar","bubble","stock").booleanWhether the chart-wide data-label switch is on.static Chart.Builderstock()A stock chart (high-low-close).intstyle()The chart's built-in style number (<c:style val>), or-1when the chart carries none — which is what a chart built here does.static Chart.Buildersunburst()A sunburst chart: hierarchical proportions as concentric rings.static Chart.Buildersurface()A surface chart.title()The literal title, ornullwhen the chart has none or uses an auto title (titleAuto()).booleanWhether this chart carries an Excel "auto" title (derived from the series name).The cell reference the title follows (<c:strRef><c:f>), ornullfor a literal or absent title.A builder pre-loaded with this chart spec, for read–modify–write round trips.toJson()The chart spec as the JSON object sent to the engine.static Chart.Buildertreemap()A treemap chart: hierarchical proportions as nested rectangles.type()The chart type token (seeof(String)); an empty string when the spec has none.booleanWhether the value (Y) axis draws major gridlines (<c:majorGridlines>, ECMA-376 Part 1 §21.2.2).The value (Y) axis title, ornullwhen none is set.static Chart.BuilderA waterfall (bridge) chart: running total with positive/negative steps.
-
Method Details
-
column
A vertical clustered column chart. -
bar
A horizontal bar chart: categories up the side, values along the bottom. -
line
A line chart. -
pie
A pie chart; Excel draws only the first series. -
area
An area chart. -
scatter
An XY scatter chart; each series'categoriesRefholds its X values. -
doughnut
A doughnut chart; set the hole withChart.Builder.holeSize(int). -
radar
A radar chart. -
bubble
A bubble chart; add series withChart.Builder.bubbleSeries(java.lang.String, java.lang.String, java.lang.String, java.lang.String)so each bubble has a size. -
combo
A combination chart: one plot holding column, line, area, horizontal bar and scatter series together (ECMA-376 Part 1 §21.2.2.145, one<c:plotArea>with several plot groups). Give each series its type withChart.Builder.seriesType(java.lang.String)— a series given none is a column series — and move a series onto the secondary axes withChart.Builder.secondaryAxis(boolean). The series on one axis share an axis kind (column/line/area, bar, scatter); seeChart.Builder.seriesType(java.lang.String). -
surface
A surface chart. The default form is the top-down (contour) view; callthreeD(true)for the 3-D surface. -
stock
A stock chart (high-low-close). Add three series in high, low, close order — or four (open-high-low-close) — as Excel requires 3-4 series for this type. -
waterfall
A waterfall (bridge) chart: running total with positive/negative steps. -
histogram
A histogram chart: values bucketed into frequency bins. -
funnel
A funnel chart: values as progressively narrowing stages. -
treemap
A treemap chart: hierarchical proportions as nested rectangles. -
sunburst
A sunburst chart: hierarchical proportions as concentric rings. -
boxWhisker
A box & whisker chart: distribution quartiles with outlier whiskers. -
pareto
A pareto chart: sorted histogram with a cumulative-percentage line. -
map
A filled-region map chart: geographic regions colored by value. The category range holds region names; region geometry is resolved by the spreadsheet application when the file is opened. -
of
A chart of any supported type token: column, bar, line, pie, area, scatter, doughnut, radar, bubble, surface, stock, combo, waterfall, histogram, funnel, treemap, sunburst, boxWhisker, pareto, map. An unknown token is not rejected: the chart is created as a column chart. -
toBuilder
A builder pre-loaded with this chart spec, for read–modify–write round trips. Its series are kept, soseries(...)appends to them; callChart.Builder.clearSeries()first to replace them. -
toJson
The chart spec as the JSON object sent to the engine. Used by the SDK; not needed by callers. -
fromJson
Builds a chart spec from the engine's chart JSON, the form behindSheet.charts(). Used by the SDK. -
type
The chart type token (seeof(String)); an empty string when the spec has none. -
title
The literal title, ornullwhen the chart has none or uses an auto title (titleAuto()). -
titleAuto
public boolean titleAuto()Whether this chart carries an Excel "auto" title (derived from the series name). -
titleFormula
The cell reference the title follows (<c:strRef><c:f>), ornullfor a literal or absent title. -
style
public int style()The chart's built-in style number (<c:style val>), or-1when the chart carries none — which is what a chart built here does. -
barShape
The solid a 3-D bar or column is drawn as;"box"when the chart declares no shape, that being the attribute's default. -
seriesBubbleSizes
The bubble-size (Z) reference of seriesseriesIndex, ornullwhen it has none or the index is out of range.- Parameters:
seriesIndex- 0-based series index
-
seriesType
The plot type of seriesseriesIndexin a combo chart:"column","line","area","bar"or"scatter", or the group type of an imported combo ("radar","bubble","stock").- Parameters:
seriesIndex- 0-based series index- Returns:
- the type, or
nullwhen the series has none, on a chart that is not a combo, or for an index out of range. A combo series without a type is drawn as a column.
-
seriesSecondaryAxis
public boolean seriesSecondaryAxis(int seriesIndex) Whether seriesseriesIndexis plotted against the secondary value axis of a combo chart;falsefor an index out of range.- Parameters:
seriesIndex- 0-based series index
-
seriesCount
public int seriesCount()The number of series in this spec. -
legendPosition
Legend placement;LegendPosition.RIGHTwhen the spec does not set one. -
showDataLabels
public boolean showDataLabels()Whether the chart-wide data-label switch is on. -
is3d
public boolean is3d()Whether the chart is drawn in 3-D. -
categoryAxisTitle
The category (X) axis title, ornullwhen none is set. -
valueAxisTitle
The value (Y) axis title, ornullwhen none is set. -
valueAxisGridlines
public boolean valueAxisGridlines()Whether the value (Y) axis draws major gridlines (<c:majorGridlines>, ECMA-376 Part 1 §21.2.2). Defaults totrue. -
pivotSource
The PivotChart binding this chart is driven by, in Excel's[WorkbookName]SheetName!PivotNameform (ECMA-376 §21.2.2.153), ornullfor a regular chart. Set bySheet.addPivotChart(int, java.lang.String, int, int, int, int)and preserved from imported files.
-