Commit 57ee161c authored by Mario Chirinos's avatar Mario Chirinos

chart

parent 8767a711
...@@ -134,23 +134,23 @@ ...@@ -134,23 +134,23 @@
{ {
label: "{{d.label}}", label: "{{d.label}}",
url: "{{d.url}}", url: "{{d.url}}",
value: "{{d.value}}" value: "{{d.value}}"
}, },
{% endfor %} {% endfor %}
], ],
resize: true resize: true
}).on('click', function(i, row){ }).on('click', function(i, row){
console.log(1,row); console.log(1,row);
document.location.href = "{% url 'news-list'%}?"+row.url; document.location.href = "{% url 'news-list'%}?"+row.url;
}); });
new Morris.Area({ new Morris.Area({
element: 'morris-area-chart', element: 'morris-area-chart',
data: [ data: [
{% for hh in histogram %} {% for hh in histogram %}
{ {
date:"{{hh.date}}", date:"{{hh.date}}",
{% for key,value in hh.data.items %} {% for key,value in hh.data.items %}
{{key}}:{{value}}, {{key}}:{{value}},
{% endfor %} {% endfor %}
}{% if not forloop.last %},{% endif %} }{% if not forloop.last %},{% endif %}
......
...@@ -224,6 +224,7 @@ def index(request): ...@@ -224,6 +224,7 @@ def index(request):
histogramsData = [ { "date":d["day"].strftime("%Y-%m-%d"), "data":{ "total": d["count"]}} for d in dateCount ] histogramsData = [ { "date":d["day"].strftime("%Y-%m-%d"), "data":{ "total": d["count"]}} for d in dateCount ]
histogramsLabels = ["total"] histogramsLabels = ["total"]
# return render(request,'index.html',{"form":form, "info":info, "donutChart":{}, "histogram": {}, "histogramsLabels":{}}) # return render(request,'index.html',{"form":form, "info":info, "donutChart":{}, "histogram": {}, "histogramsLabels":{}})
print(donutChart)
return render(request,'new/index.html',{"form":form, "info":info, "donutChart":donutChart, "histogram": histogramsData, "histogramsLabels":histogramsLabels}) return render(request,'new/index.html',{"form":form, "info":info, "donutChart":donutChart, "histogram": histogramsData, "histogramsLabels":histogramsLabels})
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
def publisherList(request, type="all"): def publisherList(request, type="all"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment