iPad 上的曲线颜色是深灰色而不是红色。如何解决这个问题?
Curve color is dark grey instead of red on iPad. How to solve this?
我想做下面那种曲线,但是不行Ipad。
颜色显示为灰色。
这是 ChartJS 的错误还是我们可以做些什么?
当类型的值为 "line" 时出现此问题。
当类型的值为 "bar" 时,它适用于 Ipad。
你知道处理这个问题的方法吗?
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script>
<div class="chart-container" style="position: relative; margin-top:30px; height:60vh; width:90vh">
<canvas id="myChart"></canvas>
问题来自 backgroundColor 和 borderColor 中的列表。
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'rgba(255, 159, 64, 0.2)',
borderColor: 'rgba(255,99,132,1)',
borderWidth: 1
}
的确,对于 kind 等于 bar 我们可以为每个标签设置一种颜色。
对于"line"这种类型,似乎我们不能有一个只有一个值的列表。
曲线下只能有一种颜色,边框只能有一种颜色。
我想做下面那种曲线,但是不行Ipad。 颜色显示为灰色。
这是 ChartJS 的错误还是我们可以做些什么?
当类型的值为 "line" 时出现此问题。
当类型的值为 "bar" 时,它适用于 Ipad。
你知道处理这个问题的方法吗?
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script>
<div class="chart-container" style="position: relative; margin-top:30px; height:60vh; width:90vh">
<canvas id="myChart"></canvas>
问题来自 backgroundColor 和 borderColor 中的列表。
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'rgba(255, 159, 64, 0.2)',
borderColor: 'rgba(255,99,132,1)',
borderWidth: 1
}
的确,对于 kind 等于 bar 我们可以为每个标签设置一种颜色。
对于"line"这种类型,似乎我们不能有一个只有一个值的列表。
曲线下只能有一种颜色,边框只能有一种颜色。