gpt4 book ai didi

javascript - Highcharts : How to fix labels to the top when xAxis rotation is 90°?

转载 作者:行者123 更新时间:2023-11-29 09:53:41 25 4
gpt4 key购买 nike

这是测试:

$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: 'Long xAxis legends',
},
xAxis: {
categories: ['a long category name', 'another long category name', 'a very long category name', 'Thats enormous', 'short', 'a long category name', 'another long category name', 'a very long category name', 'Thats enormous', 'short'],
labels:{
rotation:90,
y:100,
},
},
series: [
{
name: 'Some values',
data: [10, 20, 53, 2.51, 1.35, 10, 20, 53, 2.51, 1.35],
},
{
name: 'Other values',
data: [22.40, 0.15, 40, 10.73, 13, 22, 15, 40.11, 10, 13],
}
],
legend: {
layout: 'vertical',
align: 'top',
verticalAlign: 'top',
x: 50,
y: 65,
borderWidth: 0,
margin: 30
},
});
});

}); http://jsfiddle.net/Y5Qhm/1/

我想要一个带有顶部对齐的垂直 xAxis 标签的图表。

在我的真实情况下,我会有更多的数据,所以我只能轮换。

我试过 xAxis 参数: http://api.highcharts.com/highcharts#xAxis.labels

我认为对齐可以解决问题,但是当我将它添加到旋转参数时,图表已损坏。

提前致谢。

最佳答案

使用:

align: 'top'

像这样:

labels:{
rotation:90,
align: 'top'
//y:100,
},

jsFiddle:http://jsfiddle.net/Y5Qhm/2/

关于javascript - Highcharts : How to fix labels to the top when xAxis rotation is 90°?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17069903/

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