Skip to main content

Library to render chart using chartjs

Project description

Documentation

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

Quickstart

Install dj-chartjs:

pip install dj-chartjs

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'dj_chartjs',
    ...
)

How to render chart as a View:

in views.py import type chart to want use:

from django.views.generic.base import TemplateView
from django_charts.views import BarChartView

class ExampleChart(BarChartView, TemplateView):
    ...
    title = "Index of ..."
    id_chart = "barchart_example" #any value

    def generate_labels(self):
        return ["Africa","Brazil","Japan","EUA"]

    def generate_values(self):
        return [1,10,15,8]

in your template that you want render chart, use this tag:

{% load dj_chartjs %}

{% render_chart chart %}

Features

  • TODO

Running Tests

Does the code actually work?

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

History

0.1.0 (2020-03-30)

  • 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

dj-chartjs-0.1.1.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

dj_chartjs-0.1.1-py2.py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 2 Python 3

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