categories
Hello,I'm a green hand in using HighChats.
In my project,through setting categories,to emerge the title of XAixs.But the categories are to long,when set the rotation for -90,the charts overlap the categories.
Please tell me how to solve the problem,thank you.
the code as follows
chart = new Highcharts.Chart({
chart: {
renderTo: 'container', //图表容器Id
defaultSeriesType: 'spline', //图表类型 line, spline, area, areaspline, column, bar, pie , column,scatter
inverted: false, //左右显示,默认上下正向。假如设置为true,则横纵坐标调换位置
plotBackgroundColor: null,
plotBorderWidth: null,
zoomType: 'y',
spacingRight: 2, //图表距右侧的位置
spacingLeft: 2, //图表距右侧的位置
plotShadow: false
},
title: {
text: "测试图表标题" //图表标题
},
//Y轴坐标标题 labels:纵柱标尺
yAxis: {
min: -10,
max: 10,
title: {
enabled: false,
text: ''
},
labels: {
formatter: function() {
if (this.value == "" || this.value == null) {
return '0';
}
if (parseInt(this.value) == 0) {
return '1';
}
if (parseInt(this.value) > 0) {
return '1E+' + this.value;
}
if (parseInt(this.value) < 0) {
return '1E' + this.value;
}
}
}
},
xAxis: {
allowDecimals: false, //间隔不出现小数
gridLineWidth: 1,
categories: ['1Q/2008','2Q/2008','3Q/2008','4Q/2008','1Q/2009','2Q/2009','3Q/2009','4Q/2009','1Q/2010','2Q/2010','2Q/2011','3Q/2011'],
labels: {
rotation: -90, //坐标值显示的倾斜度
formatter: function() {
return this.value;
}
}
},
//当鼠标悬置数据点时的格式化提示
tooltip: {
formatter: function() {
return '<b>' + this.series.name + '</b>:<br/>' + this.point.xTtile + '; ' + this.point.name;
}
},
series: [{
type: "line", //图表类型
name: "测试图表名称", //图表名称
data: [{name:'2.71E-06',xTtile:'1Q/2008',y:-5.56},{name:'2.71E-10',xTtile:'2Q/2008',y:-10},{name:'1E-03',xTtile:'3Q/2008',y:-3},{name:'2.78E-06',xTtile:'3Q/2009',y:-5.55615484484342},{name:'5.07E-10',xTtile:'4Q/2009',y:-9.29462379898524},{name:'4.72E-09',xTtile:'1Q/2010',y:-8.32581892918103},{name:'-6.95E-08',xTtile:'2Q/2010',y:-7.15820447353134},{name:'3.22E-06',xTtile:'2Q/2011',y:-5.49256070748956},{name:'-2.61E-07',xTtile:'3Q/2011',y:-6.5829935748812}]
}]
});
1
vote
lybohe
shared this idea
-
lybohe commented
The labels of the YAXis also exist question。eg,when show '1E+2,1E-2,0,-1E-2,-1E+2' is correct. But now the '-1E-2' and '-1E+2' couldn't show,and the value of the YAxis like '1E+2,0,1E-2'
If someone know how to solve the problem,please tell me .Thank you.
My Email is liyan2004_xn@163.com