admin 管理员组文章数量: 1086019
Here is the test :
$(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
},
});
});
}); /
I would like to have a chart with vertical xAxis labels with a top alignment.
In my real case, i would have many more data, so i can't do otherwise than a rotation.
I have tried the xAxis parameters : .labels
I thought the align would do the trick but when i add it to the rotation parameter, the chart is broken.
Thanks in advance.
Here is the test :
$(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/Y5Qhm/1/
I would like to have a chart with vertical xAxis labels with a top alignment.
In my real case, i would have many more data, so i can't do otherwise than a rotation.
I have tried the xAxis parameters : http://api.highcharts./highcharts#xAxis.labels
I thought the align would do the trick but when i add it to the rotation parameter, the chart is broken.
Thanks in advance.
Share Improve this question asked Jun 12, 2013 at 15:49 OverdoseOverdose 5851 gold badge9 silver badges32 bronze badges1 Answer
Reset to default 6Use:
align: 'top'
like this:
labels:{
rotation:90,
align: 'top'
//y:100,
},
jsFiddle: http://jsfiddle/Y5Qhm/2/
本文标签: javascriptHighchartsHow to fix labels to the top when xAxis rotation is 90176Stack Overflow
版权声明:本文标题:javascript - Highcharts : How to fix labels to the top when xAxis rotation is 90°? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744081382a2530311.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论