![](/img/trans.png)
[英]I would like to rotate yAxes scaleLabel in Angular Chart.js
[英]Rotate 90 degrees clockwise the scaleLabel (no ticks or labels) on a Chart.js line chart
如何在yAxis上將scaleLabel的顯示順時針旋轉90度? 不是刻度或標簽,而是單個元素,通常位於yAxis的左側。 在此示例中,包含字符串: labelString:'My Label'
var options = {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [
{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1
},
{
label: '# of Points',
data: [7, 11, 5, 8, 3, 7],
borderWidth: 1
}
]
},
options: {
scales: {
yAxes: [{
scaleLabel:{
display:true,
labelString:'My Label'
},
ticks: {
reverse: false
}
}]
}
}
}
var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
我的jsfiddle: https ://jsfiddle.net/aq57fxjp/
您可以通過注釋掉該行來獲得所需的效果
rotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI;
在源代碼中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.