Python NVD3 - Chart Library for d3.js
Project description
- Description:
Python-nvd3 is a wrapper for NVD3 graph library
- nvd3:
NVD3 http://nvd3.org/
- d3:
Data-Driven Documents http://d3js.org/
NVD3 is an attempt to build re-usable charts and chart components for d3.js without taking away the power that d3.js offers you.
Installation
Install, upgrade and uninstall python-nvd3 with these commands:
$ pip install python-nvd3 $ pip install --upgrade python-nvd3 $ pip uninstall python-nvd3
Dependecies
D3 and NvD3 can be installed through bower (which itself can be installed through npm). See http://bower.io/ and https://npmjs.org for further information. To install bower globally execute:
$ npm install -g bower
Note : you might prefer to save your npm dependencies locally in a package.json file.
Then in the directory where you will use python-nvd3, just execute the following commands:
$ bower install d3#3.3.8 $ bower install nvd3#1.1.12-beta
This will create a directory “bower_components” where d3 & nvd3 will be saved.
Note : you might prefer to save your bower dependencies locally in a bower.json file. You can also configure the directory where your bower dependencies will be saved adding a .bowerrc file in your project root directory.
Usage
After installation use python-nvd3 as follows
from nvd3 import pieChart #Open File to write the D3 Graph output_file = open('test-nvd3.html', 'w') type = 'pieChart' chart = pieChart(name=type, color_category='category20c', height=450, width=450) chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n") #Create the keys xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"] ydata = [3, 4, 0, 1, 5, 7, 3] #Add the serie extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}} chart.add_serie(y=ydata, x=xdata, extra=extra_serie) chart.buildhtml() output_file.write(chart.htmlcontent) #close Html file output_file.close()
See the file examples.py for more samples.
Live demo of NVD3
See a live demo on jsfiddle : http://jsfiddle.net/areski/z4zuH/246/
Supported nvd3 charts
Charts list:
Documentation
Documentation is available on ‘Read the Docs’: http://python-nvd3.readthedocs.org
Changelog
Changelog summary : https://github.com/areski/python-nvd3/blob/master/CHANGELOG.rst
Do you like Django?
There is also a django wrapper for nvd3 available: https://github.com/areski/django-nvd3
IPython & Notebook
Python-NVD3 works nicely with Notebook (thanks to @jdavidheiser)
You can check this notebook that demonstrates ipython compatibility in the nvd3-python package: http://nbviewer.ipython.org/gist/jdavidheiser/9552624
License
Python-nvd3 is licensed under MIT, see MIT-LICENSE.txt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file python-nvd3-0.12.2.tar.gz
.
File metadata
- Download URL: python-nvd3-0.12.2.tar.gz
- Upload date:
- Size: 35.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 344c25b526607f28c8e26cc71fd9bde935eca25cdc48751869f481ad0aee1d6a |
|
MD5 | f92f3793305d6e82188054289ad636e6 |
|
BLAKE2b-256 | d9bf6ff9d2d19c0d7663308f070f77ab03ccf3484d69bbec7826b5b0cba5a946 |