Skip to main content

UNKNOWN

Project description

Create beautiful Javascript charts with minimal code. Python port of Chartkick

Usage

Load charkick from a template:

{% load chartkick %}

And draw charts:

{% line_chart data %}

{% pie_chart data with height=400px %}

{% column_chart data with min=400 max=1000 %}

data is context variable passed to the template:

def view(request):
    data = {'Strawberry': 23, 'Apple': 21, 'Grape': 13, 'Blueberry': 44, 'Banana': 22}
    return render(request, 'template.html', {'data': data})

To draw users join chart:

def view(request):
    qs = User.objects.values('join_date').order_by('-join_date')
    data = qs.annotate(count=Count('join_date'))

    data = dict(map(lambda x: (x['join_date'], x['count']), data))
    return render(request, 'template.html', {'data': data})

Installation

Install chartkick:

$ pip install chartkick

Add chartkick to INSTALLED_APPS and STATICFILES_DIRS:

INSTALLED_APPS = (
    'chartkick',
)

import chartkick
STATICFILES_DIRS = (
    chartkick.js(),
)

And chartkick scripts to the header of base template:

{% include_chartkick_scripts googlecharts%}

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

chartkick-0.0.1.tar.gz (7.0 kB view details)

Uploaded Source

File details

Details for the file chartkick-0.0.1.tar.gz.

File metadata

  • Download URL: chartkick-0.0.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for chartkick-0.0.1.tar.gz
Algorithm Hash digest
SHA256 05a79f386ae6038aefc597dff102f7697f5c68730ad29e22b1824a7558cc1994
MD5 c4d54d5736bb2fc575828898cf23a8ad
BLAKE2b-256 30a5c5ea88c14f410e71991b751184338597d9cb1045b6bcfe02d0e004b02ee9

See more details on using hashes here.

Supported by

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