Skip to content

Commit d0c18ef

Browse files
committed
add memory chart
1 parent 45b065f commit d0c18ef

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(function () {
2+
angular
3+
.module('app')
4+
.controller('MemoryController', [
5+
MemoryController
6+
]);
7+
8+
function MemoryController() {
9+
var vm = this;
10+
11+
// TODO: move data to the service
12+
vm.memoryChartData = [ {key: 'memory', y: 42}, { key: 'free', y: 58} ];
13+
14+
vm.chartOptions = {
15+
chart: {
16+
type: 'pieChart',
17+
height: 210,
18+
donut: true,
19+
pie: {
20+
startAngle: function (d) { return d.startAngle/2 -Math.PI/2 },
21+
endAngle: function (d) { return d.endAngle/2 -Math.PI/2 }
22+
},
23+
x: function (d) { return d.key; },
24+
y: function (d) { return d.y; },
25+
valueFormat: (d3.format(".0f")),
26+
color: ['rgb(0, 150, 136)', 'rgb(191, 191, 191)'],
27+
showLabels: false,
28+
showLegend: false,
29+
tooltips: false,
30+
title: '42%',
31+
titleOffset: -10,
32+
margin: { bottom: -80, left: -20, right: -20 }
33+
}
34+
};
35+
}
36+
})();

src/app/controllers/UsageController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
showLabels: false,
2525
showLegend: false,
2626
title: '83%',
27-
margin: { top: -10 }
27+
margin: { top: -10, left: -20, right: -20 }
2828
}
2929
};
3030
}

src/app/controllers/WarningsController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
chart: {
2424
type: 'lineChart',
2525
height: 210,
26-
margin: { left: -20, right: -20 },
26+
margin: { top: -10, left: -20, right: -20 },
2727
x: function (d) { return d.x },
2828
y: function (d) { return d.y },
2929
showLabels: false,

src/app/stylesheets/_custom.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ $warning-color: #E75753;
99
$left-sidenav-width: 110px;
1010
$widget-height: 310px;
1111
$font-weight-bold: 600;
12+
$font-size-large: 22px;
1213

1314

1415
// LAYOUT
@@ -101,7 +102,7 @@ body {
101102
}
102103

103104
.custom-tooltip {
104-
font-size: 24px;
105+
font-size: $font-size-large;
105106
color: $text-color;
106107
text-align: center;
107108
}
@@ -144,6 +145,7 @@ md-radio-button.md-accent.md-checked .md-label span {
144145
.nvd3.nv-pie .nv-pie-title {
145146
fill: rgb(68, 68, 68);
146147
font-weight: $font-weight-bold;
148+
font-size: $font-size-large !important;
147149
}
148150

149151
.nvtooltip {

src/app/views/partials/memory.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<md-content ng-controller="MemoryController as vm" class="md-padding" layout="row" layout-align="center center">
2+
<nvd3 options="vm.chartOptions" data="vm.memoryChartData"></nvd3>
3+
</md-content>

0 commit comments

Comments
 (0)