Design

Charts

Build charts in Word, PowerPoint or LibreOffice and fill them with JSON data, or generate them as SVG images with Apache ECharts.
ENTERPRISE FEATURE Available for:
Carbone Cloud
Carbone On-premise
Embedded Carbone JS
  v4.0+ 

Overview

Generate dynamic charts in documents using two solutions:

The second solution is more powerful but requires a specific JSON structure.

Native Charts

This method is straightforward, like most other features:

Important Notes:

Compatible with ODT, DOCX, ODP, PPTX, and PDF files. Limited compatibility with XLSX and ODS files.

List of supported charts

In Microsoft Office:

Format Types Supported
2D/3D Column clustered, stacked, percent stacked
2D/3D Bar clustered, stacked, percent stacked
2D/3D Line line, stacked, percent stacked, line with markers, stacked line with markers, percent stacked line with markers
2D/3D Area area, stacked, percent stacked
2D/3D Pie pie
2D/3D Pie pie of pie, bar of pie
Doughnut doughnut
Combo clustered column/line, stacked area
Hierarchy sunburst chart, treemap chart
Statistical histogram, box and whisker
Waterfall waterfall, funnel, stock, surface, radar
Scatter scatter, bubbles
Map map

In LibreOffice:

Format Types Supported
Column normal, stacked, percent stacked
Bar normal, stacked, percent stacked
Pie normal, exploded, donut, exploded donut
Area normal, stacked, percent stacked
Line point only, points and lines, lines only, 3D lines
Scatter point only, points and lines, lines only, 3D lines
Net point only, points and lines, lines only, filled
Column and Line normal, stacked
Stock 1, 2, 3, 4
Bubble normal

DOCX Example

In Word, insert a chart (Insert > Chart), right-click it and choose Edit Data. Delete the default values and write the tags in the data sheet: {d.months[i].name} and {d.months[i].revenue} on row 2, {d.months[i+1].name} and {d.months[i+1].revenue} on row 3.

Every column with an [i] cell needs its own [i+1] cell on the next row: one [i+1] cannot serve several [i] columns. Carbone keeps the chart type, colors and labels, and draws all the items. Generate a DOCX or a PDF.

data.jsonDownload
{
  "period": "July to December 2026",
  "total": 1298050,
  "months": [
    { "name": "Jul", "revenue": 182400 },
    { "name": "Aug", "revenue": 196750 },
    { "name": "Sep", "revenue": 204300 },
    { "name": "Oct", "revenue": 221900 },
    { "name": "Nov", "revenue": 238600 },
    { "name": "Dec", "revenue": 254100 }
  ]
}
template.docxDownload
DOCX template with a Word column chart whose data sheet contains Carbone tags

Text of template.docx

Revenue report

{d.period}

Total revenue

{d.total:formatC(0)}

Revenue by month

report.docxDownload
Word report with a column chart of the revenue by month

Text of report.docx

Revenue report

July to December 2026

Total revenue

$1,298,050

Revenue by month

The monthly treasury FX report draws a line chart on a date axis and a column chart of the monthly averages.

ODT Example

In LibreOffice, insert a chart (Insert > Chart) and pick its type with the Chart Type button. Double-click the chart and open View > Data Table.

A numeric cell cannot hold a tag, but a category cell can. Write the category tag in the first column, followed by one {bindChart(700)=d.regions[i].sales} per series: it replaces the cell that holds the number 700 with the tag. Use a different number for every bound cell, and repeat the row with [i+1].

data.jsonDownload
{
  "period": "Q3 2026",
  "regions": [
    { "name": "North America", "sales": 842, "target": 800 },
    { "name": "Europe", "sales": 615, "target": 640 },
    { "name": "Asia Pacific", "sales": 478, "target": 450 },
    { "name": "Latin America", "sales": 236, "target": 260 },
    { "name": "Africa", "sales": 164, "target": 150 }
  ]
}
template.odtDownload
ODT template with a LibreOffice column chart whose data table binds Carbone tags with bindChart

Text of template.odt

SALES REVIEW

Regional sales

{d.period}

SALES VS TARGET BY REGION, IN $ THOUSANDS

report.odtDownload
LibreOffice column chart of the sales and target of five regions

Text of report.odt

SALES REVIEW

Regional sales

Q3 2026

SALES VS TARGET BY REGION, IN $ THOUSANDS

XLSX Example

In an XLSX template, a native chart draws the cells that a loop fills.

  1. Write the loop in the cells, with :formatN on the values so that Carbone writes real numbers that the chart can draw.
  2. Point the series of the chart to the cells of the loop (B4:B5 here). The chart covers every generated row.
  3. PRE-RELEASE v5.18.0+ Add {o.preReleaseFeatureIn=5018000} to the template: without it, the chart does not follow the rows added by the loop.
data.jsonDownload
{
  "title": "Website visitors, 2025",
  "subtitle": "Unique visitors per month",
  "months": [
    {"name": "Jan", "visitors": 25390},
    {"name": "Feb", "visitors": 24470},
    {"name": "Mar", "visitors": 27180},
    {"name": "Apr", "visitors": 28650},
    {"name": "May", "visitors": 30240},
    {"name": "Jun", "visitors": 31560},
    {"name": "Jul", "visitors": 29820},
    {"name": "Aug", "visitors": 30970},
    {"name": "Sep", "visitors": 33410},
    {"name": "Oct", "visitors": 35280},
    {"name": "Nov", "visitors": 36540},
    {"name": "Dec", "visitors": 34890}
  ]
}
template.xlsxDownload
XLSX template with a line chart on the cells of a row loop
Cells of the first sheet of template.xlsx
RowAB
1{d.title}
2{d.subtitle}{o.preReleaseFeatureIn=5018000}
3MONTHVISITORS
4{d.months[i].name}{d.months[i].visitors:formatN}
5{d.months[i+1].name}
report.xlsxDownload
Excel line chart showing the 12 months generated by Carbone
Cells of the first sheet of report.xlsx
RowAB
1Website visitors, 2025
2Unique visitors per month
3MONTHVISITORS
4Jan25390
5Feb24470
6Mar27180
7Apr28650
8May30240
9Jun31560
10Jul29820
11Aug30970
12Sep33410
13Oct35280
14Nov36540
15Dec34890

Place the chart above or beside the loop: it stays in place. Learn more about charts in XLSX templates.

Advanced Echarts

Carbone embeds Apache Echarts: a rich, elegant, and powerful visualization library.

A chart configuration must be provided within your JSON dataset. This configuration should include the chart format, numerical values, and additional options. Carbone will inject the chart as an SVG image into the document.

Important Notes:

Compatible with all documents that support SVG images: ODT, ODS, ODP, ODG, DOCX, PPTX, XLSX, HTML, and PDF files.

ECharts offers a wide range of options, so we may not be able to answer all questions about your chart configuration through our chat support.

Supported Echarts version :

DOCX Echart Example

Insert a picture in the template as a placeholder, and write {d.chartOptions:chart} in its alternative text. Without the :chart formatter, Carbone reads the attribute as an image.

data.jsonDownload
{
  "period": "First half 2026",
  "chartOptions": {
    "type": "echarts@v5a",
    "width": 700,
    "height": 300,
    "option": {
      "color": ["#635bff", "#0a2540"],
      "textStyle": { "fontFamily": "Helvetica Neue, Arial, sans-serif", "color": "#697386" },
      "legend": { "top": 0, "right": 0, "icon": "roundRect", "itemWidth": 10, "itemHeight": 10 },
      "grid": { "top": 40, "left": 8, "right": 8, "bottom": 8, "containLabel": true },
      "xAxis": {
        "type": "category",
        "data": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
        "axisTick": { "show": false },
        "axisLine": { "lineStyle": { "color": "#e3e8ee" } }
      },
      "yAxis": {
        "type": "value",
        "min": 0,
        "max": 300,
        "interval": 100,
        "axisLabel": { "formatter": "${value}k" },
        "splitLine": { "lineStyle": { "color": "#e3e8ee" } }
      },
      "series": [
        { "name": "Sales", "type": "bar", "barWidth": 36, "data": [182, 196, 214, 208, 231, 247] },
        { "name": "Target", "type": "line", "symbolSize": 7, "lineStyle": { "width": 2 }, "data": [190, 195, 205, 215, 225, 240] }
      ]
    }
  }
}
template.docxDownload
DOCX template with a placeholder picture whose alternative text is the :chart tag

Text of template.docx

Sales review

{d.period}

Sales vs target by month

[Picture: {d.chartOptions:chart}]

report.docxDownload
Word report with an ECharts bar and line chart generated from the JSON data

Text of report.docx

Sales review

First half 2026

Sales vs target by month

[Picture]

The JSON holds the chart configuration, here under chartOptions:

{
  "chartOptions": {
    "type": "echarts@v5a",
    "width": 700,
    "height": 300,
    "theme": null,
    "option": { }
  }
}

If you hit a limit, contact us on the chat.

HTML Echart Example

In an HTML template, write the :chart formatter in the src of an image: <img src="{d.chartOptions:chart}">. Carbone replaces it with the chart as an SVG image. The JSON configuration is the one described in the DOCX example.

To get a PDF, add {o.converter=C} in the <body>: Chromium draws the SVG like a browser. The width and height of the configuration set the size of the image. Use the width and height attributes or the CSS of the <img> to scale it in the page: width: 100%; height: auto keeps its proportions.

data.jsonDownload
{
  "period": "First half 2026",
  "total": 1278000,
  "chartOptions": {
    "type": "echarts@v5a",
    "width": 700,
    "height": 300,
    "option": {
      "color": ["#635bff"],
      "textStyle": { "fontFamily": "Helvetica Neue, Arial, sans-serif", "color": "#697386" },
      "grid": { "top": 24, "left": 8, "right": 8, "bottom": 8, "containLabel": true },
      "xAxis": {
        "type": "category",
        "data": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
        "axisTick": { "show": false },
        "axisLine": { "lineStyle": { "color": "#e3e8ee" } }
      },
      "yAxis": {
        "type": "value",
        "min": 0,
        "max": 300,
        "interval": 100,
        "axisLabel": { "formatter": "${value}k" },
        "splitLine": { "lineStyle": { "color": "#e3e8ee" } }
      },
      "series": [
        { "type": "bar", "barWidth": 40, "data": [182, 196, 214, 208, 231, 247],
          "label": { "show": true, "position": "top", "color": "#0a2540" } }
      ]
    }
  }
}
template.htmlDownload
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Sales report</title>
  <style>
    @page { size: A4; margin: 0; }
    body { margin: 0; padding: 48px; font-family: "Helvetica Neue", Arial, sans-serif; color: #0a2540; }
    h1 { margin: 0 0 4px; font-size: 26px; }
    .period { margin: 0 0 32px; color: #697386; }
    .label { margin: 0 0 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #697386; }
    .total { margin: 0 0 32px; font-size: 22px; font-weight: 700; }
    img { display: block; width: 100%; height: auto; }
  </style>
</head>
<body>
  <h1>Sales report</h1>
  <p class="period">{d.period}</p>
  <p class="label">Total sales</p>
  <p class="total">${d.total:formatN(0)}</p>
  <p class="label">Sales by month</p>
  <img src="{d.chartOptions:chart}" alt="Sales by month">
  {o.converter=C}
</body>
</html>
report.pdfDownload
PDF sales report with an ECharts column chart generated by Carbone

See the multi-page annual report with ECharts charts example.