Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mher/chartkick.py
Create beautiful Javascript charts with minimal code
https://github.com/mher/chartkick.py
chart charting-library chartjs charts django flask google-charts highcharts python visualization
Last synced: 3 days ago
JSON representation
Create beautiful Javascript charts with minimal code
- Host: GitHub
- URL: https://github.com/mher/chartkick.py
- Owner: mher
- License: mit
- Archived: true
- Created: 2013-06-11T11:56:39.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-12-22T10:03:23.000Z (almost 4 years ago)
- Last Synced: 2024-08-01T22:54:05.931Z (3 months ago)
- Topics: chart, charting-library, chartjs, charts, django, flask, google-charts, highcharts, python, visualization
- Language: JavaScript
- Homepage: chartkick.com
- Size: 93.8 KB
- Stars: 695
- Watchers: 45
- Forks: 102
- Open Issues: 17
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Chartkick.py
============.. image:: https://img.shields.io/pypi/v/chartkick.svg
:target: https://pypi.python.org/pypi/chartkick.. image:: https://travis-ci.org/mher/chartkick.py.svg?branch=master
:target: https://travis-ci.org/mher/chartkick.pyCreate beautiful Javascript charts with minimal code. Demo_!
Supports `Chart.js`_, `Google Charts`_, and Highcharts_
Works with Django, Flask/Jinja2 and most browsers (including IE 6).
Also available in Ruby_ and pure JavaScript_.. _Chartkick: http://chartkick.com
.. _Chart.js: http://www.chartjs.org
.. _Google Charts: https://developers.google.com/chart/
.. _Highcharts: http://highcharts.com
.. _Demo: http://mher.github.io/chartkick.py/
.. _Ruby: http://chartkick.com
.. _Javascript: https://github.com/ankane/chartkick.jsUsage
-----Line chart: ::
{% line_chart data %}
Pie chart: ::
{% pie_chart data with id='chart-1' height='400px' %}
Column chart: ::
{% column_chart data with min=400 max=1000 %}
Bar chart: ::
{% bar_chart data %}
Area chart: ::
{% area_chart data %}
Scatter chart: ::
{% scatter_chart data %}
Data
----Data can be a dictionary or a list: ::
{'Chrome': 52.9, 'Opera': 1.6, 'Firefox': 27.7}
[['Chrome', 52.9], ['Firefox', 27.7], ['Opera', 1.6]]
For multiple series: ::
[{'data': [['2013-04-01 00:00:00 UTC', 52.9], ['2013-05-01 00:00:00 UTC', 50.7]], 'name': 'Chrome'},
{'data': [['2013-04-01 00:00:00 UTC', 27.7], ['2013-05-01 00:00:00 UTC', 25.9]], 'name': 'Firefox'}]Options
-------Charting library options can be passed through the *library* variable: ::
{% column_chart data with library={"title":"Super chart","width":"400px"} %}
.. Note:: Google Charts and Highcharts have different APIs. You may need
to change the value of `library` when you switch from one
library to another.Or using *chartkick.json* file. Chartkick tries to locate *chartkick.json*
file in template path and match options by id.Installation
------------Install chartkick: ::
$ pip install chartkick
- Django: Add chartkick to *INSTALLED_APPS* and *STATICFILES_DIRS*: ::
INSTALLED_APPS = (
'chartkick',
)import chartkick
STATICFILES_DIRS = (
chartkick.js(),
)- Flask: Add chartkick to *jinja_env* and *static_folder*: ::
import chartkick
ck = Blueprint('ck_page', __name__, static_folder=chartkick.js(), static_url_path='/static')
app.register_blueprint(ck, url_prefix='/ck')
app.jinja_env.add_extension("chartkick.ext.charts")Load JS scripts:
- Chart.js ::
- Google Charts ::
- Highcharts ::