我正在尝试使用data
将webapi
get
请求返回的morris
插入chart
angularjs
,但它无效。< / p>
HTML:
<div class="panel-body">
<barchart xkey="xkey" ykeys="ykeys" labels="labels" data="myModel"></barchart>
</div>
Angularjs:
$scope.myModel = [];
dataService.getItems(baseAddress + '/GetMorrisChart')
.success(function (data) {
$scope.myModel = data;
})
.error(function () {
toastr.error("Error loading plan stats");
});
$scope.xkey = 'Period';
$scope.ykeys = ['TotalAmount', 'TotalDueAmount'];
$scope.labels = ['Total Amount', 'Total Due Amount'];
数据:
[{ "TotalAmount": "56000", "TotalDueAmount": 90000, "Period": "May" }, { "TotalAmount": "68000", "TotalDueAmount": 5400000, "Period": "Jul" }, { "TotalAmount": "89000", "TotalDueAmount": 90000, "Period": "Sep" }, { "TotalAmount": "23000", "TotalDueAmount": 270000, "Period": "Sep" }];