Class Chart.Builder
- Enclosing class:
- Chart
-
Method Summary
Modifier and TypeMethodDescriptionanchor(int fromRow, int fromColumn, int toRow, int toColumn) The two-cell anchor rectangle (0-based cells).anchorOffsets(int fromColOff, int fromRowOff, int toColOff, int toRowOff) The sub-cell EMU offsets of the two-cell anchor's from/to corners (914400 EMU = 1 inch).autoTitle(boolean on) Mark the chart as carrying an Excel "auto" title: no explicit text is emitted, so the app derives the displayed title from the single series name.The solid a 3-D bar or column is drawn as —<c:shape>, ECMA-376 Part 1 §21.2.2.177:"box"(the default),"cone","coneToMax","cylinder","pyramid"or"pyramidToMax".bubbleSeries(String name, String valuesRef, String categoriesRef, String sizesRef) Add a bubble series: a values (Y) range, a categories (X) range and the sizes (Z) range that gives each bubble its area —<c:bubbleSize>, ECMA-376 Part 1 §21.2.2.19.bubbleSizes(String sizesRef) Attaches a bubble-size (Z) range to the series most recently added — the counterpart ofpointFill(int, io.keikai.axyra.sheets.style.Color)for a series that was added with one of the plainseries(...)overloads.build()categoryAxisTitle(String title) Category (X) axis title.categoryAxisVisible(boolean visible) Show or hide the category (X) axis (ECMA-376 §21.2.2.16 catAx).chartAreaBorder(Color color) Chart-area frame (border) line color.chartAreaFill(Color fill) Chart-area fill color (ECMA-376 §21.2.2.198<c:spPr>on the chart space).Suppress the chart-area frame (<a:ln><a:noFill/></a:ln>).Make the chart-area background explicitly TRANSPARENT (<a:noFill/>, ECMA-376 §20.1.8.44) so the sheet shows through — distinct from leaving the fill unset, which renders as the application-default opaque white.Drop every series this builder currently holds.dataLabels(DataLabels labels) Attach data labels to the most recently added series.Attach error bars to the most recently added series.extendedApparatus(String chartExBase64, String colorsBase64, String styleBase64) Carry the byte-exact apparatus of a modern extended (cx:) chart — thechartExpart plus itschartColorStyle/chartStyleparts, each base64-encoded — so a re-authored waterfall/funnel/… re-emits the complete part set Excel requires to open the file.gapWidth(int percent) Bar/column gap width as a percentage of bar width (0–500, default 150).Bar/column/area/line grouping:"clustered"/"stacked"/"percentStacked"/"standard"(default"clustered").holeSize(int percent) Doughnut hole size as a percentage (10–90, default 50).legend(LegendPosition position) Legend placement;LegendPosition.NONEhides the legend.legendLayout(double x, double y, double w, double h) Position the legend at an explicit rectangle in chart-relative fractions (x/ytop-left,w/hsize, all in[0, 1]) — a manual legend layout.legendVisible(boolean visible) Show or hide the legend without changing its position — distinct fromlegend(LegendPosition).overlap(int percent) Bar overlap as a percentage (-100 to 100, default 0).plotAreaBorder(Color color) Plot-area frame (border) line color.plotAreaFill(Color fill) Plot-area fill color.plotAreaLayout(double x, double y, double w, double h) Position the inner plot area at an explicit rectangle in chart-relative fractions (ECMA-376 §21.2.2.88manualLayout):x/yare the top-left corner andw/hthe size, all in[0, 1].Suppress the plot-area frame (<a:ln><a:noFill/></a:ln>).Make the plot-area background explicitly transparent (mirrorschartAreaNoFill()).pointExplosion(int pointIndex, int percent) Explode the pie/doughnut slice atpointIndexoutward bypercentof the radius (ECMA-376 §21.2.2.62dPt/explosion) on the most recently added series.Override the fill color of one data point (pie slice / bar) on the most recently added series (ECMA-376 §21.2.2.52 dPt).pointLabel(int pointIndex, String text) Give one point of the most recently added series a label of its own (ECMA-376 §21.2.2.47dLbl) — a caption in place of the value the rest of the series shows.pointLabelHidden(int pointIndex, boolean hidden) Hide the label of one point while the rest of the series keeps its own (<c:dLbl><c:delete val="1"/>).Add a data series referencing a values range.Add a data series with a categories (labels) range.Add a data series with an explicit fill color.showDataLabels(boolean show) Show/hide data labels on the series.style(int style) The chart's built-in style number (<c:style val>).threeD(boolean on) Render the chart in 3-D.titleFormula(String reference) Make the chart title follow a cell rather than a literal string —<c:title><c:tx><c:strRef><c:f>.titleLayout(double x, double y, double w, double h) Position the chart title at an explicit rectangle in chart-relative fractions — a manual title layout.Add a trendline to the most recently added series.Change the chart family this spec describes, keeping everything else it already carries — the counterpart ofChart.type()on the read–modify–write path, where the family comes from the file and the caller wants a different one.valueAxisScale(double min, double max) Fix the value (Y) axis scale to[min, max].valueAxisTitle(String title) Value (Y) axis title.valueAxisVisible(boolean visible) Show or hide the value (Y) axis (ECMA-376 §21.2.2.226 valAx).view3D(int rotX, int rotY, int depthPercent) Render the chart in 3-D with the given view angles (ECMA-376 §21.2.2.228view3D):rotXis the elevation androtYthe rotation, both in degrees;depthPercentis the depth as a percentage of the plot height (100 = default).
-
Method Details
-
title
-
autoTitle
Mark the chart as carrying an Excel "auto" title: no explicit text is emitted, so the app derives the displayed title from the single series name. Use this instead oftitle(String)to reproduce a source chart whose title was auto (otherwise a rebuild shows a generic "Chart Title"). ECMA-376 §21.2.2.9 (autoTitleDeleted). -
legend
Legend placement;LegendPosition.NONEhides the legend. -
legendVisible
Show or hide the legend without changing its position — distinct fromlegend(LegendPosition). Hiding emits<c:legend> <c:delete val="1"/>so a rebuilt minimal chart does not sprout a legend the source hid (ECMA-376 §21.2.2.24 legend). -
categoryAxisVisible
Show or hide the category (X) axis (ECMA-376 §21.2.2.16 catAx). -
valueAxisVisible
Show or hide the value (Y) axis (ECMA-376 §21.2.2.226 valAx). -
showDataLabels
Show/hide data labels on the series. -
type
Change the chart family this spec describes, keeping everything else it already carries — the counterpart ofChart.type()on the read–modify–write path, where the family comes from the file and the caller wants a different one.- Parameters:
type- a family token accepted byChart.of(java.lang.String)
-
threeD
Render the chart in 3-D. -
barShape
The solid a 3-D bar or column is drawn as —<c:shape>, ECMA-376 Part 1 §21.2.2.177:"box"(the default),"cone","coneToMax","cylinder","pyramid"or"pyramidToMax".Only a bar or column chart with
threeD(boolean)set emits it; on any other family the shape has nowhere to go and is ignored, which is also how Excel treats it. -
style
The chart's built-in style number (<c:style val>).Excel stores the number and expands the appearance from its own gallery, so this writes exactly what a file carries and no more: a chart saved with a style number opens in Excel wearing that style, and renders here with whatever explicit formatting it was given.
-
titleFormula
Make the chart title follow a cell rather than a literal string —<c:title><c:tx><c:strRef><c:f>.Pass the reference (
"Sheet1!$A$1"); pair it withtitle(String)for the text to cache, which is what renderers that do not evaluate the reference will draw. An empty string clears the link and leaves the literal title. -
grouping
Bar/column/area/line grouping:"clustered"/"stacked"/"percentStacked"/"standard"(default"clustered"). Stacked charts stack each category's series into one bar; without this a rebuilt stacked chart renders as clustered. -
gapWidth
Bar/column gap width as a percentage of bar width (0–500, default 150). -
overlap
Bar overlap as a percentage (-100 to 100, default 0). -
holeSize
Doughnut hole size as a percentage (10–90, default 50). -
anchor
The two-cell anchor rectangle (0-based cells). -
anchorOffsets
The sub-cell EMU offsets of the two-cell anchor's from/to corners (914400 EMU = 1 inch). Excel pins a chart to a fractional position inside the from/to cells; without these the chart snaps to the cell boundary and resizes. Reproduces the exact placement of a source chart. -
chartAreaFill
Chart-area fill color (ECMA-376 §21.2.2.198<c:spPr>on the chart space). -
chartAreaBorder
Chart-area frame (border) line color. -
chartAreaNoBorder
Suppress the chart-area frame (<a:ln><a:noFill/></a:ln>). Use to reproduce a source chart with no outer border box, which a rebuilt chart would otherwise draw by default. -
chartAreaNoFill
Make the chart-area background explicitly TRANSPARENT (<a:noFill/>, ECMA-376 §20.1.8.44) so the sheet shows through — distinct from leaving the fill unset, which renders as the application-default opaque white. Takes precedence overchartAreaFill(Color). -
plotAreaFill
Plot-area fill color. -
plotAreaBorder
Plot-area frame (border) line color. -
plotAreaNoBorder
Suppress the plot-area frame (<a:ln><a:noFill/></a:ln>). -
plotAreaNoFill
Make the plot-area background explicitly transparent (mirrorschartAreaNoFill()). -
series
Add a data series referencing a values range. -
series
Add a data series with a categories (labels) range. -
clearSeries
Drop every series this builder currently holds.Written for the read–modify–write round trip:
Chart.toBuilder()pre-loads the chart's existing series soseries(...)appends to them, which is right when adding one and wrong when replacing the whole set. Clearing first makes the series list say exactly what the caller means, and nothing else about the chart is touched. -
bubbleSeries
public Chart.Builder bubbleSeries(String name, String valuesRef, String categoriesRef, String sizesRef) Add a bubble series: a values (Y) range, a categories (X) range and the sizes (Z) range that gives each bubble its area —<c:bubbleSize>, ECMA-376 Part 1 §21.2.2.19.Without the sizes every bubble is drawn identically, which is the one dimension a bubble chart exists to show. Only a bubble chart emits them.
-
bubbleSizes
Attaches a bubble-size (Z) range to the series most recently added — the counterpart ofpointFill(int, io.keikai.axyra.sheets.style.Color)for a series that was added with one of the plainseries(...)overloads. -
series
Add a data series with an explicit fill color. -
pointFill
Override the fill color of one data point (pie slice / bar) on the most recently added series (ECMA-376 §21.2.2.52 dPt). Reproduces per-slice colors when rebuilding a chart from its read model.- Throws:
IllegalStateException- when no series has been added yet
-
pointExplosion
Explode the pie/doughnut slice atpointIndexoutward bypercentof the radius (ECMA-376 §21.2.2.62dPt/explosion) on the most recently added series.- Throws:
IllegalStateException- when no series has been added yet
-
pointLabel
Give one point of the most recently added series a label of its own (ECMA-376 §21.2.2.47dLbl) — a caption in place of the value the rest of the series shows. Lines are separated by\n.- Throws:
IllegalStateException- when no series has been added yet
-
pointLabelHidden
Hide the label of one point while the rest of the series keeps its own (<c:dLbl><c:delete val="1"/>).- Throws:
IllegalStateException- when no series has been added yet
-
view3D
Render the chart in 3-D with the given view angles (ECMA-376 §21.2.2.228view3D):rotXis the elevation androtYthe rotation, both in degrees;depthPercentis the depth as a percentage of the plot height (100 = default). The base type (bar/column/line/pie/area) becomes its*3DChartform on save. ImpliesthreeD(true). -
plotAreaLayout
Position the inner plot area at an explicit rectangle in chart-relative fractions (ECMA-376 §21.2.2.88manualLayout):x/yare the top-left corner andw/hthe size, all in[0, 1]. Without this the plot area is laid out automatically. -
legendLayout
Position the legend at an explicit rectangle in chart-relative fractions (x/ytop-left,w/hsize, all in[0, 1]) — a manual legend layout. Without this the legend is placed automatically at itsposition. -
titleLayout
Position the chart title at an explicit rectangle in chart-relative fractions — a manual title layout. Without this the title is placed automatically. -
trendline
Add a trendline to the most recently added series. Trendlines persist to the saved workbook per ECMA-376 §21.2.2.211.- Throws:
IllegalStateException- when no series has been added yet
-
errorBars
Attach error bars to the most recently added series. Error bars persist to the saved workbook per ECMA-376 §21.2.2.55.- Throws:
IllegalStateException- when no series has been added yet
-
dataLabels
Attach data labels to the most recently added series. Data labels are re-emitted as<c:dLbls>on save (ECMA-376 §21.2.2.49) and read back viaChartView.seriesDataLabels(int).- Throws:
IllegalStateException- when no series has been added yet
-
extendedApparatus
public Chart.Builder extendedApparatus(String chartExBase64, String colorsBase64, String styleBase64) Carry the byte-exact apparatus of a modern extended (cx:) chart — thechartExpart plus itschartColorStyle/chartStyleparts, each base64-encoded — so a re-authored waterfall/funnel/… re-emits the complete part set Excel requires to open the file. The structured builder fields (series/axes/…) cannot reconstruct an extended chart, and Excel refuses to open achartExthat lacks its colors/style relationships, so this is the faithful round-trip path. Obtain the arguments fromChartView.extendedChartExData()and its siblings. Passing anullchartExBase64is a no-op.Reference: ISO/IEC 29500 Transitional; MS extension namespace
.../office/drawing/2014/chartex. -
categoryAxisTitle
Category (X) axis title. -
valueAxisTitle
Value (Y) axis title. -
valueAxisScale
Fix the value (Y) axis scale to[min, max]. -
build
-