Need help with django-nvd3?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

413 Stars 125 Forks Other 351 Commits 37 Opened issues


Django wrapper for nvd3 - It's time for beautiful charts

Services available


Need anything else?

Contributors list

Django Wrapper for NVD3 - It's time for beautiful charts

:Description: Django-nvd3 is a wrapper for NVD3 graph library :nvd3: NVD3 :d3: Data-Driven Documents

NVD3 is an attempt to build re-usable charts and chart components for d3.js without taking away the power that d3.js gives you.

.. image:: :target:


Install, upgrade and uninstall django-nvd3 with these commands::

$ pip install django-nvd3
$ pip install --upgrade django-nvd3
$ pip uninstall django-nvd3

Then edit from your django project and add 'djangonvd3' in your 'INSTALLEDAPPS' setting.


Django-nvd3 have one major dependencie:

  • python-nvd3 :

Bower will be used to install D3 and NvD3, see bower website for futher info :

Bower depends on Node and npm. It's installed globally using npm::

npm install -g bower

To easy the integration with Django we will advice you to use django-bower.

For instance to run our demo project, you will install the dependencies from requirements.txt and then install django-bower. Django-bower is not a mandatory dependencies as the user should be free to install JS files using different method.

To install django-bower::

$ pip install django-bower

Read the documentation about Django-bower to find out how to configure it properly for your project:

Then in the demo project directory just type the following::

$ python bower_install
$ python collectstatic

This will create a directory "components" where d3 & nvd3 will be installed.

You can see example settings file in


Example how to create a pieChart

Let’s say we have a simple view in which we want to display the amount of calories per fruit.

So to achieve this, we will edit our, we will prepare the data that will be displayed::

xdata = ["Apple", "Apricot", "Avocado", "Banana", "Boysenberries", "Blueberries", "Dates", "Grapefruit", "Kiwi", "Lemon"]
ydata = [52, 48, 160, 94, 75, 71, 490, 82, 46, 17]
chartdata = {'x': xdata, 'y': ydata}
charttype = "pieChart"
chartcontainer = 'piechart_container'
data = {
    'charttype': charttype,
    'chartdata': chartdata,
    'chartcontainer': chartcontainer,
    'extra': {
        'x_is_date': False,
        'x_axis_format': '',
        'tag_script_js': True,
        'jquery_on_ready': False,
return render_to_response('piechart.html', data)

We will render the template 'piechart.html' with a dictionary 'data' which contains 'charttype' and 'chartdata'. 'extra' will contains a list of additional settings::

* ``x_is_date`` - if enabled the x-axis will be display as date format
* ``x_axis_format`` - set the x-axis date format, ie. "%d %b %Y"
* ``tag_script_js`` - if enabled it will add the javascript tag '

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.