我已将数据放入饼图的正确格式。我有json内部的对象数组,填充我的ng-repeat。我在该数据属性中的表达式出现语法错误。 错误
错误:[$ parse:syntax]语法错误:表达式[{{subdivision.chartBldArry}}]第2列的令牌'{'无效键,从[{subdivision.chartBldArry}}开始。
视图
<div class="col-xs-1 p-r-0 ">
<canvas doughnutchart options="mapSubCtrl.doughnutOptions" data="{{subdivision.chartBldArry}}" height="40"></canvas>
</div>
<div class="col-xs-1 p-r-0 ">
<canvas doughnutchart options="mapSubCtrl.doughnutOptions" data="{{subdivision.chartInvArry}}" height="40"></canvas>
</div>
<div class="col-xs-1 p-r-0 ">
<canvas doughnutchart options="mapSubCtrl.doughnutOptions" data="{{subdivision.chartLoeArry}}" height="40"></canvas>
</div>
<div class="col-xs-1 p-r-0 ">
<canvas doughnutchart options="mapSubCtrl.doughnutOptions" data="{{subdivision.chartLotsArry}}" height="40"></canvas>
</div>
json for ng-repeat
[{"type":"Feature","properties":{"id":122641,"name":"Green Acres (TH)","status":"Act 4Q07","show":false,"territoryId":2002},"metrics":{"bld":{"type":"Unknown","count":{"prod":0,"custom":0}},"inv":{"fut":0,"vdl":12,"mod":2,"fin":18,"uc":7,"total":27},"loe":{"bld":11,"inv":8,"size":12,"activity":17,"total":48},"lots":{"total":92,"total_active":0}},"geometry":{"type":"Point","coordinates":[-106.75845,34.659846]}},{"type":"Feature","properties":{"id":120715,"name":"Jardin de Belen","status":"Act 1Q05","show":false,"territoryId":2002},"metrics":{"bld":{"type":"Unknown","count":{"prod":0,"custom":0}},"inv":{"fut":0,"vdl":6,"mod":4,"fin":14,"uc":18,"total":36},"loe":{"bld":15,"inv":3,"size":6,"activity":2,"total":26},"lots":{"total":200,"total_active":0}},"geometry":{"type":"Point","coordinates":[-106.81188,34.649485]}},{"type":"Feature","properties":{"id":120746,"name":"Schollander Heights","status":"Act 3Q05","show":false,"territoryId":2002},"metrics":{"bld":{"type":"Unknown","count":{"prod":0,"custom":0}},"inv":{"fut":0,"vdl":2,"mod":1,"fin":5,"uc":2,"total":8},"loe":{"bld":8,"inv":12,"size":15,"activity":4,"total":39},"lots":{"total":44,"total_active":0}},"geometry":{"type":"Point","coordinates":[-106.80648,34.646378]}}]
请注意,即使我删除数据中的括号,错误也会消失,但不会显示任何数据 如果有人有推荐,我愿意接受不同的饼图。感谢
更新 plunker plunker
var app = angular.module("mainModule", ['angles']);
var MainController = function($scope,chartData,chartConfig) {
var vm = this;
vm.data = chartData;
vm.doughnutOptions = chartConfig.doughnutOptions;
};
app.controller("MainController", MainController);