我嘗試了劍道圖表與角度,我有顯示數據的問題,這裏是我的代碼:劍道+角圖表數據
HTML:
<div kendo-chart="rchart" data-k-options="chartOptions" data-role="chart" class="k-chart" style="position: relative;"></div>
的Javascript:
resultService.getResult().then(function (resultResponse) {
$scope.data = resultResponse.data;
$scope.oldReps = _.pluck($scope.data.TreningScores.Item1, 'Item2');
$scope.newReps = _.pluck($scope.data.TreningScores.Item2, 'Item2');
$scope.categories = _.pluck($scope.data.TreningScores.Item1, 'Item1');
});
$scope.chartOptions = {
legend: {
position: "bottom"
},
seriesDefaults: {
type: "column"
},
series: [{
name: "Total Visits",
data: $scope.oldReps
}, {
name: "Unique visitors",
data: $scope.newReps
}],
valueAxis: {
line: {
visible: false
}
},
tooltip: {
visible: true,
format: "{0}"
}
};
問題是圖表沒有更新從服務器獲取數據後,我試過像這樣刷新圖表(但沒有運氣):
$scope.chart = {
refreshChart : function() {
$scope.rchart.refresh();
},
};
,並呼籲在這個方法:
resultService.getResult().then(function (resultResponse) {});
而且我也試圖定義$scope.chartOptions
相同的功能,但裏面什麼也沒有。有沒有什麼辦法解決這一問題 ?
@喬治 - 布萊頓我有點晚對這個答覆的一方,但看看我的簡化的解決方案和示例:http://stackoverflow.com/a/39739389/1467810 – TaeKwonJoe