Class ChartView

java.lang.Object
io.keikai.axyra.sheets.ChartView

public final class ChartView extends Object
A view of one existing chart, obtained with Sheet.chart(int) for a chart on a worksheet, or with Workbook.chartSheetChart(int) for the chart of a chart-sheet tab. Getters mirror the fields of the Chart builder.

Getters read a snapshot taken when the view was created or last refreshed. Changes made elsewhere, for example through another ChartView or Sheet.replaceChart(int, io.keikai.axyra.sheets.content.Chart), are not seen until reload(). Each setter sends the whole snapshot to the engine at once and then reloads. When a setter throws AxyraException, the rejected value stays in the snapshot; call reload() before the next setter.

The view addresses the chart by index. After a chart with a lower index is removed, this view addresses a different chart.

A setter marks the host dirty: the sheet's drawing layer, or the chart sheet. An imported chart is then regenerated from the model on the next save, so the edit appears in the file. Trendline and error-bar edits are drawn by Sheet.renderChartToPng(int, int, int) and saved to the workbook. The anchor accessors have no effect for a chart-sheet chart, which always fills the page.

Methods that take a seriesIndex use a 0-based index and throw AxyraException when it is outside [0, seriesCount()).


 ChartView chart = sheet.chart(0);
 chart.setTitle("Sales 2026").setLegend(LegendPosition.BOTTOM);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    addTrendline(int seriesIndex, Trendline trendline)
    Adds a trendline to a series, after any it already has.
    int[]
    The two-cell anchor as {fromRow, fromColumn, toRow, toColumn}, all 0-based.
    int[]
    {fromColOff, fromRowOff, toColOff, toRowOff} — the sub-cell EMU offsets of the two-cell anchor's corners (914400 EMU = 1 inch).
    The solid a 3-D bar or column draws its bars as (<c:shape>, ECMA-376 Part 1 §21.2.2.177): "box", "cone", "coneToMax", "cylinder", "pyramid" or "pyramidToMax".
    The category (X) axis title, or null when the axis has none or the chart has no category axis.
    boolean
    Whether the category (X) axis is drawn.
    The chart-area fill color, or null when none is set and the default white applies.
    The chart-area border color, or null when none is set.
    boolean
    Whether the chart-area background is explicitly TRANSPARENT (<a:noFill/>, ECMA-376 §20.1.8.44) — the sheet shows through.
    boolean
    Whether the chart area is set to have no border.
    clearTrendlines(int seriesIndex)
    Removes every trendline from a series.
    errorBars(int seriesIndex)
    The error bars of a series, or null when it has none.
    Base64 of the source xl/charts/chartEx*.xml part for an extended chart, or null for a classic chart.
    Base64 of the extended chart's chartColorStyle part, or null.
    Base64 of the extended chart's chartStyle part, or null.
    int
    The gap between bar or column clusters, as a percentage of one bar's width (0–500).
    Bar/column/area/line grouping: "clustered" / "stacked" / "percentStacked" / "standard" (Excel default "clustered").
    int
    The doughnut hole size, as a percentage of the outer radius.
    int
    This chart's 0-based index on its sheet, or the chart-sheet index for a chart-sheet chart.
    boolean
    Whether the chart is drawn in 3-D; see view3D() for its angles.
    boolean
    Whether this is a modern extended chart — the ISO/IEC 29500 Transitional cx: chart-extension schema (waterfall, funnel, histogram, treemap, sunburst, box & whisker, region map).
    boolean
    Whether this chart is a pie-of-pie or bar-of-pie (<c:ofPieChart>).
    double[]
    The manual legend layout as [x, y, w, h] chart-relative fractions, or null when the legend is placed automatically.
    Where the legend is placed; LegendPosition.NONE when the legend is marked deleted.
    boolean
    Whether the legend is shown at all (independent of its position).
    int[]
    The zero-based point indices a cust split puts in the second plot (<c:custSplit>); empty for every other rule.
    boolean
    Whether an of-pie chart draws its second plot as a stacked bar (<c:ofPieType val="bar"/>) rather than as a second pie.
    The second plot's size as a percentage of the first (<c:secondPieSize>), or null when absent.
    The count or threshold the split rule compares against (<c:splitPos>), or null when absent.
    The of-pie split rule as the format's own token — auto, cust, percent, pos or val — or null when the chart carries no <c:splitType>.
    int
    How much bars in one cluster overlap, as a percentage from -100 (a full bar-width gap) to 100 (full overlap).
    The plot-area fill color, or null when none is set.
    double[]
    The manual plot-area layout (ECMA-376 §21.2.2.88 manualLayout) as [x, y, w, h] in chart-relative fractions, or null when the plot area is laid out automatically.
    The plot-area border color, or null when none is set.
    boolean
    Whether the plot-area background is explicitly transparent (mirrors chartAreaNoFill()).
    boolean
    Whether the plot area is set to have no border.
    void
    Re-reads the chart from the engine and replaces this view's snapshot.
    seriesBubbleSizes(int seriesIndex)
    The series' bubble-size (Z) range reference (<c:bubbleSize>), or null on anything but a bubble chart that declares one.
    seriesCategories(int seriesIndex)
    The series categories range reference, or null when the series has none.
    int
    The number of series in the chart; series indices run from 0 to seriesCount() - 1.
    seriesDataLabels(int seriesIndex)
    The series-level data labels (<c:dLbls>), or null when the series carries none.
    seriesFill(int seriesIndex)
    The solid fill color set on a series, or null when the series uses the theme color.
    seriesHiddenPointLabels(int seriesIndex)
    The point indices whose label the chart hides while the rest of the series keeps its own (<c:dLbl><c:delete val="1"/>); empty when none is hidden.
    boolean[]
    seriesInSecondPlot(int seriesIndex)
    Which of a series' points a pie-of-pie / bar-of-pie draws in its second plot, one flag per cached value.
    seriesName(int seriesIndex)
    The series name: literal text, or a sheet-qualified reference such as "Sheet1!$B$1".
    seriesPointExplosions(int seriesIndex)
    The explicit per-slice explosion overrides of a series (pie/doughnut), keyed by 0-based point index (ECMA-376 §21.2.2.62 dPt/explosion, percent of radius).
    seriesPointFills(int seriesIndex)
    The explicit per-data-point (per-slice / per-bar) fill overrides of a series, keyed by 0-based point index (ECMA-376 §21.2.2.52 dPt).
    seriesPointLabels(int seriesIndex)
    The captions of the series' per-point labels (<c:dLbl>), keyed by the point index each names.
    boolean
    seriesSecondaryAxis(int seriesIndex)
    Whether this series is plotted against the secondary value axis of a combination chart; false on an ordinary chart.
    seriesType(int seriesIndex)
    The plot group this series is drawn in on a combination chart — one <c:plotArea> holding several <c:*Chart> groups, the bar-plus-line shape Excel calls a combo (ECMA-376 Part 1 §21.2.2.145): "column", "line", "area", "bar", "scatter", or the type of the group an imported combo put it in ("radar", "bubble", "stock").
    double[]
    seriesValueCache(int seriesIndex)
    The series' cached point values (<c:numCache>), in point order.
    seriesValues(int seriesIndex)
    The series values range reference, such as "Sheet1!$B$2:$B$9".
    setAnchor(int fromRow, int fromColumn, int toRow, int toColumn)
    Moves or resizes the chart by setting its two-cell anchor (0-based).
    setAutoTitle(boolean auto)
    Marks or unmarks the title as an Excel auto title.
    Sets the category (X) axis title, or removes it with null or an empty string.
    setCategoryAxisVisible(boolean visible)
    Shows or hides the category (X) axis; creates both axes when the chart has none.
    setErrorBars(int seriesIndex, ErrorBars errorBars)
    Sets the error bars of a series, replacing any it has, or removes them with null.
    setGapWidth(int percent)
    Sets the gap between bar or column clusters, as a percentage of one bar's width.
    setHoleSize(int percent)
    Sets the doughnut hole size as a percentage of the outer radius.
    Moves the legend.
    setLegendVisible(boolean visible)
    Shows or hides the legend without changing its position.
    setOverlap(int percent)
    Sets how much bars in one cluster overlap, as a percentage from -100 (a full bar-width gap) to 100 (full overlap).
    setSeries(int seriesIndex, String name, String valuesRef, String categoriesRef)
    Replaces the references of one series.
    setSeriesDataLabels(int seriesIndex, DataLabels labels)
    Sets the data labels of one series, or removes them with null.
    setSeriesFill(int seriesIndex, Color fill)
    Sets the solid fill of one series, or removes it with null so the theme color applies.
    setSeriesSecondaryAxis(int seriesIndex, boolean on)
    Plot one series of a combo chart against the secondary value axis (on) or the primary one — the counterpart of Chart.Builder.secondaryAxis(boolean).
    setSeriesType(int seriesIndex, String type)
    Move one series of a combo chart into the plot group of another type — the counterpart of Chart.Builder.seriesType(String).
    setShowDataLabels(boolean show)
    Shows value labels on every series, or with false removes every data label from the chart, series and point labels included.
    setThreeD(boolean threeD)
    Turns 3-D drawing on or off.
    Sets a literal chart title, or removes it with null or an empty string.
    Shows or hides the major gridlines of the value (Y) axis; creates both axes when the chart has none.
    setValueAxisScale(double min, double max)
    Fixes the value (Y) axis to the range [min, max].
    Sets the value (Y) axis title, or removes it with null or an empty string.
    setValueAxisVisible(boolean visible)
    Shows or hides the value (Y) axis; creates both axes when the chart has none.
    boolean
    Whether the chart shows data labels: set through the builder or setShowDataLabels(boolean), or value labels on every series — the form the setting takes in a file, so it reads back after reopening.
    int
    The chart's built-in style number (<c:style val>), or -1 when it carries none.
    The literal chart title, or null when the chart has none or uses an auto title (titleAuto()).
    boolean
    Whether the chart title is an Excel "auto" title — a <c:title> present with no explicit text, so the app derives it from the single series name.
    The cell reference the title follows (<c:strRef><c:f>), or null for a literal or absent title.
    double[]
    The manual title layout as [x, y, w, h] chart-relative fractions, or null when the title is placed automatically.
    trendlines(int seriesIndex)
    The trendlines of a series, in file order; empty when none.
    The chart type token, such as "column", "bar", "line", "pie" or "combo"; "column" when the engine reports none.
    boolean
    Whether the value (Y) axis draws major gridlines (<c:majorGridlines>).
    The fixed value-axis maximum, or null when the axis scales automatically.
    The fixed value-axis minimum, or null when the axis scales automatically.
    The value (Y) axis title, or null when the axis has none or the chart has no value axis.
    boolean
    Whether the value (Y) axis is drawn.
    int[]
    The chart's 3-D view angles (ECMA-376 §21.2.2.228 view3D) as [rotX, rotY, depthPercent], or null when the chart is not 3-D.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • reload

      public void reload()
      Re-reads the chart from the engine and replaces this view's snapshot.
      Throws:
      AxyraException - if no chart exists at this index any more, or the chart-sheet chart is an imported chart that the engine does not model
    • index

      public int index()
      This chart's 0-based index on its sheet, or the chart-sheet index for a chart-sheet chart. Fixed when the view was created.
    • type

      public String type()
      The chart type token, such as "column", "bar", "line", "pie" or "combo"; "column" when the engine reports none. See Chart.of(String) for the full list.
    • title

      public String title()
      The literal chart title, or null when the chart has none or uses an auto title (titleAuto()).
    • legendPosition

      public LegendPosition legendPosition()
      Where the legend is placed; LegendPosition.NONE when the legend is marked deleted. Independent of legendVisible().
    • showDataLabels

      public boolean showDataLabels()
      Whether the chart shows data labels: set through the builder or setShowDataLabels(boolean), or value labels on every series — the form the setting takes in a file, so it reads back after reopening.
    • is3d

      public boolean is3d()
      Whether the chart is drawn in 3-D; see view3D() for its angles.
    • barShape

      public String barShape()
      The solid a 3-D bar or column draws its bars as (<c:shape>, ECMA-376 Part 1 §21.2.2.177): "box", "cone", "coneToMax", "cylinder", "pyramid" or "pyramidToMax". "box" when the chart declares none, that being the attribute's default.
    • style

      public int style()
      The chart's built-in style number (<c:style val>), or -1 when it carries none.
    • titleFormula

      public String titleFormula()
      The cell reference the title follows (<c:strRef><c:f>), or null for a literal or absent title.
    • grouping

      public String grouping()
      Bar/column/area/line grouping: "clustered" / "stacked" / "percentStacked" / "standard" (Excel default "clustered"). A stacked series set renders as one solid bar per category, so this must be reproduced to rebuild a stacked chart.
    • gapWidth

      public int gapWidth()
      The gap between bar or column clusters, as a percentage of one bar's width (0–500). A new clustered 2-D column chart reports 219 and a clustered 2-D bar chart 182, which is what Excel writes; stacked, 3-D and other charts report 150.
    • overlap

      public int overlap()
      How much bars in one cluster overlap, as a percentage from -100 (a full bar-width gap) to 100 (full overlap). A new clustered 2-D column chart reports -27, which is what Excel writes; other charts report 0.
    • holeSize

      public int holeSize()
      The doughnut hole size, as a percentage of the outer radius. Reported for every chart type; only a doughnut chart uses it.
    • categoryAxisTitle

      public String categoryAxisTitle()
      The category (X) axis title, or null when the axis has none or the chart has no category axis.
    • valueAxisTitle

      public String valueAxisTitle()
      The value (Y) axis title, or null when the axis has none or the chart has no value axis.
    • valueAxisMin

      public Double valueAxisMin()
      The fixed value-axis minimum, or null when the axis scales automatically.
    • valueAxisMax

      public Double valueAxisMax()
      The fixed value-axis maximum, or null when the axis scales automatically.
    • anchor

      public int[] anchor()
      The two-cell anchor as {fromRow, fromColumn, toRow, toColumn}, all 0-based. The bottom-right corner sits at the top-left of cell (toRow, toColumn) plus anchorOffsets(). A new array on each call. Not meaningful for a chart-sheet chart.
    • anchorOffsets

      public int[] anchorOffsets()
      {fromColOff, fromRowOff, toColOff, toRowOff} — the sub-cell EMU offsets of the two-cell anchor's corners (914400 EMU = 1 inch). Reproduce them on a rebuild via Chart.Builder.anchorOffsets(int, int, int, int) so the chart keeps its exact fractional placement / size.
    • chartAreaFill

      public Color chartAreaFill()
      The chart-area fill color, or null when none is set and the default white applies. See also chartAreaNoFill().
    • chartAreaLineColor

      public Color chartAreaLineColor()
      The chart-area border color, or null when none is set.
    • chartAreaNoLine

      public boolean chartAreaNoLine()
      Whether the chart area is set to have no border.
    • chartAreaNoFill

      public boolean chartAreaNoFill()
      Whether the chart-area background is explicitly TRANSPARENT (<a:noFill/>, ECMA-376 §20.1.8.44) — the sheet shows through. Distinct from chartAreaFill() returning null, which means "unset" and renders as the application-default opaque white.
    • plotAreaFill

      public Color plotAreaFill()
      The plot-area fill color, or null when none is set.
    • plotAreaLineColor

      public Color plotAreaLineColor()
      The plot-area border color, or null when none is set.
    • plotAreaNoLine

      public boolean plotAreaNoLine()
      Whether the plot area is set to have no border.
    • plotAreaNoFill

      public boolean plotAreaNoFill()
      Whether the plot-area background is explicitly transparent (mirrors chartAreaNoFill()).
    • seriesCount

      public int seriesCount()
      The number of series in the chart; series indices run from 0 to seriesCount() - 1.
    • seriesName

      public String seriesName(int seriesIndex)
      The series name: literal text, or a sheet-qualified reference such as "Sheet1!$B$1".
      Parameters:
      seriesIndex - 0-based series index
      Returns:
      the name, or null when the series has none
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesValues

      public String seriesValues(int seriesIndex)
      The series values range reference, such as "Sheet1!$B$2:$B$9".
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesCategories

      public String seriesCategories(int seriesIndex)
      The series categories range reference, or null when the series has none. On a scatter chart this holds the X values.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesBubbleSizes

      public String seriesBubbleSizes(int seriesIndex)
      The series' bubble-size (Z) range reference (<c:bubbleSize>), or null on anything but a bubble chart that declares one.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesType

      public String seriesType(int seriesIndex)
      The plot group this series is drawn in on a combination chart — one <c:plotArea> holding several <c:*Chart> groups, the bar-plus-line shape Excel calls a combo (ECMA-376 Part 1 §21.2.2.145): "column", "line", "area", "bar", "scatter", or the type of the group an imported combo put it in ("radar", "bubble", "stock").

      null on an ordinary chart, where type() describes every series. Change it with setSeriesType(int, String).

      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesSecondaryAxis

      public boolean seriesSecondaryAxis(int seriesIndex)
      Whether this series is plotted against the secondary value axis of a combination chart; false on an ordinary chart. Change it with setSeriesSecondaryAxis(int, boolean).
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesFill

      public Color seriesFill(int seriesIndex)
      The solid fill color set on a series, or null when the series uses the theme color. Set it with setSeriesFill(int, Color) or Chart.Builder.series(String, String, String, Color).
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesPointFills

      public Map<Integer,Color> seriesPointFills(int seriesIndex)
      The explicit per-data-point (per-slice / per-bar) fill overrides of a series, keyed by 0-based point index (ECMA-376 §21.2.2.52 dPt). Empty when the series carries no <c:dPt> color overrides. A new map on each call.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesPointLabels

      public Map<Integer,String> seriesPointLabels(int seriesIndex)
      The captions of the series' per-point labels (<c:dLbl>), keyed by the point index each names.

      A series' <c:dLbls> block sets what every point's label shows; a <c:dLbl> inside it overrides that for one point, most often with a caption of its own. Empty when every point uses the series-level label. Lines within a caption are separated by \n.

      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesHiddenPointLabels

      public Set<Integer> seriesHiddenPointLabels(int seriesIndex)
      The point indices whose label the chart hides while the rest of the series keeps its own (<c:dLbl><c:delete val="1"/>); empty when none is hidden.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesValueCache

      public double[] seriesValueCache(int seriesIndex)
      The series' cached point values (<c:numCache>), in point order.

      These are the numbers the chart was drawn from, as the file recorded them. Empty when the series carries no cache and its range could not be resolved against the cells.

      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesInSecondPlot

      public boolean[] seriesInSecondPlot(int seriesIndex)
      Which of a series' points a pie-of-pie / bar-of-pie draws in its second plot, one flag per cached value.

      Derived by the engine from the chart's split settings and the series' values, so every caller gets the same answer to a question the file only states indirectly. Empty for a chart with no of-pie split — which is not the same as all-false, and is why this returns a length rather than a per-index lookup.

      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • isOfPie

      public boolean isOfPie()
      Whether this chart is a pie-of-pie or bar-of-pie (<c:ofPieChart>).
    • ofPieSecondPlotIsBar

      public boolean ofPieSecondPlotIsBar()
      Whether an of-pie chart draws its second plot as a stacked bar (<c:ofPieType val="bar"/>) rather than as a second pie. false for a chart that is not an of-pie at all — test with isOfPie() first.
    • ofPieSplitType

      public String ofPieSplitType()
      The of-pie split rule as the format's own token — auto, cust, percent, pos or val — or null when the chart carries no <c:splitType>.

      An absent rule is kept distinct from an explicit auto: the first leaves the choice to the application, the second records that the author chose to leave it there.

    • ofPieSplitPosition

      public Double ofPieSplitPosition()
      The count or threshold the split rule compares against (<c:splitPos>), or null when absent.
    • ofPieCustomSplit

      public int[] ofPieCustomSplit()
      The zero-based point indices a cust split puts in the second plot (<c:custSplit>); empty for every other rule.
    • ofPieSecondPlotSize

      public Integer ofPieSecondPlotSize()
      The second plot's size as a percentage of the first (<c:secondPieSize>), or null when absent.
    • view3D

      public int[] view3D()
      The chart's 3-D view angles (ECMA-376 §21.2.2.228 view3D) as [rotX, rotY, depthPercent], or null when the chart is not 3-D. The read-back counterpart of Chart.Builder.view3D(int, int, int).
    • plotAreaLayout

      public double[] plotAreaLayout()
      The manual plot-area layout (ECMA-376 §21.2.2.88 manualLayout) as [x, y, w, h] in chart-relative fractions, or null when the plot area is laid out automatically. Read-back of Chart.Builder.plotAreaLayout(double, double, double, double).
    • legendLayout

      public double[] legendLayout()
      The manual legend layout as [x, y, w, h] chart-relative fractions, or null when the legend is placed automatically. Read-back of Chart.Builder.legendLayout(double, double, double, double).
    • titleLayout

      public double[] titleLayout()
      The manual title layout as [x, y, w, h] chart-relative fractions, or null when the title is placed automatically. Read-back of Chart.Builder.titleLayout(double, double, double, double).
    • seriesPointExplosions

      public Map<Integer,Integer> seriesPointExplosions(int seriesIndex)
      The explicit per-slice explosion overrides of a series (pie/doughnut), keyed by 0-based point index (ECMA-376 §21.2.2.62 dPt/explosion, percent of radius). Empty when no slice is exploded.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • titleAuto

      public boolean titleAuto()
      Whether the chart title is an Excel "auto" title — a <c:title> present with no explicit text, so the app derives it from the single series name. When true, title() is null and callers must not re-issue a literal title (that is what turns an auto title into a generic "Chart Title" placeholder on rebuild).
    • legendVisible

      public boolean legendVisible()
      Whether the legend is shown at all (independent of its position).
    • categoryAxisVisible

      public boolean categoryAxisVisible()
      Whether the category (X) axis is drawn. Defaults to true.
    • valueAxisVisible

      public boolean valueAxisVisible()
      Whether the value (Y) axis is drawn. Defaults to true.
    • valueAxisGridlines

      public boolean valueAxisGridlines()
      Whether the value (Y) axis draws major gridlines (<c:majorGridlines>). Defaults to true; an imported chart reports what its file says.
    • trendlines

      public List<Trendline> trendlines(int seriesIndex)
      The trendlines of a series, in file order; empty when none. A snapshot list.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • seriesDataLabels

      public DataLabels seriesDataLabels(int seriesIndex)
      The series-level data labels (<c:dLbls>), or null when the series carries none. Reproduce them on a rebuild via Chart.Builder.dataLabels(DataLabels) (ECMA-376 §21.2.2.49).
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • errorBars

      public ErrorBars errorBars(int seriesIndex)
      The error bars of a series, or null when it has none.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • isExtendedChart

      public boolean isExtendedChart()
      Whether this is a modern extended chart — the ISO/IEC 29500 Transitional cx: chart-extension schema (waterfall, funnel, histogram, treemap, sunburst, box & whisker, region map). Such a chart carries a byte-exact apparatus (its chartEx part plus the chartColorStyle / chartStyle parts) which Excel requires intact to open the file; re-issue it verbatim through Chart.Builder.extendedApparatus(java.lang.String, java.lang.String, java.lang.String) when rebuilding, since the structured builder fields cannot reconstruct it.
    • extendedChartExData

      public String extendedChartExData()
      Base64 of the source xl/charts/chartEx*.xml part for an extended chart, or null for a classic chart. Pass to Chart.Builder.extendedApparatus(java.lang.String, java.lang.String, java.lang.String).
    • extendedColorsData

      public String extendedColorsData()
      Base64 of the extended chart's chartColorStyle part, or null.
    • extendedStyleData

      public String extendedStyleData()
      Base64 of the extended chart's chartStyle part, or null.
    • setTitle

      public ChartView setTitle(String title)
      Sets a literal chart title, or removes it with null or an empty string. A non-empty title turns off the auto title (titleAuto()).
    • setLegend

      public ChartView setLegend(LegendPosition position)
      Moves the legend. LegendPosition.NONE hides it by marking it deleted; setLegendVisible(boolean) hides it without changing the position.
      Throws:
      NullPointerException - if position is null
    • setLegendVisible

      public ChartView setLegendVisible(boolean visible)
      Shows or hides the legend without changing its position. A hidden legend is saved by omitting the legend element, unlike setLegend(LegendPosition.NONE).
    • setCategoryAxisVisible

      public ChartView setCategoryAxisVisible(boolean visible)
      Shows or hides the category (X) axis; creates both axes when the chart has none.
    • setValueAxisVisible

      public ChartView setValueAxisVisible(boolean visible)
      Shows or hides the value (Y) axis; creates both axes when the chart has none.
    • setValueAxisGridlines

      public ChartView setValueAxisGridlines(boolean on)
      Shows or hides the major gridlines of the value (Y) axis; creates both axes when the chart has none.
    • setAutoTitle

      public ChartView setAutoTitle(boolean auto)
      Marks or unmarks the title as an Excel auto title. With true the literal title is removed and Excel shows the name of the single series.
    • setSeriesFill

      public ChartView setSeriesFill(int seriesIndex, Color fill)
      Sets the solid fill of one series, or removes it with null so the theme color applies. Only RGB colors are accepted; the alpha byte is ignored.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      IllegalStateException - if fill is a theme, indexed or automatic color
      AxyraException - if seriesIndex is out of range
    • setSeriesType

      public ChartView setSeriesType(int seriesIndex, String type)
      Move one series of a combo chart into the plot group of another type — the counterpart of Chart.Builder.seriesType(String).

      The series on one axis must share an axis kind, as on the builder: a "bar" or "scatter" series goes on an axis no other kind is on — move it to the secondary axis first.

      Parameters:
      seriesIndex - 0-based series index
      type - "column", "line", "area", "bar" or "scatter"
      Throws:
      AxyraException - if seriesIndex is out of range
      IllegalArgumentException - when type is none of those
      IllegalStateException - when the chart is not a combo, or when a series of another axis kind is on the same axis
    • setSeriesSecondaryAxis

      public ChartView setSeriesSecondaryAxis(int seriesIndex, boolean on)
      Plot one series of a combo chart against the secondary value axis (on) or the primary one — the counterpart of Chart.Builder.secondaryAxis(boolean).
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
      IllegalStateException - when the chart is not a combo, when the move would leave no series on the primary axis, or when a series of another axis kind (column/line/area, bar, scatter) is on the axis the series moves to
    • setShowDataLabels

      public ChartView setShowDataLabels(boolean show)
      Shows value labels on every series, or with false removes every data label from the chart, series and point labels included. The same as Excel's Data Labels > None. Setting the value the chart already reports changes nothing.
    • setThreeD

      public ChartView setThreeD(boolean threeD)
      Turns 3-D drawing on or off. Only bar, column, line, pie, area and surface charts have a 3-D form; other types ignore the flag when saved.
    • setGapWidth

      public ChartView setGapWidth(int percent)
      Sets the gap between bar or column clusters, as a percentage of one bar's width. Excel accepts 0–500.
      Throws:
      AxyraException - if percent is negative
    • setOverlap

      public ChartView setOverlap(int percent)
      Sets how much bars in one cluster overlap, as a percentage from -100 (a full bar-width gap) to 100 (full overlap).
    • setHoleSize

      public ChartView setHoleSize(int percent)
      Sets the doughnut hole size as a percentage of the outer radius. Has no effect on other chart types.
      Throws:
      AxyraException - if percent is negative
    • setCategoryAxisTitle

      public ChartView setCategoryAxisTitle(String title)
      Sets the category (X) axis title, or removes it with null or an empty string. Creates both axes when the chart has none.
    • setValueAxisTitle

      public ChartView setValueAxisTitle(String title)
      Sets the value (Y) axis title, or removes it with null or an empty string. Creates both axes when the chart has none.
    • setValueAxisScale

      public ChartView setValueAxisScale(double min, double max)
      Fixes the value (Y) axis to the range [min, max]. Creates both axes when the chart has none. This view cannot return the bounds to automatic scaling; rebuild the chart with Sheet.replaceChart(int, io.keikai.axyra.sheets.content.Chart) for that.
    • setAnchor

      public ChartView setAnchor(int fromRow, int fromColumn, int toRow, int toColumn)
      Moves or resizes the chart by setting its two-cell anchor (0-based). The bottom-right corner is at the top-left of cell (toRow, toColumn) plus the current anchorOffsets(), so with zero offsets that cell is not covered. Has no effect on a chart-sheet chart.
      Throws:
      AxyraException - if an index is negative
    • setSeries

      public ChartView setSeries(int seriesIndex, String name, String valuesRef, String categoriesRef)
      Replaces the references of one series. References are A1 strings such as "Sheet1!$B$2:$B$9". A null name or categoriesRef keeps the current value; it does not clear it.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • addTrendline

      public ChartView addTrendline(int seriesIndex, Trendline trendline)
      Adds a trendline to a series, after any it already has.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
      NullPointerException - if trendline is null
    • clearTrendlines

      public ChartView clearTrendlines(int seriesIndex)
      Removes every trendline from a series.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • setErrorBars

      public ChartView setErrorBars(int seriesIndex, ErrorBars errorBars)
      Sets the error bars of a series, replacing any it has, or removes them with null.
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
    • setSeriesDataLabels

      public ChartView setSeriesDataLabels(int seriesIndex, DataLabels labels)
      Sets the data labels of one series, or removes them with null. labels replaces the series' whole label block: the show flags, position, number format and text styling (rotation, textColor, bold, fontSize). A styling field left null inherits the chart default, so to change only what the labels show and keep their styling, start from seriesDataLabels(int).
      Parameters:
      seriesIndex - 0-based series index
      Throws:
      AxyraException - if seriesIndex is out of range
      IllegalStateException - if textColor is a theme, indexed or automatic color