gpt4 book ai didi

chart.js - 图表 : trying to rotate the y-Axis label

转载 作者:行者123 更新时间:2023-12-02 08:35:37 26 4
gpt4 key购买 nike

我尝试过诸如 maxRotaterotate 之类的东西,将它们放在 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但它也还没有答案。

关于chart.js - 图表 : trying to rotate the y-Axis label,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45306604/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com