Generate dynamic charts into documents with 2 solutions:
native charts of Microsoft Word or LibreOffice: design and configure visualizations from your text editor
ECharts 5 charts as images: design and configure visualizations from your JSON data set
Learn how to create line charts in DOCX/PDF documents in Microsoft Word
The dataset below is used in a chart that represents the weather temperature during a short period.
Group temperatures history by dates (minimum, maximum, average) using the following dataset:
DOCX
template in Microsoft WordClick the Insert tab > Chart menu > Line > 2D Line to insert a line chart.
As soon as the chart is created, Microsoft Word opens an Excel spreadsheet to edit charts values.
Delete default values, and insert temperature values by looping through the temps
list.
After each loop expression that contains [i]
in the first row, use the expression [i+1]
in the next line.
Dynamic charts do not support only one [i+1]
for multiple [i]
expressions.
Generate the PDF
report, and the line chart is automatically filled.
In a template, insert a picture as a reference slot.
Place a tag in the alternative text of the picture {d.chartOptions:chart}
with the formatter :chart
. Without :chart
, the attribute {d.chartOptions}
is considered as an image.
Generate the PDF
report.
Build any type of chart, following the documentation below:
Provide the chart configuration within a JSON dataset. The dataset should include:
the chart format
numerical values
extra options
After configuring, the chart is injected as an SVG
image into the document. Refer to the for more details.
supported file formats: PDF
, ODT
, ODS
, ODP
, ODG
, DOCX
, XLSX
ODT
to DOCX
/ODT
/PDF
or ODS
to XLSX
/ODS
/PDF
DOCX
to DOCX
/ODT
/PDF
or XLSX
to XLSX
/ODS
/PDF
with the option "hardRefresh": true
, such as { "convertTo": "docx", "hardRefresh": true }
DOCX
to DOCX
or XLSX
to XLSX
without the option "hardRefresh": true
translations are supported: cs
, de
, en
, es
, fi
, fr
, it
, ja
, ko
, pl
, pt-br
, ro
, ru
, si
, th
, zh
chart configuration doesn't support external dependencies (maps, JS scripts)
chart styling (titles, colors, captions, etc.) can only be defined within the JSON dataset
the generated chart is an image, so it's not possible to edit the styling within the template, unlike
Create pie charts in ODT documents in LibreOffice
The dataset below is used in a chart that represents the quantity of cheese purchased by french households in 2019.
Group values by cheese types using the following dataset:
ODT
template in LibreOfficeClick the Home tab > Chart button. A column chart appears. Change the chart format by clicking the chart type button from the chart toolbar.
Insert the data dynamically using a loop
and the bindChart
formatter: Click Data Table from the chart toolbar. A popup appears to edit chart values.
The following is not different than Microsoft Word. It's not possible to insert tag {d.value}
inside table cells, except in the first column Categories
.
So you write the category name, then add bindChart
tags. The {bindChart}
formatter is used to bind a variable to a reference tag in the table cell, i.e., "the value X
in the chart must be replaced by the tag Y
."
jn the first cell, the following expression is written: {d.cheeses[i].type} {bindChart(3)=d.cheeses[i].purchasedTonnes}
the cheese type is printed with {d.cheeses[i].type}
, then bindChart
is used to bind the variable d.cheeses[i].purchasedTonnes
to the cell that has the value 3
this means: the purchasedTonnes
value is printed instead of 3
in the first cell of the second row, the expression {d.cheeses[i+1].type} {bindChart(4)=d.cheeses[i+1].purchasedTonnes}
is written
the bindChart
replaces the 4
value by the d.cheeses[i+1].purchasedTonnes
variable
Generate the PDF
report, and the pie chart is automatically filled.
Native charts define how to create graphical visualizations from numerical data within your text editor. The format defines:
the dataset to be used for the visual display and
several different types of graphical displays
such as line charts, pie charts, etc.
The following 2 docs contain examples how to create a pie chart within an ODT
document and a line chart within a DOCX
/PDF
document, respectively:
supported file formats: DOCX
, ODT
, PDF
. DOCX
/ODT
templates can generate DOCX
/ODT
/PDF
documents
create charts only from your text editor (Microsoft Word or LibreOffice); insert the data series in the XLSX
/ODS
sheet provided by your text editor
charts cannot be copy-pasted from an external XLSX
/ODS
file
external spreadsheets cannot be linked as dynamic series of data
in LibreOffice, the {bindChart()}
tag is required
learn more in
chart styling (titles, colors, captions, etc.) can only be defined within the text editor
styling from a JSON dataset cannot be edited, unlike
Design your JSON dataset by adding an object named chartOptions
. The object must contain and your data.
Use the following configuration for a :
Format | Types | Supported |
---|
Format | Types | Supported |
---|
2D/3D Column |
|
2D/3D Bar |
|
2D/3D Line |
|
2D/3D Area |
|
2D/3D Pie |
|
2D/3D Pie |
|
Doughtnut |
|
Combo |
|
Hierarchi |
|
Statistical |
|
Waterfall |
|
Scatter |
|
Map |
|
Column |
|
Bar |
|
Pie |
|
Area |
|
Line |
|
Scatter |
|
Net |
|
Column and Line |
|
Stock |
|
Bubble |
|