diff --git a/app/views/admin/conferences/_doughnut_chart.html.haml b/app/views/admin/conferences/_doughnut_chart.html.haml index c8ef55fc..f4a8f0ba 100644 --- a/app/views/admin/conferences/_doughnut_chart.html.haml +++ b/app/views/admin/conferences/_doughnut_chart.html.haml @@ -1,6 +1,23 @@ .text-center %h4 #{title} - %canvas.doughnut_chart{ 'data-chart' => data.to_json } + %canvas.doughnut_chart{ id: "dough_#{title}", 'data-chart' => data.to_json } - if data - data.each do |key, value| %span{ 'style' => "border-bottom: 3px solid #{value['color']}" } #{key}: #{value['value']} + +:javascript + $(document).ready( function(){ + + var d = $("#dough_#{title}"); + var dt = d.get(0).getContext('2d'); + + $(window).resize( respondCanvas ); + + function respondCanvas(){ + dt.canvas.width = 150; + dt.canvas.height = 150; + } + + respondCanvas(); + + }); diff --git a/app/views/admin/conferences/_line_chart.html.haml b/app/views/admin/conferences/_line_chart.html.haml index cd49df10..12d825e7 100644 --- a/app/views/admin/conferences/_line_chart.html.haml +++ b/app/views/admin/conferences/_line_chart.html.haml @@ -27,3 +27,21 @@ %span{ 'style' => "border-bottom: 3px solid #{conference[:color]};", 'data-chart' => "#{name}" } %input{ 'type' => 'checkbox', 'name' => "#{conference[:short_title]}" } #{conference[:short_title]} + +:javascript + $(document).ready( function(){ + + var c = $("#line_chart_#{name}"); + var ct = c.get(0).getContext('2d'); + var container = $(c).parent(); + + $(window).resize( respondCanvas ); + + function respondCanvas(){ + c.attr('width', $(container).width() ); + c.attr('height', $(container).height() ); + } + + respondCanvas(); + + });