我正在关注 Chart.js 示例。但是,当我尝试渲染该示例时,出现以下错误:
未捕获的类型错误:无法读取未定义的属性“绘制”
这是我正在关注的示例。我已经相应地做了所有事情,但我不知道为什么会导致这个问题。 http://carlcraig.github.io/tc-angular-chartjs/doughnut/
下面是我对该示例的实现。我的模块
angular.module('main')
.controller('AboutController', ['$scope', function ($scope) {
$scope.data = [
{
value: 300,
color: '#F7464A',
highlight: '#FF5A5E',
label: 'Red'
},
{
value: 50,
color: '#46BFBD',
highlight: '#5AD3D1',
label: 'Green'
},
{
value: 100,
color: '#FDB45C',
highlight: '#FFC870',
label: 'Yellow'
}
];
// Chart.js Options
$scope.options = {
// Sets the chart to be responsive
responsive: true,
//Boolean - Whether we should show a stroke on each segment
segmentShowStroke: true,
//String - The colour of each segment stroke
segmentStrokeColor: '#fff',
//Number - The width of each segment stroke
segmentStrokeWidth: 2,
//Number - The percentage of the chart that we cut out of the middle
percentageInnerCutout: 50, // This is 0 for Pie charts
//Number - Amount of animation steps
animationSteps: 100,
//String - Animation easing effect
animationEasing: 'easeOutBounce',
//Boolean - Whether we animate the rotation of the Doughnut
animateRotate: true,
//Boolean - Whether we animate scaling the Doughnut from the centre
animateScale: false,
//String - A legend template
legendTemplate: '<ul class="tc-chart-js-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'
};
}]);
这是我的html代码
<canvas tc-chartjs-doughnut chart-options="options" chart-data="data" auto-legend></canvas>
我应该补充一点,我能够渲染图表的图例。