Changelog¶
All notable changes to django-d3-bridge are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.2.0] - 2026-07-14¶
Added¶
- Selective chart module loading:
{% d3_scripts charts="bar,area" %}loads only the JS modules needed instead of all 10. Accepts chart type names (each resolves to the module that renders it:area→line.js,sunburst→hierarchy.js, …); requestingsankeyloads the d3-sankey plugin automatically; unknown names raise an error. Also configurable globally viaD3_BRIDGE = {"CHARTS": [...]}. Default unchanged (all modules). - Auto theme:
theme="auto"(on a chart or as a{% d3_render %}override) follows the browser'sprefers-color-scheme— light mode renders thedefaulttheme, dark mode thedarktheme, and charts re-render live when the OS/browser switches mode. The pair is configurable viaD3_BRIDGE = {"AUTO_THEMES": ("light", "dark")}. Newd3_bridge.themes.resolve_theme_pair()helper.
Fixed¶
- Switching from a dark to a light theme now clears the container's background color instead of keeping the dark one.
[0.1.4] - 2026-07-14¶
Security¶
- XSS fix:
{% d3_render %}and{% d3_json %}now escape<,>and&(as\u003C,\u003E,\u0026) in the JSON config before inlining it in a<script>block — the same hardening as Django'sjson_script. Previously, a data value containing</script><script>…would break out of the script block and execute. The chartidis also escaped in the container's HTML attributes and JSON-encoded in the init script.
Fixed¶
{% d3_scripts cdn=False %}no longer references a missing file: D3 v7, mqtt.js v5 and d3-sankey 0.12.3 are now vendored in the package's static files, enabling a fully offline, CDN-free setup (including Sankey and MQTT).ChartDataView:limitis now applied afterfilter_queryset(). Overridingfilter_queryset()with a.filter()call used to raise "Cannot filter a query once a slice has been taken" wheneverlimitwas set.Chart.to_json()now uses the shared bridge encoder and therefore handlesDecimal,date/datetimeand geometry values, consistently with{% d3_render %}andChartDataView.- Serializing a QuerySet no longer crashes with
ImproperlyConfiguredon systems wheredjango.contrib.gisis importable but GDAL is not installed — the geo-queryset detection now treats "no GDAL" as "no GIS support". {% d3_render %}no longer mutates the chart instance: per-render overrides (theme=,height=, …) are applied to the rendered config only, so the same chart can be rendered multiple times with different options.
Added¶
d3_bridge.encoders.BridgeJSONEncoder— single JSON encoder shared by the template tags,ChartDataViewandChart.to_json()(previously duplicated in three modules).- Accessibility: every chart SVG now carries
role="img", anaria-labelderived from the chart title (or chart type), and a<title>element. - Test coverage for the template tags,
ChartDataViewand the serializers. - This changelog (retroactive for 0.1.0 → 0.1.3).
Documentation¶
- Polling guide: warning that
poll_headersvalues end up in the page's HTML in clear text — don't put secrets there; prefer session/cookie auth.
[0.1.3] - 2026-07-09¶
Fixed¶
- Sankey plugin loading (d3-sankey is not part of core D3; now loaded via the
sankeyoption of{% d3_scripts %}or theD3_BRIDGE["SANKEY"]setting). - Sequential color scales: CSS custom properties (
var(--x)) and modern color functions (oklch(),color-mix()) are resolved through the browser before being handed to d3-color, instead of silently interpolating to black. - Choropleth rendering: Polygon/MultiPolygon winding order is normalized to
what d3-geo's spherical clipping expects (RFC 7946 exports rendered as
corrupted shapes / collapsed
fitSizescale). - Force graph layout.
[0.1.2] - 2026-07-02¶
Fixed¶
- Infinite "No data" loop when a chart dataset is empty: the empty-state
placeholder now keeps the container height stable so the responsive
ResizeObserverno longer retriggers rendering forever.
[0.1.1] - 2026-03-17¶
Fixed¶
- Lint errors.
Documentation¶
- Improved README with links and badges.
[0.1.0] - 2026-03-17¶
Added¶
- Initial release: declarative D3.js visualizations for Django.
- 19 chart types (bar, line, area, pie, donut, scatter, density, choropleth, bubble map, force graph, sankey, chord, tree, dendrogram, treemap, pack, sunburst, contour, voronoi).
{% d3_scripts %}and{% d3_render %}template tags.- Themes and palettes, MQTT live updates, HTTP polling, GeoJSON serialization.
ChartDataViewJSON endpoint (no DRF dependency).- Documentation site (30 pages) and CI/CD with PyPI trusted publishing.