%h1 Evolution du nombre de signatures "animal pétition"

-start_date = Time.parse("2016/04/20")

<div>
<canvas id="ca_stats" height="200" width="600"></canvas>
</div>

-labels = []
-datas_ht = []

-date = start_date.end_of_day


-while date <= Time.now.end_of_day
  -labels << l(date, :format => "%a %d %b")
  -ht = AnimalPetitionSignator.where("created_at >= ? and created_at <= ?",start_date,date).count
  
  -datas_ht << ht
  
  -date = date.tomorrow.end_of_day




<script>
var lineChartData2 = {
=raw"labels : #{labels.to_json},"
datasets : [
{
label: "Nbr signatures",
fillColor : "rgba(22,156,67,0.1)",
strokeColor : "rgba(22,156,67,1)",
pointColor : "rgba(22,156,67,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(220,220,220,1)",
=raw"data : #{datas_ht.to_json}"

}
]

}


var ctx2 = document.getElementById("ca_stats").getContext("2d");
new Chart(ctx2).Line(lineChartData2, {
responsive: true,
bezierCurve : false
});




</script>