samedi 25 juin 2016

How to mix charts with django and the Chartkick library

I've been searching and trying on my own but I can't manage to mix two different charts with this library. I can have two column-charts on the same board but I can't have a line and a column and I didn't see any references to that on the webdoc of Chartkickso far.

views.py :

stats_rpc_home_dry={}
stats_rpc_com_dry={}


for food in data_dry:
    stats_rpc_home_dry[food.title]=float(food.rpc_home)
    stats_rpc_com_dry[food.title]=float(food.rpc)

stats_dry=[{'data':stats_rpc_home_dry,'name':'Our RPC'},
       {'data':stats_rpc_com_dry,'name':'Their RPC'}]

return render(request, 'data/save.html', {'data_dry':data_dry, 'stats_dry':stats_dry})

save.html :

{% extends 'data/basic.html' %}
{% load bootstrap3 %}
{% load chartkick %}
{% block container %}
{% column_chart stats_dry %}
{% endblock %}

Everything is working, except instead of having two columns I rather have a column and a line but I don't understand how it supposed to be expressed in the HTML tags. It might be obvious but I really need to be reminded of the obvious.

I'm currently using the GoogleChart API here.

Any help appreciated guys !

Aucun commentaire:

Enregistrer un commentaire