chartjs:尝试旋转y轴标签 [英] chartjs: trying to rotate the y-Axis label
本文介绍了chartjs:尝试旋转y轴标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经尝试过 maxRotate
和 rotate
之类的东西,将它们放置在 scaleLabel
等。我在文档中找不到任何内容,并且在Google上的搜索结果也无济于事。
I've tried things like maxRotate
and rotate
, placing them in scaleLabel
and so on. I couldn't find anything in the docs, and the search results on google are not much of a help either.
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;
}
}
}]
}
}
});
推荐答案
您可以在Chart.js中旋转Y轴2.0具有tick属性。
You can rotate the Y-axis in Chart.js 2.0 with the tick property. There's a link here.
yAxes: [{
ticks : {
minRotation : 90
}
}]
在这里拨弄: https://jsfiddle.net/acmfk5p8/
有一个重复的问题在这里,但也没有答案。
There's a duplicate question here but it doesn't have an answer yet either.
这篇关于chartjs:尝试旋转y轴标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文