莫里斯图表& Web Api

时间:2015-07-15 13:15:47

标签: javascript html angularjs morris.js

我正在尝试使用datawebapi 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" }];

0 个答案:

没有答案