如何更改角chart.js之色 [英] How to change colours for Angular-Chart.js
问题描述
我用角chart.js之(在AngularJS chart.js之版本)来创建一个条形图。图表正在与除颜色的选项。
I use Angular-Chart.js (the AngularJS Chart.js version) to create a bar chart. The Chart is working with the options except for the colours.
即使我把他们来说,这表示在文档,他们留灰色。
Even if I set them it is indicated in the documentation, they stay grey.
<div class="graph-display" ng-controller="chartController">
<canvas class="chart chart-bar"
data="bilans.data"
labels="bilans.labels"
series="bilans.series"
options="{
scaleShowHorizontalLines: true,
scaleShowVerticalLines: false,
tooltipTemplate: '<%= value %> $',
responsive: true
}"
colours="{
fillColor: 'rgba(47, 132, 71, 0.8)',
strokeColor: 'rgba(47, 132, 71, 0.8)',
highlightFill: 'rgba(47, 132, 71, 0.8)',
highlightStroke: 'rgba(47, 132, 71, 0.8)'
}"
></canvas>
</div>
其实,选项工作,但颜色不是。难道我做错了什么?
Actually, the options are working but the colours are not. Am I doing something wrong?
推荐答案
您应该声明颜色
对象的数组
"colours": [{
fillColor: 'rgba(47, 132, 71, 0.8)',
strokeColor: 'rgba(47, 132, 71, 0.8)',
highlightFill: 'rgba(47, 132, 71, 0.8)',
highlightStroke: 'rgba(47, 132, 71, 0.8)'
}];
有关详细信息请参阅<一个href=\"http://stackoverflow.com/questions/28278178/load-json-to-display-data-using-ng-repeat/28278331#28278331\">this帖子 / <一个href=\"http://stackoverflow.com/questions/28278096/angular-js-loading-data-for-chart/28278459#28278459\">this了。
For more info refer this post / this too.
这篇关于如何更改角chart.js之色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!