Rendering Highcharts using Angular js Directives

后端 未结 3 951
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 20:13

I am new to Angular JS and trying to render my highcharts (Basic Line) by creating a directive. Please tell me the approach I should follow here. Any help would be appreciat

3条回答
  •  -上瘾入骨i
    2020-11-30 21:05

    Example of pie chart:

    http://jsfiddle.net/csTzc/

        function MyCtrl($scope, limitToFilter) {
      $scope.ideas = [
        ['ideas1', 1],
        ['ideas2', 8],
        ['ideas3', 5]
      ];
    
      $scope.limitedIdeas = limitToFilter($scope.ideas, 2);
    }
    
    angular.module('myApp', [])
      .directive('hcPie', function () {
      return {
        restrict: 'C',
        replace: true,
        scope: {
          items: '='
        },
        controller: function ($scope, $element, $attrs) {
          console.log(2);
    
        },
        template: '
    not working
    ', link: function (scope, element, attrs) { console.log(3); var chart = new Highcharts.Chart(options); scope.$watch("items", function (newValue) { chart.series[0].setData(newValue, true); }, true); } } });

提交回复
热议问题