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 = \
        PivotDataPool(
           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 = \
        PivotChart(
            datasource = rainpivotdata,
            series_options =
              [{'options':{
                  'type': 'column',
                  'stacking': True},
                'terms':[
                  'avg_rain']}],
            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.

Previous
Next Post »

2 comments

Write comments
Unknown
AUTHOR
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 ?

Reply
avatar
Pranav Singh
AUTHOR
9 March 2017 at 08:47 delete

Hi Refer the link
http://www.aspdotnet-pools.com/search/label/Asp.Net%20Chart
http://www.aspdotnet-pools.com/search/label/Column%20Chart%20With%20DataTable

Reply
avatar

E-mail Newsletter

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

Recent Articles