Skip to content
Office Open

DOCX

Charts

Add charts to documents — column, line, pie, doughnut, radar, bubble and more

Embed charts in documents using the chart property inside a paragraph's children. Charts are configured with a flat options object — pass type, categories, and series directly.

#Basic Column Chart

JSON
{
  "sections": [
    {
      "children": [
        {
          "paragraph": {
            "children": [
              {
                "chart": {
                  "type": "column",
                  "categories": ["Q1", "Q2", "Q3", "Q4"],
                  "series": [{ "name": "Sales", "values": [10, 20, 15, 25] }],
                  "title": "Quarterly Sales",
                  "transformation": { "width": "13.2cm", "height": "7.9cm" }
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

#Chart Types

The type property selects the chart kind:

TypeValue
Column"column"
Bar"bar"
Line"line"
Pie"pie"
Area"area"
Scatter"scatter"
Doughnut"doughnut"
Radar"radar"
Bubble"bubble"
Stock"stock"
Surface"surface"

Set threeD: true to render column, bar, line, pie, or area as 3D variants.

#Multi-Series Chart

JSON
{
  "sections": [
    {
      "children": [
        {
          "paragraph": {
            "children": [
              {
                "chart": {
                  "type": "column",
                  "categories": ["Q1", "Q2", "Q3", "Q4"],
                  "series": [
                    { "name": "Product A", "values": [10, 20, 15, 25] },
                    { "name": "Product B", "values": [15, 10, 20, 30] }
                  ],
                  "transformation": { "width": "13.2cm", "height": "7.9cm" }
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

#Line Chart

JSON
{
  "sections": [
    {
      "children": [
        {
          "paragraph": {
            "children": [
              {
                "chart": {
                  "type": "line",
                  "categories": ["Jan", "Feb", "Mar", "Apr", "May"],
                  "series": [{ "name": "Revenue", "values": [100, 150, 200, 180, 250] }],
                  "transformation": { "width": "13.2cm", "height": "7.9cm" }
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

#Pie Chart

JSON
{
  "sections": [
    {
      "children": [
        {
          "paragraph": {
            "children": [
              {
                "chart": {
                  "type": "pie",
                  "categories": ["Desktop", "Mobile", "Tablet"],
                  "series": [{ "name": "Traffic", "values": [50, 35, 15] }],
                  "transformation": { "width": "10.6cm", "height": "7.9cm" }
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

#Scatter Chart

Scatter charts plot each category against its value (categories for the X axis, values for the Y axis):

JSON
{
  "sections": [
    {
      "children": [
        {
          "paragraph": {
            "children": [
              {
                "chart": {
                  "type": "scatter",
                  "series": [
                    {
                      "name": "Dataset 1",
                      "xValues": [1, 2, 3, 4, 5],
                      "yValues": [2, 4, 1, 5, 3]
                    }
                  ],
                  "transformation": { "width": "13.2cm", "height": "7.9cm" }
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

#Chart Options

OptionTypeDescription
typestringChart type (see table above)
categoriesstring[]Category labels
series{ name, values }[]Series data
transformation{ width, height }Display dimensions
titlestringChart title
showLegendbooleanShow legend (default: true)
stylenumberStyle preset (2–48)
threeDbooleanEnable 3D rendering
floatingobjectFloating positioning options