我正在学习 angular-chart-js 的阶段。我正在尝试使用 angular-chart.js 绘制饼图。但我无法找到一种在饼图上显示标签(不是工具提示)的方法,它描述了每个数据片。
这是我的做法:
angular.module('App').controller('Controller', ['$scope', '$http', '$location', '$window', '$routeParams',
function($scope, $http, $location, $window) {
var diskDataJson = {
"data": [80, 12],
"labels": [Used space, Free Space],
"colours": ['#9AB6F0', '#C2D3F6']
};
$scope.pieDiskData = json;
}
]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<table border="0" width="100%">
<tr>
<td style="border-left: 1px solid #0099CC" width="25%">
<center><span><label ng-bind-html="'load.static.dashboard.system.DUSAGE' | translate"/></span>
</center>
<canvas id="pie33" class="chart chart-pie chart-xs ng-isolate-scope" height="120" width="240" data="pieDiskData.data" labels="pieDiskData.labels" colours="pieDiskData.colours" legend="true"></canvas>
</td>
</tr>
</table>