configure-line-chart.js 725 Bytes
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
(function () {
  'use strict';

  var app = angular.module('line', ['chart.js']);

  app.config(function (ChartJsProvider) {
    // Configure all charts
    ChartJsProvider.setOptions({
      chartColors: ['#FF5252', '#FF8A80']
    });
    // Configure all line charts
    ChartJsProvider.setOptions('line', {
      showLines: false
    });
  });

  app.controller('LineCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
    $scope.labels = ['Series A', 'Series B'];
    $scope.data = [[15, 23], [59, 80]];

    // Configure only this instance
    $scope.options = {
      legend: {
        display: false
      }
    };

    $timeout(function () {
      $scope.data = [[15, 23], [59, 80]];
    }, 0);
  }]);

})();