MkDocs plugin to add charts from data
Project description
mkdocs-charts-plugin
MkDocs plugin to create plots from data using the declarative vegalite syntax.
This makes it easier to build reproducible reports.
Installation
Install the plugin using pip3:
pip3 install mkdocs-charts-plugin
Next, add the following lines to your mkdocs.yml:
plugins:
- search
- charts
extra_javascript:
- https://cdn.jsdelivr.net/npm/vega@5
- https://cdn.jsdelivr.net/npm/vega-lite@5
- https://cdn.jsdelivr.net/npm/vega-embed@6
markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: vegalite
class: vegalite
format: !!python/name:mkdocs_charts_plugin.fences.fence_vegalite
If you have no
pluginsentry in your config file yet, you'll likely also want to add thesearchplugin. MkDocs enables it by default if there is nopluginsentry set.
Usage
You can insert any valid vegalite JSON into a markdown file using:
```vegalite
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43},
{"a": "D", "b": 91}, {"a": "E", "b": 81}, {"a": "F", "b": 53},
{"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52}
]
},
"mark": "bar",
"encoding": {
"x": {"field": "a", "type": "nominal", "axis": {"labelAngle": 0}},
"y": {"field": "b", "type": "quantitative"}
}
}
```
Options
vega_width(default iscontainer). When not specified explicitly in the JSON schema, thewidthto use (see vegalite customizing size). When set tocontainerwidth will be 100%.vega_theme(default isdefault). Specify one of the available vegalite themesvega_renderer(default issvg). Specify one of the available vegalite renderersuse_data_path(default isTrue). WhenTrue, any relative urls used in the JSON schema are relative to thedata_path. WhenFalse, relative urls should be relative to the URL of the page.data_path(default is""). Whenuse_data_pathis enabled, the base path relative to thedocs/folder.
More
- promote the plugin
- blogpost, twitter
- plugin wiki
- refer to it from table-reader
- add to demo in print-site
Credits
https://github.com/koaning/justcharts https://facelessuser.github.io/pymdown-extensions/extras/mermaid/ https://vega.github.io/vega-lite/docs/config.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mkdocs-charts-plugin-0.0.2.tar.gz.
File metadata
- Download URL: mkdocs-charts-plugin-0.0.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
565173f5cad2e33a1e28c4f43880bb5eac1e7af5c34c9e15d1b4dd3a4bada44b
|
|
| MD5 |
357ad2d7ad85da4ed4b00e9cb3cdaa5f
|
|
| BLAKE2b-256 |
55d95dbffbb19c984aa162a5acc0aed71ec592a1c4c256acbe2d0c3e5a8ce722
|
File details
Details for the file mkdocs_charts_plugin-0.0.2-py3-none-any.whl.
File metadata
- Download URL: mkdocs_charts_plugin-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
694edb80fc7a62d071f56d4f53f1cc71f716743e8a23ae15169aeb9081c4fb8c
|
|
| MD5 |
dc928294aaff640b299c5eddab5f87cc
|
|
| BLAKE2b-256 |
dd81074173ea5799819b15239d1be9638c2a6339218dd5d016172c8001dbd9b5
|