Fix : Adding graph colors for comparison

This commit is contained in:
Rulx Philome Alexis committed 2015-10-27 22:36:21 -04:00
1 parent 041cf98f87
commit 15e7065044
2 files changed
+19 -18

No files matched your search

+2 -2
View File
@@ -52,8 +52,8 @@ def json_average_by_dep(request):
def compBDep(request):
import datetime
days = [] #Getting the dates of the week
#date = datetime.date.today()
date = datetime.datetime.strptime("2015-01-27", "%Y-%m-%d").date()
date = datetime.date.today()
#date = datetime.datetime.strptime("2015-01-27", "%Y-%m-%d").date()
start_week = date - datetime.timedelta(date.weekday())
for i in range(7):
days.append(str(start_week + datetime.timedelta(i)))
+17 -16
View File
@@ -38,34 +38,35 @@ $(document).ready(function(){
//Gestion de la comparaison entre les departements
$(".dropdown-menu li a").click(function(){
if ($(this).attr("href") == "#rap1"){
$.get('/rapport/average',function(data,status){
// alert(data);
$.get('/rapport/pluviometrie/comp/',function(data,status){
//alert(data.jr);
//alert(data.table[0].dep);
var i;
var objs = data.table
//alert(data.table[0].nomDep)
//les coulleurs
fill = ["rgba(124,232,128,0.5)","rgba(4,11,95,0.5)","rgba(34,177,18,0.5)","rgba(140,171,17,0.5)","rgba(124,232,128,0.5)","rgba(4,39,28,0.5)"]
stroke = ["rgba(4,39,28,0.5)","rgba(4,39,28,0.5)","rgba(4,39,28,0.5)","rgba(4,39,28,0.5)","rgba(4,39,28,0.5)","rgba(4,39,28,0.5)","rgba(4,39,28,0.5)","rgba(4,39,28,0.5)","rgba(4,39,28,0.5)","rgba(4,39,28,0.5)"]
//les coulleurs
labl =[]
datasz = []
for(i=0;i<objs.length;i++){
labl.push(objs[i].dep)
datasz.push(objs[i].moy)
}
var lineChartData = {
labels : labl,
datasets : [
{
label: "My Second dataset",
fillColor : "rgba(101,178,200,0.2)",
strokeColor : "rgba(101,178,200,1)",
datasz.push({
label: "Graph for "+objs[i].nomDep,
fillColor : fill[i],
strokeColor : stroke[i],
pointColor : "rgba(101,178,200,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(101,178,200,1)",
data : [9,5,6,4,3]
}
]
data :objs[i].moyDep
})
}
var lineChartData = {
labels : data.jr,
datasets : datasz
}
var ctx = $("#canvas2").get(0).getContext("2d");
var myNewChart = new Chart(ctx).Line(lineChartData, {