Skip to main content

MkDocs plugin to add charts from data

Project description

Actions Status PyPI - Python Version PyPI PyPI - Downloads GitHub contributors PyPI - License

mkdocs-charts-plugin

MkDocs plugin to create plots from data using the declarative vegalite syntax. This makes it easier to build reproducible reports with MkDocs.

👉 See it in action on the demo page

Includes supports for mkdocs-material theme features like instant loading and dark color themes.

Do checkout the other charting plugins for mkdocs that might suit your specific use-case better.

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 plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry 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"}
  }
}
```

See the vegalite editor for a range of examples you could copy-paste into your mkdocs site

Documentation

See the documentation timvink.github.io/mkdocs-charts-plugin for examples, use cases and options.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_charts_plugin-0.0.11.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_charts_plugin-0.0.11-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_charts_plugin-0.0.11.tar.gz.

File metadata

  • Download URL: mkdocs_charts_plugin-0.0.11.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for mkdocs_charts_plugin-0.0.11.tar.gz
Algorithm Hash digest
SHA256 d82e34f9933ea4537c34386c242765b7b721bfd6cb0ffd2bd881c1e554738ee6
MD5 c3bc52fbc32ebdafd76e0d18e7374507
BLAKE2b-256 2ec66c03fd186c8899a635567118faa66d2340ae4faa3e82714d6f876e025db4

See more details on using hashes here.

File details

Details for the file mkdocs_charts_plugin-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_charts_plugin-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 875844599c2cf9d552ffffbde82e5ee25469d4665eefd3db5d2dcf6eadff6e99
MD5 1cf174ad5086412c410c6dcb0fdd61c6
BLAKE2b-256 9de4c8d0574f5f0282e5c93ae8269ec199148db9436fa9d7a30b265b6e5e195a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page