我已经安装并包含了angualr-chart.js和chart.js的脚本。我在我的模块中注入了chart.js,并在我的dashboardCtrl
中定义了以下内容 self.pie= {};
self.labels = ["January", "February", "March", "April", "May", "June", "July"];
self.series = ['Series A', 'Series B'];
self.data = [
[65, 59, 80, 81, 56, 55, 40],
[28, 48, 40, 19, 86, 27, 90]
];
我的html文件中有以下内容
<div class = "col no-padding">
<div class="card card-pie-chart no-padding">
<div class="item item-text-wrap">
<canvas id="line" class="chart chart-line" data="dashboardCtrl.data" labels="dashboardCtrl.labels" legend="true" series="dashboardCtrl.series" options="{showTooltips: false}"></canvas>
</div>
</div>
</div>
输出如下,控制台中没有错误。请注意,我可以在Html文件中从控制器访问我的数据。[]中间是我的帆布卡,它溢出1
答案 0 :(得分:1)
我设法解决了我的问题。这就是我在每个标签之前都缺少前缀图表。
<canvas id="line" class="chart chart-pie" chart-colors="dashboardCtrl.labelColors" chart-data="dashboardCtrl.data" chart-labels="dashboardCtrl.labels" legend="true" chart-series="dashboardCtrl.series" chart-options="{showTooltips: false}"></canvas>