Django integration¶
The package includes a Django app to help integrating nvd3_py in Django.
Quick start¶
- Add “django_nvd3” to your INSTALLED_APPS settings like this:
INSTALLED_APPS = [
...
"django_nvd3",
]
- Load the tags in your template:
{% load nvd3_tags %}
- Use it.
Reference¶
Load the required JavaScript and CSS files.
Usage:
<html> <head> ... {# serve the static files yourself... #} {% nvd3_static %} {# ...or use cdnjs #} {% nvd3_static use_cdnjs=True %} ... </head> <body> ...
Include the chart in the page with the given data.
Parameters: - chart (
nvd3.Chart) – The chart to render. - data – the data to pass to the chart.
- width – SVG tag width.
- height – SVG tag height.
Usage:
{% nvd3_static_data chart data 400 300 %}- chart (
Include the chart in the page loading the data from a server.
Parameters: - chart (
nvd3.Chart) – The chart to render. - url (str) – the url where to retrieve the data.
- width – SVG tag width.
- height – SVG tag height.
Usage:
{% nvd3_remote_json chart url 400 300 %}- chart (