Recent news

Tuesday, 10 May 2016

Django chartit: A jQuery Chart Plugin To Draw Cool Chart

Django-chartit is a jquery chart plugin to display chart in your web application. This plugin uses highcharts and jquery javascript libraries to render the charts on the webpage.

How To Use
1.       1. Add the below library reference
a.       jQuery
b.      High Chart
2.       2. Now add the below code.

from chartit import PivotDataPool, PivotChart

def rainfall_pivot_chart_view(request):
    #Step 1: Create a PivotDataPool with the data we want to retrieve.
    rainpivotdata = \
           series =
            [{'options': {
               'source': DailyWeather.objects.all(),
               'categories': ['month']},
              'terms': {
                'avg_rain': Avg('rainfall'),
                'legend_by': ['city'],
                'top_n_per_cat': 3}}

    #Step 2: Create the PivotChart object
    rainpivcht = \
            datasource = rainpivotdata,
            series_options =
                  'type': 'column',
                  'stacking': True},
            chart_options =
              {'title': {
                   'text': 'Rain by Month in top 3 cities'},
               'xAxis': {
                    'title': {
                       'text': 'Month'}}})

    #Step 3: Send the PivotChart object to the template.
    return render_to_response({'rainpivchart': rainpivcht})

Pranav Singh Author: Pranav Singh

Hello, I am Author of this blog. The main purpose of this blog is to provide all the jQuery plugins which is helpful in designing and developing a web application in a single location from the web.

Next Post »


Write comments
29 November 2016 at 17:00 delete

Can we use chartit for creating dynamic chart ? for example, I am getting datas form db and when a row added ı want to charts updated. is it possible with chartit ?

Pranav Singh
9 March 2017 at 08:47 delete

Hi Refer the link


E-mail Newsletter

Sign up now to receive breaking news and to hear what's new with us.

Recent Articles