Create a new ChartBuilder for the given chart type.
The chart type (e.g., 'bar', 'line', 'pie', 'scatter').
Add a data series to the chart.
Unless opts sets them, the series' idx and order are given by ChartBuilder.build:
the series of this chart and then those of its ChartBuilder.secondaryChart are
numbered 0, 1, 2, … in the order they were added, skipping every value a caller set.
Series configuration including data references and styling.
this for chaining.
Set the anchor position (cell coordinates).
Top-left anchor cell (col, row, optional EMU offsets).
Bottom-right anchor cell (col, row, optional EMU offsets).
this for chaining.
Set bar direction. true = horizontal bars, false = vertical columns.
Whether bars are horizontal.
this for chaining.
Build the final chart data object ready for insertion into a worksheet.
Returns an independent deep copy; later builder calls do not affect it.
Every chart type except 'pie' and 'doughnut' has axes, and the OOXML schema
requires two axis ids for them. An axis that was not configured with
ChartBuilder.catAxis or ChartBuilder.valAxis is therefore filled with its
default in the returned model (category id 0, value id 1). Pie and doughnut charts keep
catAxis and valAxis as null. For scatter and bubble charts the category slot is
written as the bottom value axis. A ChartBuilder.secondaryChart gets no default
axes: it is drawn on this chart's (under a pie or doughnut primary, on the default axes
the writer adds).
Series without an explicit idx or order are numbered here, across this chart and then
its secondary chart (see ChartBuilder.addSeries).
A WorksheetChartData containing the chart model and anchor position.
Configure the category axis (axis id 0).
Optionalopts: AxisOptions
Axis title, scale, tick, and gridline options.
this for chaining.
Configure chart-level data labels.
Data label visibility options (showVal, showCatName, showPercent, etc.).
this for chaining.
Set the grouping mode (bar/column/line/area).
Grouping type: 'clustered', 'stacked', 'percentStacked', or 'standard'.
this for chaining.
Set doughnut hole size (an integer 1-90).
Hole size as a percentage of the chart radius.
this for chaining.
Configure the legend.
Legend position (default: 'bottom').
Whether the legend overlaps the plot area (default: false).
this for chaining.
Set the plot area manual layout (fractional 0.0-1.0).
Left offset as a fraction of chart width.
Top offset as a fraction of chart height.
Width as a fraction of chart width.
Height as a fraction of chart height.
this for chaining.
Set radar chart style.
Radar style: 'standard', 'marker', 'filled'.
this for chaining.
Set scatter chart style.
Scatter style: 'lineMarker', 'line', 'marker', 'smooth', 'smoothMarker'.
this for chaining.
Make this a combo chart: the chart secondary builds becomes
ChartDataModel.secondaryChart, a second chart-type element drawn on this chart's
axes (or on secondaryCatAxis / secondaryValAxis when they are set on the built model)
(under a pie or doughnut primary, on the default axes the writer adds).
Only its chart type, series and chart-type options (bar direction, grouping, scatter or
radar style, data labels, hole size) are written; its own axes, title, legend and anchor
are not.
secondary is read when ChartBuilder.build runs. Its series continue this chart's
numbering: with no idx or order set, a column chart with two series and a line chart
with one get 0 and 1, then 2. Excel refuses a chart whose series share an order.
The builder of the secondary chart. It must not have a secondary chart
of its own, or build() throws a RangeError.
this for chaining.
Enable showing the data table below the chart.
Whether to display the data table (default: true).
this for chaining.
Set the chart style ID (an integer 1-48, matches Excel built-in styles).
The style ID.
this for chaining.
Set the chart title.
The title text.
Optionalopts: { bold?: boolean; color?: string; fontSize?: number }
Optional formatting: bold, fontSize in hundredths of a point (1400 = 14pt,
written verbatim as DrawingML sz; the validated range is 100-400000) and color.
this for chaining.
Configure the value axis (axis id 1).
Optionalopts: AxisOptions
Axis title, scale, tick, and gridline options.
this for chaining.
Set 3D rotation settings.
Rotation angles and perspective options.
this for chaining.
Fluent builder for creating chart definitions.
Example