0
막대 차트의 각 막대는 chartjs 2.0 분기에서 각도 차트를 사용하여 다른 색상을 갖게합니까?막대 차트마다 각기 다른 색상을 갖는 차트 chart.js v2
내 캔버스는 다음과 같습니다
내 GBCC 컨트롤러는 다음과 같습니다<canvas class="chart chart-bar"
chart-data="GBCC.setData"
chart-labels="GBCC.labels"
chart-options="GBCC.options"
chart-colors="GBCC.colors"
height="68"
width="300">
</canvas>
:
this.labels = ['hello', 'world', 'foobar'];
this.setData = [[50, 20, 95]];
this.colors = [
'#DCDCDC', // light grey
'#F7464A', // red
'#46BFBD', // green
];
this.options = {
scales: {
yAxes: [{
display: true,
ticks: {
beginAtZero: true,
min: 0,
max: 100,
stepSize: 20
}
}]
}
};
그것은 배열의 첫 번째 색상에 모든 막대를 변경할 수 있지만, 다른를 사용하지 않습니다 그림 물감. 어느 누구도이 일을하는 방법을 알고 있습니까? 이 지시어의 convertColor의 코드 리뷰에서입니다
this.color = [
{ backgroundColor: [
'#DCDCDC', // light grey
'#F7464A', // red
'#46BFBD', // green
]};
및 컬러 기능을 얻을 :