-1
我想使用角度js每30秒重新加載圖表。如何重新加載圖表顯示在角JS使用的setInterval(函數()最新values.how?如何重新加載融合圖表中,每30秒。如何使用angularjs每30秒刷新圖表
代碼
var app = angular.module('myApp', ["ng-fusioncharts"]);
app.controller('myCtrl', function ($scope, $http) {
$scope.chartData = {
"chart": {
"caption": "chart 1",
"lowerLimit": "0",
"upperLimit": "100",
"showValue": "1",
"valueBelowPivot": "1",
"theme": "fint",
"width": '50%',
"height": '50%'
},
"colorRange": {
"color": [{
"minValue": "0",
"maxValue": "30",
"code": "#6baa01"
}, {
"minValue": "31",
"maxValue": "70",
"code": "#f8bd19"
}, {
"minValue": "71",
"maxValue": "100",
"code": "#e44a00"
}]
},
"dials": {
"dial": [{
"value": "@Model[0].Filled.ToString("N2")"
}]
}
};
});
<div class="container" ng-app="myApp" ng-controller="myCtrl">
<fusioncharts id="chartContainer1" width="300" height="300" type="angulargauge" datasource={{chartData}}></fusioncharts>
<div>
'和'30000'時間$ interval'將使招(*注意:不要忘了'$ destroy'事件*清除異步事件) –
如果你想acheive實時更新,我會建議嘗試使用套接字技術。 – Nicolas
http://tutorials.jenkov.com/angularjs/timeout-interval.html – PhatBuck