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

Download files

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

Source Distribution

django_d3_bridge-0.2.0.tar.gz (277.2 kB view details)

Uploaded Source

Built Distribution

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

django_d3_bridge-0.2.0-py3-none-any.whl (264.7 kB view details)

Uploaded Python 3

File details

Details for the file django_d3_bridge-0.2.0.tar.gz.

File metadata

  • Download URL: django_d3_bridge-0.2.0.tar.gz
  • Upload date:
  • Size: 277.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_d3_bridge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ac063d3ff615b9dfb57aa645f916ff6c66e2ec7a9931969888390ea36b6a0b60
MD5 c84119871c9e9e04d5814daa816f92e1
BLAKE2b-256 9aeb32bb0f7531013d2838f28664183b600c498dfd98bb741cf2ea5faa3204f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_d3_bridge-0.2.0.tar.gz:

Publisher: publish.yml on Altius-Academy-SNC/django-d3-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_d3_bridge-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_d3_bridge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b27244ebf090a09d397310472b53cd3a46b65a4477d58f35204d71219205850e
MD5 312c3df41362468d6bdd36af17371f66
BLAKE2b-256 f3a8565e8cbff5ac4cd10de2ac5f2d11cb8470fbd2e91ec96d8afd29f581470e

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_d3_bridge-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Altius-Academy-SNC/django-d3-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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