Skip to main content

django-d3-bridge

PyPI Tests License: MIT Python 3.10+ Django 4.2+

Declarative D3.js visualizations for Django — charts, maps, networks, with MQTT live updates.

Write Python, render D3.js. No JavaScript required.

Documentation | GitHub | PyPI

Install

pip install django-d3-bridge

Quick Start

# settings.py
INSTALLED_APPS = [
    ...
    "d3_bridge",
]

# views.py
from d3_bridge import BarChart

def dashboard(request):
    chart = BarChart(
        data=Product.objects.values("name", "sales"),
        x="name", y="sales",
        title="Sales by Product",
    )
    return render(request, "dashboard.html", {"chart": chart})
{% load d3_bridge %}
{% d3_scripts %}

<div class="col-md-6">
    {% d3_render chart %}
</div>

19 Chart Types

Category Charts
Basic Bar, Line, Area, Pie, Donut, Scatter
Geographic Choropleth Map, Bubble Map
Network Force Graph, Sankey, Chord Diagram
Hierarchy Tree, Treemap, Circle Packing, Sunburst, Dendrogram
Statistical Contour Plot, Density Plot, Voronoi Diagram

3 Data Modes

  • Static — QuerySet evaluated at each page load
  • Polling — auto-refresh via HTTP fetch every N seconds
  • MQTT — real-time push via WebSocket
# Polling example — no WebSocket, no infrastructure
chart = LineChart(
    data=initial_data,
    x="timestamp", y="value",
    poll_url="/api/chart/data/",
    poll_interval=30,
)

Features

  • Pure D3.js v7 output — inspectable, no abstraction layer
  • Django QuerySet + GeoQuerySet + DataFrame serialization
  • 4 themes (default, dark, bootstrap, terraf) + 7 color palettes
  • theme="auto" follows the browser's prefers-color-scheme, live
  • Load only the chart modules you use: {% d3_scripts charts="bar,line" %}
  • Responsive, animated, with tooltips — SVGs carry role="img" + aria-label
  • XSS-safe rendering: chart configs are escaped like Django's json_script
  • Works fully offline: D3, d3-sankey and mqtt.js vendored ({% d3_scripts cdn=False %})
  • Bootstrap grid compatible
  • Escape hatch for custom D3.js code

Documentation

Full documentation with examples for every chart type:

https://altius-academy-snc.github.io/django-d3-bridge

See CHANGELOG.md for release notes.

License

MIT — Paul Guindo / Altius Academy SNC

Release files for django-d3-bridge 0.2.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 django-d3-bridge 0.2.0
File Size Uploaded
django_d3_bridge-0.2.0.tar.gz 277.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-d3-bridge 0.2.0
File Interpreter ABI Platform
django_d3_bridge-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 541.9 kB

Release files / django_d3_bridge-0.2.0.tar.gz

Download URL django_d3_bridge-0.2.0.tar.gz
Size 277.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ac063d3ff615b9dfb57aa645f916ff6c66e2ec7a9931969888390ea36b6a0b60
BLAKE2b-256 checksum
How to use checksums
9aeb32bb0f7531013d2838f28664183b600c498dfd98bb741cf2ea5faa3204f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.

Transparency log

Release files / django_d3_bridge-0.2.0-py3-none-any.whl

Download URL django_d3_bridge-0.2.0-py3-none-any.whl
Size 264.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b27244ebf090a09d397310472b53cd3a46b65a4477d58f35204d71219205850e
BLAKE2b-256 checksum
How to use checksums
f3a8565e8cbff5ac4cd10de2ac5f2d11cb8470fbd2e91ec96d8afd29f581470e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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