Charts

To dynamically insert a chart in the document, add the chart as placeholder and edit the chart and excel data.

How It Works

To insert a chart in the document, add the chart as a placeholder in the document template. The chart placeholder is transformed into a chart in the output document by providing the chart data in the input JSON data. The following types of graphs are supported:

Steps to add chart in the document:

Edit chart data in Excel

data-slots=text
Include only the chart data in the Excel sheet, omitting any additional text.

Line Chart

Steps to insert a line chart in the document:

Placeholder for line chart

Edit chart data in Excel

JSON representation of the input data:

{
  "Title": "Sales Data",
  "sales": [
    {
      "quarter": "Q1",
      "phone": 3800,
      "tablet": 2450
    },
    {
      "quarter": "Q2",
      "phone": 4300,
      "tablet": 2700
    },
    {
      "quarter": "Q3",
      "phone": 5100,
      "tablet": 3150
    },
    {
      "quarter": "Q4",
      "phone": 6000,
      "tablet": 3600
    }
  ]
}

Output chart in document after processing.

Output of line chart in document

Column Chart

Steps to insert a column chart in the document:

Placeholder for column chart

Edit chart data in Excel

JSON representation of the input data:

{
  "Title": "Vehicle Sales Data",
  "sales": [
    {
      "month": "July",
      "EV": 700000,
      "ICE": 1500000
    },
    {
      "month": "August",
      "EV": 750000,
      "ICE": 1450000
    },
    {
      "month": "September",
      "EV": 800000,
      "ICE": 1400000
    },
    {
      "month": "October",
      "EV": 850000,
      "ICE": 1350000
    }
  ]
}

Output chart in document after processing.

Output of line chart in document

Pie Chart

Steps to insert a pie chart in the document:

Placeholder for pie chart

Edit chart data in Excel

JSON representation of the input data:

{
  "Title": "Car Sales by Quarters",
  "carSales": [
    {
      "quarter": "1st Qtr",
      "value": 1500
    },
    {
      "quarter": "2nd Qtr",
      "value": 2000
    },
    {
      "quarter": "3rd Qtr",
      "value": 1800
    },
    {
      "quarter": "4th Qtr",
      "value": 2200
    }
  ]
}

Output chart in document after processing.

Output of pie chart in document

data-slots=text
  • Do not use charts within repeating section tags.
  • Ensure that the chart data in Excel starts from the first cell (A1).