如何在yAxis上顺时针旋转90度的scaleLabel?不是刻度线或标签,而是通常位于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/
答案 0 :(得分:0)
您可以通过注释掉
来获得所需的效果rotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI;
在源代码中。