Skip to main content

wagtail-charts

A chart StreamField block for Wagtail, drawn with Chart.js. Editors enter chart data in a spreadsheet editor in the Wagtail admin and choose the chart type and display settings alongside it.

Maintained by the Office of the Government Chief Information Officer (OGCIO) for gov.ie. It started as a fork of wagtailcharts by Overcast Software.

Chart types

Line, vertical bar, horizontal bar, area, combo (line/bar/area), pie, doughnut, radar, polar, waterfall and scatter. Bar and area charts can be stacked or stacked to 100%, and horizontal bars can be drawn as a pyramid.

Requirements

Installation

pip install ogcio-wagtail-charts

Add the app and its dependency to INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "wagtail_charts",
    "wagtail_color_panel",
    # ...
]

Usage

Add ChartBlock to a StreamField:

from wagtail.fields import StreamField
from wagtail.models import Page

from wagtail_charts.blocks import ChartBlock


class ReportPage(Page):
    body = StreamField([
        ("chart", ChartBlock()),
    ])

Load the Chart.js scripts once in your base template, after the page content (for example just before </body>):

{% load wagtailcharts_tags %}

{% render_charts %}

Colours

Dataset colours are chosen from a palette. Pass your own as colors, a sequence of (hex value, label) pairs:

from wagtail_charts.blocks import CHART_COLOR_CHOICES, ChartBlock

ChartBlock(colors=CHART_COLOR_CHOICES + (("#ffd700", "Gold"),))

Templates

To change the chart markup, override wagtailcharts/blocks/chart_block.html in your project's templates.

Development

python -m venv .venv
.venv/bin/pip install -e ".[test]"
.venv/bin/pytest

Releasing

  1. Update version in pyproject.toml and add an entry to CHANGELOG.md.
  2. Optionally, run the Publish workflow manually from the Actions tab to upload to TestPyPI and check the result.
  3. Create a GitHub release with a tag matching the version (for example v0.1.0). Publishing the release runs the tests, builds the package and uploads it to PyPI.

Licence

MIT. See LICENSE, which also lists the bundled third-party JavaScript libraries.

Metadata

Release files for ogcio-wagtail-charts 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ogcio-wagtail-charts 0.1.0
File Size Uploaded Provenance Actions
ogcio_wagtail_charts-0.1.0.tar.gz 243.1 kB Without provenance Details for ogcio_wagtail_charts-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ogcio-wagtail-charts 0.1.0
File Interpreter ABI Platform Actions
ogcio_wagtail_charts-0.1.0-py3-none-any.whl Python 3 none any Details for ogcio_wagtail_charts-0.1.0-py3-none-any.whl

Total release size: 491.2 kB

Release files / ogcio_wagtail_charts-0.1.0.tar.gz

Download URL ogcio_wagtail_charts-0.1.0.tar.gz
Size 243.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ebceab73d859af7a09d18a032153a655beeccec22f4cb9dd8f09378212ed0d8b
BLAKE2b-256 checksum
How to use checksums
04fa03f741cff2e9be7c7263191449535c5803ea58ba08ab7408412a16b9e60c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / ogcio_wagtail_charts-0.1.0-py3-none-any.whl

Download URL ogcio_wagtail_charts-0.1.0-py3-none-any.whl
Size 248.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92c3c2dbcdb3c7603bd1d82f2ce1ec95a25d7cdce2d9565296d83c428f64395e
BLAKE2b-256 checksum
How to use checksums
d7e4187504944b0b09c6f2cf32674f54031db6e3239442799018a44572774f43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for ogcio-wagtail-charts 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page