Skip to content

Commit bf01a4e

Browse files
committed
add visitors chart
1 parent 2b9e95e commit bf01a4e

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/app/controllers/UsageController.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
function UsageController() {
99
var vm = this;
1010

11+
// TODO: move data to the service
1112
vm.ramChartData = [{key: 'Memory', y: 768660}, { key: 'Cache', y: 367404}, {key: 'Swap', y: 41924 }];
1213
vm.storageChartData = [{key: 'System', y: 126560}, {key: 'Other', y: 224365 }];
1314

@@ -18,6 +19,7 @@
1819
donut: true,
1920
x: function (d) { return d.key; },
2021
y: function (d) { return d.y; },
22+
valueFormat: (d3.format(".0f")),
2123
color: ['rgb(0, 150, 136)', '#E75753', 'rgb(235, 235, 235)'],
2224
showLabels: false,
2325
showLegend: false,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
(function () {
2+
angular
3+
.module('app')
4+
.controller('VisitorsController', [
5+
VisitorsController
6+
]);
7+
8+
function VisitorsController() {
9+
var vm = this;
10+
11+
// TODO: move data to the service
12+
vm.visitorsChartData = [ {key: 'Mobile', y: 5264}, { key: 'Desktop', y: 3872} ];
13+
14+
vm.chartOptions = {
15+
chart: {
16+
type: 'pieChart',
17+
height: 210,
18+
donut: true,
19+
x: function (d) { return d.key; },
20+
y: function (d) { return d.y; },
21+
valueFormat: (d3.format(".0f")),
22+
color: ['rgb(0, 150, 136)', '#E75753'],
23+
showLabels: false,
24+
showLegend: false,
25+
title: 'Over 9K'
26+
}
27+
};
28+
}
29+
})();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<md-content ng-controller="VisitorsController as vm" class="md-padding" layout="row" layout-align="center center">
2+
<nvd3 options="vm.chartOptions" data="vm.visitorsChartData"></nvd3>
3+
</md-content>

0 commit comments

Comments
 (0)