Metadata-Version: 2.4
Name: django-d3-bridge
Version: 0.1.1
Summary: Declarative D3.js visualizations for Django — charts, maps, networks, with MQTT live updates
Project-URL: Homepage, https://github.com/Altius-Academy-SNC/django-d3-bridge
Project-URL: Documentation, https://altius-academy-snc.github.io/django-d3-bridge
Project-URL: Repository, https://github.com/Altius-Academy-SNC/django-d3-bridge
Author-email: Paul Guindo <paulguindo@altius-group.ch>
License-Expression: MIT
License-File: LICENSE
Keywords: charts,d3,d3js,django,geodjango,geojson,mqtt,visualization
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.10
Requires-Dist: django>=4.2
Provides-Extra: all
Requires-Dist: django>=4.2; extra == 'all'
Requires-Dist: paho-mqtt>=2.0; extra == 'all'
Provides-Extra: dev
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-django>=4.5; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material; extra == 'docs'
Requires-Dist: mkdocstrings[python]; extra == 'docs'
Provides-Extra: geo
Requires-Dist: django>=4.2; extra == 'geo'
Provides-Extra: mqtt
Requires-Dist: paho-mqtt>=2.0; extra == 'mqtt'
Description-Content-Type: text/markdown

# django-d3-bridge

[![PyPI](https://img.shields.io/pypi/v/django-d3-bridge)](https://pypi.org/project/django-d3-bridge/)
[![Tests](https://github.com/Altius-Academy-SNC/django-d3-bridge/actions/workflows/tests.yml/badge.svg)](https://github.com/Altius-Academy-SNC/django-d3-bridge/actions/workflows/tests.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
[![Django 4.2+](https://img.shields.io/badge/django-4.2%2B-green)](https://www.djangoproject.com/)

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

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

**[Documentation](https://altius-academy-snc.github.io/django-d3-bridge)** | **[GitHub](https://github.com/Altius-Academy-SNC/django-d3-bridge)** | **[PyPI](https://pypi.org/project/django-d3-bridge/)**

## Install

```bash
pip install django-d3-bridge
```

## Quick Start

```python
# 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})
```

```html
{% 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

```python
# 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
- Responsive, animated, with tooltips
- 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**

## License

MIT — [Paul Guindo](https://github.com/Altius-Academy-SNC) / Altius Academy SNC
