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.
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 Create dynamic reports in LibreOffice
chart styling (titles, colors, captions, etc.) can only be defined within the text editor
styling from a JSON dataset cannot be edited, unlike ECharts 5 charts
Format | Types | Supported |
---|---|---|
Format | Types | Supported |
---|---|---|
2D/3D Column
clustured
, stacked
, percent stacked
2D/3D Bar
clustured
, 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
Doughtnut
Doughtnut
Combo
Clustured Column/Line
, Stacked Area
Hierarchi
sunburst chart
, treemap chart
Statistical
histogram
, box and whisker
Waterfall
waterfall
, funnel
, stock
, surface
, radar
Scatter
scatter
, bubbles
Map
Map
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
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.