사이트에서 차트를 만들고 있는데 chart.js에서 json 파일의 차트를 생성했습니다. 모든 것이 작동하지만 색상은 ... 세 개의 차트는 3 가지 회색 색상이며 나는 그 위로 향신료를주고 싶습니다 ...Chart.js의 색상이 손실 됨
내가 무엇을 놓쳤습니까? 당신이 chart.js 2.x에서와 chart.js에게 1.x에서 구문을 혼합 것 같은
var ctx = document.getElementById('speedchart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ti,
datasets: [{
label: 'Latency',
data: lt,
fillColor: "rgba(151,187,205,0.5)",
strokeColor: "rgba(0,255,0,1.0)"
}, {
label: 'Up speed',
data: up,
strokeColor: "rgba(255,0,0,0.4)"
}, {
label: 'Down speed',
data: dw,
strokeColor: "rgba(0,0,255,0.4)"
}]
}
});
당신이 예와 예제를 제공 할 수있는 문서를 보면 codepen? – Mazz
Heres that : http://codepen.io/macmattias/pen/LxBqBg –
코드가 codepen에서 작동하는지는 알 수 없습니다. 내 로컬 장치에서 읽은 코드가 아닌 것 같습니다. –