我在我的范围内定义了颜色:
$scope.colours = [{ // grey
backgroundColor: 'rgba(148,159,177,0.2)',
pointBackgroundColor: 'rgba(148,159,177,1)',
pointHoverBackgroundColor: 'rgba(148,159,177,1)',
borderColor: 'rgba(148,159,177,1)',
pointBorderColor: '#70ff06',
pointHoverBorderColor: 'rgba(148,159,177,0.8)'
},
{ // dark grey
backgroundColor: 'rgba(77,83,96,0.2)',
pointBackgroundColor: 'rgba(77,83,96,1)',
pointHoverBackgroundColor: 'rgba(77,83,96,1)',
borderColor: 'rgba(77,83,96,1)',
pointBorderColor: '#2129ff',
pointHoverBorderColor: 'rgba(77,83,96,0.8)'
},
{ // dark grey
backgroundColor: 'rgba(77,83,96,0.2)',
pointBackgroundColor: 'rgba(77,83,96,1)',
pointHoverBackgroundColor: 'rgba(77,83,96,1)',
borderColor: 'rgba(77,83,96,1)',
pointBorderColor: '#2129ff',
pointHoverBorderColor: 'rgba(77,83,96,0.8)'
}];
和在html中定义的画布:
<canvas id="line" class="chart chart-line" chart-data="data"
chart-labels="labels" chart-series="series" chart-options="options" chart-colors="colors"
chart-dataset-override="datasetOverride" chart-click="onClick">
</canvas>
但是它没有在页面上做任何更改。我还尝试了“$scope.colors”而不是“$scope.colors”和“chart colors”属性而不是“chart colors”。有人知道如何让它工作吗?