Chart representations
DocSlicer always extracts charts as structured datapoints — series, categories, and values — available on result.charts. But when a chart lands inside a chunk or block, its text has to be serialised to a string so it can be embedded or fed to a model. The table_representation parameter controls that serialisation.
result = docslicer.parse_document(
"deck.pptx",
table_representation="markdown", # "markdown" (default) | "melted" | "jsonl"
)There is no separate chart_representation — charts and tables share the one setting, so a document's tabular content serialises consistently whichever shape it arrived in. The structured points on result.charts are unaffected — they're always there regardless of which representation you pick.
Charts are extracted from DOCX and PPTX only. Those formats carry the chart's underlying data cache inside the file. Charts in PDFs are not extracted.
The example chart
Each format below serialises the same source chart — a three-series line chart of Australian overnight visitor expenditure, with eleven categories on the x-axis:
To a parser that treats charts as images, this is a picture: at best you get a caption, and the eleven-by-three grid of numbers behind it is gone. DocSlicer reads the data cache the authoring tool embedded, so every plotted value survives into the chunk text as something a model can actually quote.
If the chart has a title, it's emitted as a plain line above the data in all three formats.
markdown (default)
A grid with categories as rows and series as columns — the same shape you'd get if the chart had been pasted in as a table. It's the most human-readable and the safest general-purpose choice for RAG:
| Category | NSW | QLD | VIC |
| ------------- | ------ | ------ | ------ |
| YE March 2013 | 20.306 | 17.657 | 14.655 |
| YE March 2014 | 21.973 | 17.421 | 15.289 |
| YE March 2015 | 22.694 | 18.4 | 16.631 |
| YE March 2016 | 24.928 | 19.4 | 17.954 |
| YE March 2017 | 26.279 | 20.31 | 19.787 |
| YE March 2018 | 29.924 | 21.668 | 21.829 |
| YE March 2019 | 32.883 | 24.47 | 24.079 |
| YE March 2020 | 32.734 | 24.643 | 24.897 |
| YE March 2021 | 14.842 | 12.166 | 6.559 |
| YE March 2022 | 18.046 | 18.281 | 11.666 |
| YE March 2023 | 37.049 | 32.885 | 26.432 |Series appear in plot order, categories in the order they were plotted. A missing point — a series that skips a category — leaves an empty cell rather than shifting the row.
Values are written using the number format the chart's author set, not the raw cached float and not the axis's tick rounding ($20b). Office files store both a full-precision value and a format code for the series — a point cached as 21.972999999999999 under a format code like _-"$"* #,##0.0_-;\-"$"* #,##0.0_-;_-"$"* "-"??_-;_-@_- is emitted as 21.97. The serialised text therefore matches the number a reader sees on the slide, rather than a float tail that would waste tokens and read as false precision.
The unit itself usually lives in the axis title, which is on the Chart object as axis_y_title rather than inside the serialised text.
melted
One line per datapoint, reading series | category | value. Because every value sits next to its series and its category on its own line, this format is good for charts with many series or sparse categories, where retrieving an individual datapoint matters:
NSW | YE March 2013 | 20.306
NSW | YE March 2014 | 21.973
NSW | YE March 2015 | 22.694
NSW | YE March 2016 | 24.928
NSW | YE March 2017 | 26.279
NSW | YE March 2018 | 29.924
NSW | YE March 2019 | 32.883
NSW | YE March 2020 | 32.734
NSW | YE March 2021 | 14.842
NSW | YE March 2022 | 18.046
NSW | YE March 2023 | 37.049
QLD | YE March 2013 | 17.657
QLD | YE March 2014 | 17.421
...
VIC | YE March 2022 | 11.666
VIC | YE March 2023 | 26.432Lines are grouped by series and ordered by plot position within each one. This is the most verbose of the three — one line per point, with the series name repeated — so it costs the most tokens on a dense chart.
jsonl
One JSON object per series, keyed by category. Useful when chunks are fed into structured extraction or tool-use pipelines that parse JSON rather than free text:
{"Series": "NSW", "YE March 2013": "20.306", "YE March 2014": "21.973", "YE March 2015": "22.694", "YE March 2016": "24.928", "YE March 2017": "26.279", "YE March 2018": "29.924", "YE March 2019": "32.883", "YE March 2020": "32.734", "YE March 2021": "14.842", "YE March 2022": "18.046", "YE March 2023": "37.049"}
{"Series": "QLD", "YE March 2013": "17.657", "YE March 2014": "17.421", "YE March 2015": "18.4", "YE March 2016": "19.4", "YE March 2017": "20.31", "YE March 2018": "21.668", "YE March 2019": "24.47", "YE March 2020": "24.643", "YE March 2021": "12.166", "YE March 2022": "18.281", "YE March 2023": "32.885"}
{"Series": "VIC", "YE March 2013": "14.655", "YE March 2014": "15.289", "YE March 2015": "16.631", "YE March 2016": "17.954", "YE March 2017": "19.787", "YE March 2018": "21.829", "YE March 2019": "24.079", "YE March 2020": "24.897", "YE March 2021": "6.559", "YE March 2022": "11.666", "YE March 2023": "26.432"}The series name goes under the Series key; every other key is a category label. Note this is the transpose of the table jsonl format — a chart's rows are its series, not its categories.
Pie and doughnut charts
For pieChart and doughnutChart, each point's share of the series total is appended in parentheses after the value, in all three formats:
Share of revenue | Subscriptions | 4.2 (0.62)
Share of revenue | Services | 1.8 (0.27)
Share of revenue | Hardware | 0.75 (0.11)The percentage is only added when it differs from the value itself — a chart whose cached values are percentages isn't doubled up.
Choosing a format
| Format | Shape | Tends to suit |
|---|---|---|
markdown | Category × series grid | Human-readable output and general-purpose RAG — a safe default. |
melted | One fact per row (series | category | value) | Many-series or sparse charts, where keeping each value next to its series and category may help single-point retrieval. |
jsonl | One JSON object per series | Feeding chunks into structured-extraction or tool-use pipelines that parse JSON. |
These are starting points, not hard rules — the best format depends on your documents, embedding model, and downstream task. Run an eval on your own corpus to see what actually works best for you; the right choice is whichever measurably improves retrieval or extraction on your data.
The choice only affects the text representation of charts inside chunks and blocks. For the structured Chart object — series, datapoints, axis titles, and per-point fields — see Chart. The same setting governs tables; see Table representations. For where chart blocks sit in the chunking pipeline, see Chunking and Blocks.