|
1 | | -(function(){ |
2 | | - angular |
3 | | - .module('app') |
4 | | - .controller('UsageController', [ |
5 | | - UsageController |
6 | | - ]); |
| 1 | +(function () { |
| 2 | + angular |
| 3 | + .module('app') |
| 4 | + .controller('UsageController', [ |
| 5 | + UsageController |
| 6 | + ]); |
7 | 7 |
|
8 | | - function UsageController() { |
9 | | - var vm = this; |
| 8 | + function UsageController() { |
| 9 | + var vm = this; |
10 | 10 |
|
11 | | - vm.chartOptions = { |
12 | | - pieHole: 0.5, |
13 | | - pieSliceTextStyle: { color: 'black' }, |
14 | | - legend: 'none', |
15 | | - tooltip : { isHtml: true }, |
16 | | - pieSliceText: 'none', |
17 | | - slices: { 0: { color: 'rgb(0, 150, 136)' }, 1: { color: '#E75753' }, 2: { color: 'rgb(235, 235, 235)' } } |
18 | | - }; |
19 | | - vm.ramChart = { |
20 | | - type: 'PieChart', |
21 | | - options: vm.chartOptions, |
22 | | - data: [ ['usedBy', 'percent'], ['Memory', 768660], ['Cache', 367404], ['Swap', 41924] ] |
23 | | - }; |
24 | | - vm.storageChart = { |
25 | | - type: 'PieChart', |
26 | | - options: vm.chartOptions, |
27 | | - data: [ ['usedBy', 'percent'], ['System', 126560], ['Other', 224365] ] |
28 | | - }; |
29 | | - } |
| 11 | + vm.ramChartData = [{key: 'Memory', y: 768660}, { key: 'Cache', y: 367404}, {key: 'Swap', y: 41924 }]; |
| 12 | + vm.storageChartData = [{key: 'System', y: 126560}, {key: 'Other', y: 224365 }]; |
| 13 | + |
| 14 | + vm.chartOptions = { |
| 15 | + chart: { |
| 16 | + type: 'pieChart', |
| 17 | + height: 130, |
| 18 | + donut: true, |
| 19 | + x: function (d) { return d.key; }, |
| 20 | + y: function (d) { return d.y; }, |
| 21 | + color: ['rgb(0, 150, 136)', '#E75753', 'rgb(235, 235, 235)'], |
| 22 | + showLabels: false, |
| 23 | + showLegend: false, |
| 24 | + title: '83%' |
| 25 | + } |
| 26 | + }; |
| 27 | + } |
30 | 28 | })(); |
0 commit comments