我想在AngularJS中画一个条形图
这是我的html:
<canvas id="bar" class="chart chart-bar" chart-data="datta" chart-labels="labels" chart-legend="true">
</canvas> 我并没有太多地使用这个图表库,但是我的想法是,我想自定义我的图例,并且我想声明一个包含一些数据的数组,比如
$scope.legend = ["item1", "item2"]这个数组就是我想在我的图表下面显示的。有什么方法可以做到这一点吗?
提前感谢!
发布于 2016-07-05 03:02:56
我不确定我有没有拿到。如果您正在尝试设置图表的图例,则需要在图表选项中进行设置,而不是将chart-legend设置为true。你的html应该是这样的:
<canvas id="bar" class="chart chart-bar" chart-data="datta" chart-labels="labels" chart-options="chart-options"></canvas> 然后,您需要创建一个$ create .图表-选项如下:
$scope.chart-options = {
legend: {
display: true,
},
};你可以在这里获得更多信息:Chartjs legend documentation
https://stackoverflow.com/questions/38185477
复制相似问题