Fixed growing of doughnut charts on scrolling.

Charts were growing on many pages due to spaces in id.
Fixes #1903
This commit is contained in:
Rishabh Singh 2017-12-22 13:27:44 +05:30 committed by Stella Rouzi
parent 3afe905448
commit 0091d87dc9

View file

@ -1,6 +1,6 @@
.text-center .text-center
%h4 #{title} %h4 #{title}
%canvas.doughnut_chart{ id: "dough_#{title}", 'data-chart' => data.to_json } %canvas.doughnut_chart{ id: "dough_#{title.parameterize.underscore}", 'data-chart' => data.to_json }
- if data - if data
- data.each do |key, value| - data.each do |key, value|
%span{ 'style' => "border-bottom: 3px solid #{value['color']}" } #{key}: #{value['value']} %span{ 'style' => "border-bottom: 3px solid #{value['color']}" } #{key}: #{value['value']}
@ -8,7 +8,7 @@
:javascript :javascript
$(document).ready( function(){ $(document).ready( function(){
var d = $("#dough_#{title}"); var d = $("#dough_#{title.parameterize.underscore}");
var dt = d.get(0).getContext('2d'); var dt = d.get(0).getContext('2d');
$(window).resize( respondCanvas ); $(window).resize( respondCanvas );