Skip to main content

An app to explore your data through charts based on Highcharts.js

Project description

https://badge.fury.io/py/acdh-django-charts.svg https://travis-ci.org/acdh-oeaw/acdh-django-charts.svg?branch=master https://codecov.io/gh/acdh-oeaw/acdh-django-charts/branch/master/graph/badge.svg

An app to explore your data through charts based on Highcharts.js

Documentation

The full documentation is at https://acdh-django-charts.readthedocs.io.

Quickstart

Install django_charts:

pip install acdh-django-charts

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'charts',
    ...
)

Add django_charts’s URL patterns:

urlpatterns = [
    ...
    url(r'^charts/', include('charts.urls', namespace='charts')),
    ...
]

By default the app’s templates extend a base template webpage/base.html. To ovveride this, just define a CHARTS_BASE_TEMPLATE variable on your project’s settings.py like e.g:

CHARTS_BASE_TEMPLATE = 'base.html'

To link to the application’s ‘chart-selector-view’ you can add something like the snippet below to your e.g. base-template:

<a href="{% url 'charts:chart_selector' %}">Charts</a>

Configuration

To visualize any property of your model you have to pass in the models name (lowercase), the field-path (using django’s lookup syntax __ to follow foreign key and many2many relations) and the chart type (bar|line|pie) via keyword arguments to the charts.views.DynChartView(). In case those params are valid (i.d. the model and the lookup path acutally exist) the according chart should be drawn. But be aware that this only works if your project’s DEBUG settings are set to True. As recomended alternative you should create ChartConfig objects for each property/model you’d like to explore via django admin-backend.

management commands

The package ships with a management command to

  • create/delete chartconfig objects (Bar, Pie, Linecharts)

python manage.py create_charttypes
python manage.py delete_charttypes
  • create/delete ChartConfig objects per application

python manage.py create_charts <app_name>
python manage.py delete_charts <app_name>

Build and publish

python setup.py sdist bdist_wheel
twine upload dist/*

Features

  • Visualizes aggregated values of your models as charts (pie/bar/line) using https://www.highcharts.com/

  • Charts can be configured via admin backend (see Configuration Section)

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

History

0.5.4 (2019-10-11)

  • values always returned as strings -> BooleanFields are displayed now

0.5.3 (2019-02-12)

  • reworte code to fetch payload data to avoid mysterious duplicated values

0.5.2 (2018-12-18)

  • improved admin interface for ChartConfig

0.5.1 (2018-12-05)

  • added management commands to create ChartType and ChartConfig objects.

0.5.0 (2018-10-25)

  • added app_name param to ChartConfig to avoid ambiguity in case models in different apps do have the same name.

0.4.1 (2018-07-12)

  • minor change in dropdown template tag

0.4.0 (2018-07-10)

  • refactoring of templates by introducing template tags

0.3.0 (2018-06-13)

  • removed work in progress banner

0.3.0 (2018-06-05)

  • In case of DEBUG=False only fieldpaths/models can be explored which are registerd in dedicated ChartConfig objects.

0.2.0 (2018-06-01)

  • Base templates can now be configured in settings-param

0.1.0 (2018-06-01)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acdh-django-charts-0.6.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

acdh_django_charts-0.6.0-py2.py3-none-any.whl (16.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file acdh-django-charts-0.6.0.tar.gz.

File metadata

  • Download URL: acdh-django-charts-0.6.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for acdh-django-charts-0.6.0.tar.gz
Algorithm Hash digest
SHA256 5a1d63a3c6b04fc5c421db66729a2666c45d5f1a9ba65c6f9b6682c6b287d673
MD5 ff22ef6d601cddd7548bb11e67a650e9
BLAKE2b-256 1296bbe478c5f49e8b66d503d0446d2cd63ef49035416c7406debb89d0ecee1d

See more details on using hashes here.

File details

Details for the file acdh_django_charts-0.6.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for acdh_django_charts-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e13a10e24fe7f275544384a759be5fcf3c52ce70c74465d449e5ba75f84f845f
MD5 25c53c4fbba20aa322d44e8a7710334c
BLAKE2b-256 77f91bd8e9bcc761329b32d0233125592d37d09d945df41cfbe816b9076cde1b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page