This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
memberdb/resources/theme/backend/adminlte/widgets/donut_chart.blade.php

81 lines
2.6 KiB
PHP
Raw Normal View History

2017-08-05 23:53:57 +00:00
@section('page-scripts')
<script src="https://code.highcharts.com/highcharts.js"></script>
<script type="text/javascript">
revenueData = [];
revenueData.push({ color: '#337ab7', name: 'Entitled', y: {{ array_get($chart,'entitled',0) }} });
revenueData.push({ color: '#0099e6', name: 'Over', y: {{ array_get($chart,'over',0) }} });
riskData = [];
riskData.push({ color: '#004d00', name: 'Actual', y: {{ array_get($chart,'actual',0) }} });
riskData.push({ color: '#7cd87c', name: 'Ahead', y: {{ array_get($chart,'ahead',0) }} });
riskData.push({ color: '#ffc48c', name: 'Behind', y: {{ $b=array_get($chart,'behind',0) }} });
riskData.push({ color: '#f0ad4e', name: 'Assigned', y: {{ ($a=array_get($chart,'assigned',0)) > $b ? $a-$b : $a }} });
riskData.push({ color: '#d9534f', name: 'Unassigned', y: {{ array_get($chart,'unassigned',0)-$b }} });
riskData.push({ color: '#0099e6', name: 'Over', y: {{ array_get($chart,'over',0) }} });
// Create the chart
Highcharts.chart('donutchart', {
chart: {
type: 'pie',
},
title: {
text: ''
},
yAxis: {
title: {
text: ''
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '40%'],
dataLabels: {
enabled: true,
crop: false,
},
},
},
exporting: {
enabled: false
},
credits: {
enabled: false
},
tooltip: {
valuePrefix: '$',
valueSuffix: 'm',
},
series: [{
name: 'Revenue',
data: revenueData,
size: '80%',
innerSize: '70%',
dataLabels: {
/*
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
*/
color: '#ffffff',
distance: 20,
}
}, {
name: 'Risk',
data: riskData,
size: '60%',
innerSize: '70%',
dataLabels: {
/*
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> $' + this.y + 'm' : null;
},
*/
distance: 20,
}
}]
});
</script>
@append