Python Wrapper for NVD3 - It's time for beautiful charts
========================================================
:Description: Python-nvd3 is a wrapper for NVD3 graph library
:NVD3: NVD3 http://nvd3.org/
:D3: Data-Driven Documents http://d3js.org/
:Maintainers: Areski_ & Oz_
:Contributors: `list of contributors <https://github.com/areski/python-nvd3/graphs/contributors>`_
.. _Areski: https://github.com/areski/
.. _Oz: https://github.com/oz123/
.. image:: https://coveralls.io/repos/areski/python-nvd3/badge.png?branch=develop
:target: https://coveralls.io/r/areski/python-nvd3?branch=develop
.. image:: https://img.shields.io/pypi/v/python-nvd3.svg
:target: https://pypi.python.org/pypi/python-nvd3/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/dm/python-nvd3.svg
:target: https://pypi.python.org/pypi/python-nvd3/
:alt: Downloads
.. image:: https://img.shields.io/pypi/pyversions/python-nvd3.svg
:target: https://pypi.python.org/pypi/python-nvd3/
:alt: Supported Python versions
.. image:: https://img.shields.io/pypi/l/python-nvd3.svg
:target: https://pypi.python.org/pypi/python-nvd3/
:alt: License
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.
Python-NVD3 makes your life easy! You write Python and the library
renders JavaScript for you!
These graphs can be part of your web application:
.. image:: https://raw.githubusercontent.com/areski/python-nvd3/develop/docs/showcase/multiple-charts.png
Want to try it yourself? Install python-nvd3, enter your python shell and try this quick demo::
>>> from nvd3 import pieChart
>>> chart_name = 'pieChart'
>>> chart = pieChart(name=chart_name, color_category='category20c', height=450, width=450)
>>> xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
>>> ydata = [3, 4, 0, 1, 5, 7, 3]
>>> extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}}
>>> chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
>>> chart.buildcontent()
>>> print chart.htmlcontent
This will output the following HTML to render a live chart. The HTML could be
stored into a HTML file, used in a Web application, or even used via Ipython Notebook::
<div id="pieChart"><svg style="width:450px;height:450px;"></svg></div>
<script>
data_pieChart=[{"values": [{"value": 3, "label": "Orange"},
{"value": 4, "label": "Banana"},
{"value": 0, "label": "Pear"},
{"value": 1, "label": "Kiwi"},
{"value": 5, "label": "Apple"},
{"value": 7, "label": "Strawberry"},
{"value": 3, "label": "Pineapple"}], "key": "Serie 1"}];
nv.addGraph(function() {
var chart = nv.models.pieChart();
chart.margin({top: 30, right: 60, bottom: 20, left: 60});
var datum = data_pieChart[0].values;
chart.tooltipContent(function(key, y, e, graph) {
var x = String(key);
var y = String(y) + ' cal';
tooltip_str = '<center><b>'+x+'</b></center>' + y;
return tooltip_str;
});
chart.showLegend(true);
chart.showLabels(true);
chart.donut(false);
chart
.x(function(d) { return d.label })
.y(function(d) { return d.value });
chart.width(450);
chart.height(450);
d3.select('#pieChart svg')
.datum(datum)
.transition().duration(500)
.attr('width', 450)
.attr('height', 450)
.call(chart);
});
</script>
Documentation
-------------
Check out the documentation on `Read the Docs`_ for some live Chart examples!
.. _Read the Docs: http://python-nvd3.readthedocs.org
Installation
------------
Install, upgrade and uninstall python-nvd3 with these commands::
$ pip install python-nvd3
$ pip install --upgrade python-nvd3
$ pip uninstall python-nvd3
Dependencies
------------
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.5.17
$ bower install nvd3#1.8.6
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.
Django Wrapper
--------------
There is also a django wrapper for nvd3 available:
https://github.com/areski/django-nvd3
IPython Notebooks
-----------------
Python-NVD3 works nicely within IPython Notebooks (thanks to @jdavidheiser)
See the examples directory for an Ipython notebook with python-nvd3.
License
-------
Python-nvd3 is licensed under MIT, see `MIT-LICENSE.txt`.
Maintainers
-----------
If you want to help maintain this project, please get in touch.
History
-------
0.15.0 - current
---------------------
* new settings show_controls & xAxis_rotateLabel
* add setting to add callback
0.14.0 - (2015-12-09)
---------------------
* update project structure
* remove setuptools from requirements
0.13.8 - (2015-04-12)
---------------------
* fix scatterChart
0.13.7 - (2015-04-06)
---------------------
* set format on x2Axis for focus
0.13.6 - (2015-04-06)
---------------------
* add support for focusEnable
* remove linePlusBarWithFocusChart as this is replaced by linePlusBarChart with option FocusEnable():
http://nvd3-community.github.io/nvd3/examples/documentation.html#linePlusBarChart
* Sourcing JS assets over https when appropriate
0.13.5 (2014-11-13)
-------------------
* Fix: color_list extra arguments is not mandatory on piechart
0.13.0 (2014-08-04)
-------------------
* User Jinja2 to create the JS charts
0.11.0 (2013-10-09)
-------------------
* allow chart_attr to be set as follow 'xAxis': '.rotateLabels(-25)'
this will turn into calling chart.xAxis.rotateLabels(-25)
0.11.0 (2013-10-09)
-------------------
* date setting is replaced by x_is_date
* refactoring
0.10.2 (2013-10-04)
-------------------
* discreteBarChart support date on xAxis
0.10.1 (2013-10-03)
-------------------
* Remove $ sign in linePlusBarWithFocusChart
0.10.0 (2013-10-02)
-------------------
* Support new chart linePlusBarWithFocusChart
0.9.0 (2013-09-30)
------------------
* Use Bower to install D3 and NVD3
0.8.0 (2013-08-15)
------------------
* add NVD3Chart.buildcontent() by cmorgan (Chris Morgan)
* Add show_labels parameter for Piechart by RaD (Ruslan Popov)
0.7.0 (2013-07-09)
------------------
* Generalise the axis_formatting & add support for hiding the legend by nzjrs (John Stowers)
* Fix #7 from DanMeakin, wrong str conversion of x-axis dates
0.6.0 (2013-06-05)
------------------
* Add AM_PM function for x-axis on lineChart
0.5.2 (2013-05-31)
------------------
* ScatterChat option to pass 'size': '10' as argument of the series
* Fix in setup.py for python3
0.5.1 (2013-05-30)
------------------
* Fix multiChart with date
0.5.0 (2013-05-28)
------------------
* Add color_list option on piechart
0.4.1 (2013-05-06)
------------------
* Fix removed forced sorted on x-axis
0.4.0 (2013-04-28)
------------------
* Add support for Python3
0.3.6 (2013-04-24)
------------------
* Add custom dateformat var for tooltip
0.3.5 (2013-04-23)
------------------
* Fix style
0.3.4 (2013-04-23)
------------------
* Support for px and % on height and width
* Add tag_script_js property to disable tag <script>
0.3.3 (2013-04-23)
------------------
* Data series it now in javascript format
0.3.2 (2013-04-22)
------------------
* Fix lineChart tooltip
0.3.1 (2013-04-19)
------------------
* Option to change the color schemes
* Set a specific color per serie
0.3 (2013-04-19)
----------------
* Add tooltip support
* Mix enhancement of APIs
0.2 (2013-04-16)
----------------
* Proper project release including support for the following chart:
lineWithFocusChart
lineChart
multiBarChart
pieChart
stackedAreaChart
multiBarHorizontalChart
linePlusBarChart
cumulativeLineChart
discreteBarChart
scatterChart
0.1 (2013-04-08)
----------------
* First release
Raw data
{
"_id": null,
"home_page": "http://github.com/areski/python-nvd3",
"name": "python-nvd3",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "plot, graph, nvd3, d3",
"author": "Belaid Arezqui",
"author_email": "areski@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/54/e7/2a0bf4d9209d23a9121ab3f84e2689695d1ceba417f279f480af2948abef/python-nvd3-0.16.0.tar.gz",
"platform": null,
"description": "Python Wrapper for NVD3 - It's time for beautiful charts\n========================================================\n\n:Description: Python-nvd3 is a wrapper for NVD3 graph library\n:NVD3: NVD3 http://nvd3.org/\n:D3: Data-Driven Documents http://d3js.org/\n:Maintainers: Areski_ & Oz_\n:Contributors: `list of contributors <https://github.com/areski/python-nvd3/graphs/contributors>`_\n\n.. _Areski: https://github.com/areski/\n.. _Oz: https://github.com/oz123/\n\n.. image:: https://coveralls.io/repos/areski/python-nvd3/badge.png?branch=develop\n :target: https://coveralls.io/r/areski/python-nvd3?branch=develop\n\n.. image:: https://img.shields.io/pypi/v/python-nvd3.svg\n :target: https://pypi.python.org/pypi/python-nvd3/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/dm/python-nvd3.svg\n :target: https://pypi.python.org/pypi/python-nvd3/\n :alt: Downloads\n\n.. image:: https://img.shields.io/pypi/pyversions/python-nvd3.svg\n :target: https://pypi.python.org/pypi/python-nvd3/\n :alt: Supported Python versions\n\n.. image:: https://img.shields.io/pypi/l/python-nvd3.svg\n :target: https://pypi.python.org/pypi/python-nvd3/\n :alt: License\n\nNVD3 is an attempt to build re-usable charts and chart components\nfor d3.js without taking away the power that d3.js offers you.\n\nPython-NVD3 makes your life easy! You write Python and the library\nrenders JavaScript for you!\nThese graphs can be part of your web application:\n\n .. image:: https://raw.githubusercontent.com/areski/python-nvd3/develop/docs/showcase/multiple-charts.png\n\n\nWant to try it yourself? Install python-nvd3, enter your python shell and try this quick demo::\n\n >>> from nvd3 import pieChart\n >>> chart_name = 'pieChart'\n >>> chart = pieChart(name=chart_name, color_category='category20c', height=450, width=450)\n >>> xdata = [\"Orange\", \"Banana\", \"Pear\", \"Kiwi\", \"Apple\", \"Strawberry\", \"Pineapple\"]\n >>> ydata = [3, 4, 0, 1, 5, 7, 3]\n >>> extra_serie = {\"tooltip\": {\"y_start\": \"\", \"y_end\": \" cal\"}}\n >>> chart.add_serie(y=ydata, x=xdata, extra=extra_serie)\n >>> chart.buildcontent()\n >>> print chart.htmlcontent\n\n\nThis will output the following HTML to render a live chart. The HTML could be\nstored into a HTML file, used in a Web application, or even used via Ipython Notebook::\n\n <div id=\"pieChart\"><svg style=\"width:450px;height:450px;\"></svg></div>\n <script>\n data_pieChart=[{\"values\": [{\"value\": 3, \"label\": \"Orange\"},\n {\"value\": 4, \"label\": \"Banana\"},\n {\"value\": 0, \"label\": \"Pear\"},\n {\"value\": 1, \"label\": \"Kiwi\"},\n {\"value\": 5, \"label\": \"Apple\"},\n {\"value\": 7, \"label\": \"Strawberry\"},\n {\"value\": 3, \"label\": \"Pineapple\"}], \"key\": \"Serie 1\"}];\n\n nv.addGraph(function() {\n var chart = nv.models.pieChart();\n chart.margin({top: 30, right: 60, bottom: 20, left: 60});\n var datum = data_pieChart[0].values;\n chart.tooltipContent(function(key, y, e, graph) {\n var x = String(key);\n var y = String(y) + ' cal';\n tooltip_str = '<center><b>'+x+'</b></center>' + y;\n return tooltip_str;\n });\n chart.showLegend(true);\n chart.showLabels(true);\n chart.donut(false);\n chart\n .x(function(d) { return d.label })\n .y(function(d) { return d.value });\n chart.width(450);\n chart.height(450);\n d3.select('#pieChart svg')\n .datum(datum)\n .transition().duration(500)\n .attr('width', 450)\n .attr('height', 450)\n .call(chart);\n });\n </script>\n\n\nDocumentation\n-------------\n\nCheck out the documentation on `Read the Docs`_ for some live Chart examples!\n\n.. _Read the Docs: http://python-nvd3.readthedocs.org\n\n\nInstallation\n------------\n\nInstall, upgrade and uninstall python-nvd3 with these commands::\n\n $ pip install python-nvd3\n $ pip install --upgrade python-nvd3\n $ pip uninstall python-nvd3\n\n\nDependencies\n------------\n\nD3 and NvD3 can be installed through bower (which itself can be installed through npm).\nSee http://bower.io/ and https://npmjs.org for further information.\nTo install bower globally execute::\n\n $ npm install -g bower\n\nNote : you might prefer to save your npm dependencies locally in a ``package.json`` file.\n\nThen in the directory where you will use python-nvd3, just execute the following commands::\n\n $ bower install d3#3.5.17\n $ bower install nvd3#1.8.6\n\nThis will create a directory \"bower_components\" where d3 & nvd3 will be saved.\n\nNote : you might prefer to save your bower dependencies locally in a ``bower.json`` file.\nYou can also configure the directory where your bower dependencies will be\nsaved adding a ``.bowerrc`` file in your project root directory.\n\n\nDjango Wrapper\n--------------\n\nThere is also a django wrapper for nvd3 available:\nhttps://github.com/areski/django-nvd3\n\n\nIPython Notebooks\n-----------------\n\nPython-NVD3 works nicely within IPython Notebooks (thanks to @jdavidheiser)\n\nSee the examples directory for an Ipython notebook with python-nvd3.\n\n\nLicense\n-------\n\nPython-nvd3 is licensed under MIT, see `MIT-LICENSE.txt`.\n\n\nMaintainers\n-----------\n\nIf you want to help maintain this project, please get in touch.\n\n\n\n\nHistory\n-------\n\n\n0.15.0 - current\n---------------------\n\n* new settings show_controls & xAxis_rotateLabel\n* add setting to add callback\n\n\n0.14.0 - (2015-12-09)\n---------------------\n\n* update project structure\n* remove setuptools from requirements\n\n\n0.13.8 - (2015-04-12)\n---------------------\n\n* fix scatterChart\n\n\n0.13.7 - (2015-04-06)\n---------------------\n\n* set format on x2Axis for focus\n\n\n0.13.6 - (2015-04-06)\n---------------------\n\n* add support for focusEnable\n\n* remove linePlusBarWithFocusChart as this is replaced by linePlusBarChart with option FocusEnable():\n http://nvd3-community.github.io/nvd3/examples/documentation.html#linePlusBarChart\n\n* Sourcing JS assets over https when appropriate\n\n\n0.13.5 (2014-11-13)\n-------------------\n\n* Fix: color_list extra arguments is not mandatory on piechart\n\n\n0.13.0 (2014-08-04)\n-------------------\n\n* User Jinja2 to create the JS charts\n\n\n0.11.0 (2013-10-09)\n-------------------\n\n* allow chart_attr to be set as follow 'xAxis': '.rotateLabels(-25)'\n this will turn into calling chart.xAxis.rotateLabels(-25)\n\n\n0.11.0 (2013-10-09)\n-------------------\n\n* date setting is replaced by x_is_date\n* refactoring\n\n\n0.10.2 (2013-10-04)\n-------------------\n\n* discreteBarChart support date on xAxis\n\n\n0.10.1 (2013-10-03)\n-------------------\n\n* Remove $ sign in linePlusBarWithFocusChart\n\n\n0.10.0 (2013-10-02)\n-------------------\n\n* Support new chart linePlusBarWithFocusChart\n\n\n0.9.0 (2013-09-30)\n------------------\n\n* Use Bower to install D3 and NVD3\n\n\n0.8.0 (2013-08-15)\n------------------\n\n* add NVD3Chart.buildcontent() by cmorgan (Chris Morgan)\n* Add show_labels parameter for Piechart by RaD (Ruslan Popov)\n\n\n0.7.0 (2013-07-09)\n------------------\n\n* Generalise the axis_formatting & add support for hiding the legend by nzjrs (John Stowers)\n* Fix #7 from DanMeakin, wrong str conversion of x-axis dates\n\n\n0.6.0 (2013-06-05)\n------------------\n\n* Add AM_PM function for x-axis on lineChart\n\n\n0.5.2 (2013-05-31)\n------------------\n\n* ScatterChat option to pass 'size': '10' as argument of the series\n* Fix in setup.py for python3\n\n\n0.5.1 (2013-05-30)\n------------------\n\n* Fix multiChart with date\n\n\n0.5.0 (2013-05-28)\n------------------\n\n* Add color_list option on piechart\n\n\n0.4.1 (2013-05-06)\n------------------\n\n* Fix removed forced sorted on x-axis\n\n\n0.4.0 (2013-04-28)\n------------------\n\n* Add support for Python3\n\n\n0.3.6 (2013-04-24)\n------------------\n\n* Add custom dateformat var for tooltip\n\n\n0.3.5 (2013-04-23)\n------------------\n\n* Fix style\n\n\n0.3.4 (2013-04-23)\n------------------\n\n* Support for px and % on height and width\n* Add tag_script_js property to disable tag <script>\n\n\n0.3.3 (2013-04-23)\n------------------\n\n* Data series it now in javascript format\n\n\n0.3.2 (2013-04-22)\n------------------\n\n* Fix lineChart tooltip\n\n\n0.3.1 (2013-04-19)\n------------------\n\n* Option to change the color schemes\n* Set a specific color per serie\n\n\n0.3 (2013-04-19)\n----------------\n\n* Add tooltip support\n* Mix enhancement of APIs\n\n\n0.2 (2013-04-16)\n----------------\n\n* Proper project release including support for the following chart:\n\n lineWithFocusChart\n lineChart\n multiBarChart\n pieChart\n stackedAreaChart\n multiBarHorizontalChart\n linePlusBarChart\n cumulativeLineChart\n discreteBarChart\n scatterChart\n\n\n0.1 (2013-04-08)\n----------------\n\n* First release\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python NVD3 - Chart Library for d3.js",
"version": "0.16.0",
"project_urls": {
"Homepage": "http://github.com/areski/python-nvd3"
},
"split_keywords": [
"plot",
" graph",
" nvd3",
" d3"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "54e72a0bf4d9209d23a9121ab3f84e2689695d1ceba417f279f480af2948abef",
"md5": "8e61bcf33646423637b19011231a6185",
"sha256": "0115887289b3f751716ddd05c7b53ac5f05e71201e52496decdac453a50dcf7e"
},
"downloads": -1,
"filename": "python-nvd3-0.16.0.tar.gz",
"has_sig": false,
"md5_digest": "8e61bcf33646423637b19011231a6185",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 34060,
"upload_time": "2024-04-22T07:55:15",
"upload_time_iso_8601": "2024-04-22T07:55:15.856967Z",
"url": "https://files.pythonhosted.org/packages/54/e7/2a0bf4d9209d23a9121ab3f84e2689695d1ceba417f279f480af2948abef/python-nvd3-0.16.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-22 07:55:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "areski",
"github_project": "python-nvd3",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "python-slugify",
"specs": [
[
">=",
"1.2.5"
]
]
},
{
"name": "Jinja2",
"specs": [
[
">=",
"2.8"
]
]
}
],
"lcname": "python-nvd3"
}