Skip to main content

Chart Blocks

Use a chart block when the template slide contains a bar or column chart region and your request needs to provide chart data. The template supplies placement and default styling. The payload supplies categories, series, chart type, and optional formatting overrides.

Basic Shape

Inside slide_data.content.blocks, a chart block looks like this:
Each series must have one value per category.

Supported Chart Types

Chart blocks support bar and column charts only. If you omit chart_type, generation preserves the template chart type where supported. Pie, line, area, scatter, combo, and other arbitrary PowerPoint chart types are not part of the supported chart block API.

Categories and Series

categories defines the labels along the category axis. For column charts, categories appear on the X-axis. For bar charts, categories appear on the Y-axis. series defines the plotted values. Each series has a name, a values array, and an optional color.
If a series color is omitted, the renderer uses the template or default chart colors.

Titles, Legends, and Axes

Chart blocks can specify the chart title, legend, value axis, and category axis.
Legend positions are bottom, left, right, top, and top_right. Axis fields include visible, title, title_format, label_format, label_rotation, wrap_labels, wrap_max_chars, number_format, min_value, and max_value. Both axes accept a title; the wrap fields apply to the category axis only.

Wrapped Category Labels

Set wrap_labels: true on category_axis to break long category labels across lines at word boundaries instead of rotating them.
The line width comes from the category slot width for column charts, or from a capped label band left of the plot for bar charts. If a column-chart label cannot fit the automatic line budget, generation falls back to rotated labels. wrap_max_chars caps the characters per line explicitly. It implies wrap_labels and is always honored, with no rotation fallback:
Breaks fall at word boundaries; a single word longer than the limit stays whole. Labels that already contain \n keep their breaks as written. Neither option can be combined with a non-zero label_rotation — wrapped labels stay horizontal.

Bar Labels

Set show_bar_labels: true to add auto-calculated labels to stacked bars or columns. Labels are calculated from the chart series values; bar_label_mode controls what they show.
  • bar_label_mode: "total" (default) labels each bar with the sum of its series values.
  • bar_label_mode: "percent" labels each bar with that sum as a share of the grand total across all bars: bars totaling 50/30/20 are labeled 50%, 30%, 20%. Percent mode expects raw counts — values already normalized per bar (every bar summing to 100) give every bar the same share.
  • bar_label_decimals (0–4) fixes the decimal places in either mode. If unset, whole values are shown as integers and fractional values with one decimal.
Bar labels apply to stacked_column, stacked_bar, percent_stacked_column, and percent_stacked_bar.

Data Rows

Use data_rows to add a small data table beneath the chart. These values are part of the input payload; the API positions and formats the rows, but it does not derive values like n= or NPS from the chart series.
Providing data_rows automatically enables the chart data table. If data_table_header_column is true, the first value in each row is treated as a row label.

Complete Example

The visual example below is generated from the complete payload above. It shows the API-added total labels above each stacked column and the aligned data rows beneath the chart.
Template slide with a placeholder chart before chart data is generated.

Template chart slide

Generated stacked column chart with total labels above each column and data rows aligned beneath the chart.

Generated chart slide

Updating Charts Later

Use chart blocks when you are generating a supported bar or column chart slide from a template. Use Chart Updates when a .pptx already exists and you only need to refresh the chart data. Chart updates are useful when:
  • New data arrives after the deck was generated
  • A user manually edited the deck in PowerPoint and you want to preserve those edits
  • You want to keep chart formatting, colors, legends, axes, bar labels, and data-row positioning while replacing the underlying numbers
For updates, send data fields such as categories, series, data_rows, and data_table_header_column. Omit styling fields such as chart_type, title, legend, and axes when you want the existing chart formatting preserved. Bar labels are recalculated from the new values in the chart’s existing mode — totals stay totals and percent labels stay percentages.

Presentation Generation

Generate one slide or a full deck.

Table Blocks

Author table rows and formatting.

Text Blocks

Author slide text and text sections.