我尝试过像maxRotate
和rotate
这样的东西,把它们放在scaleLabel
等等。我在文档中找不到任何内容,谷歌上的搜索结果也没什么帮助。
var myChart = new Chart(ctx, {
type: 'line',
data: chartData,
options: {
elements: {
point: {
radius: 0
}
},
scales: {
yAxes: [{
ticks: {
beginAtZero:true
},
scaleLabel: {
display: true,
labelString: 'MW',
},
}],
xAxes: [
{
gridLines: {
display: false ,
color: "#FFFFFF"
},
ticks: {
callback: function(tick, index, array) {
return (index % 2) ? "" : tick;
}
}
}]
}
}
});
您可以使用tick属性在Chart.js 2.0中旋转Y轴。这里有一个链接。
yAxes: [{
ticks : {
minRotation : 90
}
}]
在这里小提琴:https://jsfiddle.net/acmfk5p8/
有一个重复的问题here但它也没有答案。