Skip to main content

Docums plugin to add charts from data

Project description

docums-charts-plugin

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

đŸ‘‰ See it in action on the demo page

Includes supports for docurial theme features like instant loading and dark color themes.

Installation

Install the plugin using pip3:

pip3 install docums-charts-plugin

Next, add the following lines to your docums.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:docums_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. Docums 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 docums site

Documentation

See the documentation khanhduy1407.github.io/docums-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

docums-charts-plugin-0.0.6.tar.gz (7.5 kB view details)

Uploaded Source

File details

Details for the file docums-charts-plugin-0.0.6.tar.gz.

File metadata

  • Download URL: docums-charts-plugin-0.0.6.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4

File hashes

Hashes for docums-charts-plugin-0.0.6.tar.gz
Algorithm Hash digest
SHA256 4dad1951661f44ff17dc4cd848b04939f14c7f835c7ae68f30d0ca969caa40fe
MD5 3aeee8ffcc1d9daa098eab87a06fcc11
BLAKE2b-256 1239ae8ba8b52b17f869bb8008fdaf0befdfb796b69b317ea81a11ab1571ed13

See more details on using hashes here.

Supported by

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