|
| 1 | +(function () { |
| 2 | + 'use strict'; |
| 3 | + |
| 4 | + var app = angular.module('charts', ['chart.js']); |
| 5 | + |
| 6 | + app.config(function (ChartJsProvider) { |
| 7 | + ChartJsProvider.setOptions('global', { |
| 8 | + legend: { |
| 9 | + display: true |
| 10 | + } |
| 11 | + }); |
| 12 | + }); |
| 13 | + |
| 14 | + app.controller('LineCtrl', ['$scope', '$timeout', function ($scope, $timeout) { |
| 15 | + $scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; |
| 16 | + $scope.series = ['Series A', 'Series B']; |
| 17 | + $scope.data = [ |
| 18 | + [65, 59, 80, 81, 56, 55, 40], |
| 19 | + [28, 48, 40, 19, 86, 27, 90] |
| 20 | + ]; |
| 21 | + $timeout(function () { |
| 22 | + $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; |
| 23 | + $scope.data = [ |
| 24 | + [28, 48, 40, 19, 86, 27, 90], |
| 25 | + [65, 59, 80, 81, 56, 55, 40] |
| 26 | + ]; |
| 27 | + $scope.series = ['Series C', 'Series D']; |
| 28 | + }, 0); |
| 29 | + }]); |
| 30 | + |
| 31 | + app.controller('BarCtrl', ['$scope', '$timeout', function ($scope, $timeout) { |
| 32 | + $scope.options = { scaleShowVerticalLines: false }; |
| 33 | + $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012']; |
| 34 | + $scope.series = ['Series A', 'Series B']; |
| 35 | + $scope.data = [ |
| 36 | + [65, 59, 80, 81, 56, 55, 40], |
| 37 | + [28, 48, 40, 19, 86, 27, 90] |
| 38 | + ]; |
| 39 | + $timeout(function () { |
| 40 | + $scope.options = { scaleShowVerticalLines: true }; |
| 41 | + }, 0); |
| 42 | + }]); |
| 43 | + |
| 44 | + app.controller('DoughnutCtrl', ['$scope', '$timeout', function ($scope, $timeout) { |
| 45 | + $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; |
| 46 | + $scope.data = [0, 0, 0]; |
| 47 | + // TODO: investigate why chart was not showing up without this hack |
| 48 | + $timeout(function () { |
| 49 | + $scope.data = [350, 450, 100]; |
| 50 | + }, 0); |
| 51 | + }]); |
| 52 | + |
| 53 | + app.controller('PieCtrl', ['$scope', '$timeout', function ($scope, $timeout) { |
| 54 | + $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales']; |
| 55 | + $scope.data = [0, 0, 0]; |
| 56 | + $timeout(function () { |
| 57 | + $scope.data = [350, 450, 100]; |
| 58 | + }, 0); |
| 59 | + }]); |
| 60 | + |
| 61 | + app.controller('PolarAreaCtrl', function ($scope) { |
| 62 | + $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales', 'Telesales', 'Corporate Sales']; |
| 63 | + $scope.data = [300, 500, 100, 40, 120]; |
| 64 | + }); |
| 65 | + |
| 66 | + app.controller('RadarCtrl', function ($scope) { |
| 67 | + $scope.labels = ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running']; |
| 68 | + $scope.data = [ |
| 69 | + [65, 59, 90, 81, 56, 55, 40], |
| 70 | + [28, 48, 40, 19, 96, 27, 100] |
| 71 | + ]; |
| 72 | + }); |
| 73 | +})(); |
0 commit comments