mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
23 lines
518 B
Text
23 lines
518 B
Text
.text-center
|
|
%h4 #{title}
|
|
%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();
|
|
|
|
});
|