{ "info": { "author": "Belaid Arezqui", "author_email": "areski@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Django Wrapper for NVD3 - It's time for beautiful charts\n========================================================\n\n:Description: Django-nvd3 is a wrapper for NVD3 graph library\n:nvd3: NVD3 http://nvd3.org/\n:d3: Data-Driven Documents http://d3js.org/\n\n\nNVD3 is an attempt to build re-usable charts and chart components\nfor d3.js without taking away the power that d3.js gives you.\n\n\n.. image:: https://travis-ci.org/areski/django-nvd3.svg?branch=develop\n :target: https://travis-ci.org/areski/django-nvd3\n\nInstallation\n------------\n\nInstall, upgrade and uninstall django-nvd3 with these commands::\n\n $ pip install django-nvd3\n $ pip install --upgrade django-nvd3\n $ pip uninstall django-nvd3\n\nThen edit settings.py from your django project and add 'django_nvd3' in your 'INSTALLED_APPS' setting.\n\n\nDependencies\n------------\n\nDjango-nvd3 have one major dependencie:\n\n* python-nvd3 : https://github.com/areski/python-nvd3\n\n\nBower will be used to install D3 and NvD3, see bower website for futher info : http://bower.io/\n\nBower depends on Node and npm. It's installed globally using npm::\n\n npm install -g bower\n\nTo easy the integration with Django we will advice you to use django-bower.\n\nFor instance to run our demo project, you will install the dependencies from requirements.txt and then\ninstall django-bower. Django-bower is not a mandatory dependencies as the user should be free to install JS files\nusing different method.\n\nTo install django-bower::\n\n $ pip install django-bower\n\nRead the documentation about Django-bower to find out how to configure it properly for your project: https://github.com/nvbn/django-bower\n\nThen in the demo project directory just type the following::\n\n $ python manage.py bower_install\n $ python manage.py collectstatic\n\nThis will create a directory \"components\" where d3 & nvd3 will be installed.\n\nYou can see example settings file in `demoproject `_.\n\n\n\nExample how to create a pieChart\n--------------------------------\n\nLet\u2019s say we have a simple view in which we want to display the amount of calories per fruit.\n\nSo to achieve this, we will edit our view.py, we will prepare the data that will be displayed::\n\n xdata = [\"Apple\", \"Apricot\", \"Avocado\", \"Banana\", \"Boysenberries\", \"Blueberries\", \"Dates\", \"Grapefruit\", \"Kiwi\", \"Lemon\"]\n ydata = [52, 48, 160, 94, 75, 71, 490, 82, 46, 17]\n chartdata = {'x': xdata, 'y': ydata}\n charttype = \"pieChart\"\n chartcontainer = 'piechart_container'\n data = {\n 'charttype': charttype,\n 'chartdata': chartdata,\n 'chartcontainer': chartcontainer,\n 'extra': {\n 'x_is_date': False,\n 'x_axis_format': '',\n 'tag_script_js': True,\n 'jquery_on_ready': False,\n }\n }\n return render_to_response('piechart.html', data)\n\n\nWe will render the template 'piechart.html' with a dictionary 'data' which contains 'charttype' and 'chartdata'.\n'extra' will contains a list of additional settings::\n\n * ``x_is_date`` - if enabled the x-axis will be display as date format\n * ``x_axis_format`` - set the x-axis date format, ie. \"%d %b %Y\"\n * ``tag_script_js`` - if enabled it will add the javascript tag '