Open levinlau opened 7 years ago
注释部分为数组,注释下为变量。 每次用过数组绑定,通过ng-repeat生成多个line graphs,跑着跑着,浏览器崩溃。
angular.module('nmsRealtime', ['angular-echarts']) .controller('nmsRealtimeCtrl', ['$scope', '$interval', 'nmsRealtimeService', function($scope, $interval, nmsRealtimeService) { / $scope.chartconfigarray = [ compose_config_data('test', 'some test1..'), compose_config_data('test', 'some test2..') ]; / $scope.chartconfig1 = compose_config_data('test', 'some tests..'); $scope.chartconfig2 = compose_config_data('test', 'some tests..');
$interval(function() { // $scope.chartdataarray = null; $scope.chartdata1 = null; $scope.chartdata2 = null; var rx_dp_array = []; var tx_dp_array = []; for (var i = 0; i < DP_SIZE; ++i) { rx_dp_array.push({x: i, y: Math.random() * 300 }); tx_dp_array.push({x: i, y: Math.random() * 300 }); } /* $scope.chartdataarray = [ [{name: 'rxpkts/s', datapoints: rx_dp_array }], [{name: 'txpkts/s', datapoints: tx_dp_array }] ]; */ $scope.chartdata1 = [{name: 'rxpkts/s', datapoints: rx_dp_array }]; $scope.chartdata2 = [{name: 'txpkts/s', datapoints: tx_dp_array }]; }, 20 * 1000); }])
注释部分为数组,注释下为变量。 每次用过数组绑定,通过ng-repeat生成多个line graphs,跑着跑着,浏览器崩溃。
angular.module('nmsRealtime', ['angular-echarts']) .controller('nmsRealtimeCtrl', ['$scope', '$interval', 'nmsRealtimeService', function($scope, $interval, nmsRealtimeService) { / $scope.chartconfigarray = [ compose_config_data('test', 'some test1..'), compose_config_data('test', 'some test2..')
]; / $scope.chartconfig1 = compose_config_data('test', 'some tests..'); $scope.chartconfig2 = compose_config_data('test', 'some tests..');