On this page
Charts and mind maps#
Two more fences draw pictures from text. Like diagrams, their scripts ship with Sumi and load only when a chart or mind map is about to scroll into view.
Charts#
An echarts fence holds an Apache ECharts option, written in YAML or JSON. Sumi checks it when the site is built: a fence that is not valid YAML or JSON is left as a code block and the build prints a warning.
```echarts title="Build time for 1 000 pages (seconds)"
xAxis:
type: category
data: [MkDocs 1.6, MkDocs NG, NG + Sumi]
yAxis:
type: value
series:
- type: bar
data: [18.1, 8.4, 12.0]
```
xAxis:
type: category
data: [MkDocs 1.6, MkDocs NG, NG + Sumi]
yAxis:
type: value
series:
- type: bar
data: [18.1, 8.4, 12.0]Charts use the site's accent colour first, follow the colour scheme, and redraw when the page is resized. Set height on the fence to change the height in pixels (the default is 360):
```echarts height="240"
series:
- type: pie
radius: ["45%", "70%"]
data:
- {name: Markdown, value: 60}
- {name: Templates, value: 15}
- {name: Search index, value: 16}
- {name: Other, value: 9}
```
tooltip: {}
series:
- type: pie
radius: ["45%", "70%"]
data:
- {name: Markdown, value: 60}
- {name: Templates, value: 15}
- {name: Search index, value: 16}
- {name: Other, value: 9}Without JavaScript, and in the Markdown copy of the page, readers see the YAML source.
Note
Options are data, not code: functions such as custom formatter callbacks cannot be written in YAML or JSON. Use template strings like formatter: "{b}: {c}" instead.
Mind maps#
A markmap fence draws a mind map from headings and nested lists. Click a node to fold or unfold its branch; drag to pan and scroll to zoom.
```markmap height="360"
# Sumi
## Write
- Callouts
- Tabs and steps
- Diagrams and charts
## Publish
- Landing page
- Blog
- Releases
## Read
- ⌘K search
- Dark mode
- Print edition
```
Sumi
- Write
- Callouts
- Tabs and steps
- Diagrams and charts
- Publish
- Landing page
- Blog
- Releases
- Read
- ⌘K search
- Dark mode
- Print edition
The outline is turned into a tree when the site is built. Without JavaScript, in print and in the Markdown copy, readers see it as a nested list.
Turning them off#
If another plugin already handles echarts or markmap fences, switch Sumi's handling off:
plugins:
- sumi:
echarts: false
markmap: false