admin管理员组文章数量:1416314
Please take a look at this fiddle for the chart I am building.
My issues are:
- Y-Axis labels and percentages overlap. Is it possible to align them so that I have green percentages, the label "Two", then red percentages and finally the label "Three"? If you take a look at another fiddle it certainly looks tidier.
- Highstock shows its labels inside the graph grid. Can these be pushed to the outside so that the labelling looks more like the way my second JSFiddle displays them?
The first issue is most important for me to solve, and the second I could live with if I have to:
chart = new Highcharts.StockChart({
chart: {
renderTo: 'container',
zoomType: 'xy'
},
rangeSelector: {
selected: 4
},
yAxis: [{
title: {
text: 'One',
style: {
color: 'blue'
}
},
labels: {
formatter: function() {
return (this.value > 0 ? '+' : '') + this.value + '%';
}
}
},
{
title: {
text: 'Two',
style: {
color: 'green'
}
},
labels: {
formatter: function() {
return this.value + '%';
},
style: {
color: 'green'
}
},
opposite: true
},
{
title: {
text: 'THree',
style: {
color: 'red'
}
},
labels: {
formatter: function() {
return this.value + '%';
},
style: {
color: 'red'
}
},
opposite: true
}
],
plotOptions: {
series: {
pare: 'percent'
}
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',
valueDecimals: 2
},
series: seriesOptions
});
}
});
Please take a look at this fiddle for the chart I am building.
My issues are:
- Y-Axis labels and percentages overlap. Is it possible to align them so that I have green percentages, the label "Two", then red percentages and finally the label "Three"? If you take a look at another fiddle it certainly looks tidier.
- Highstock shows its labels inside the graph grid. Can these be pushed to the outside so that the labelling looks more like the way my second JSFiddle displays them?
The first issue is most important for me to solve, and the second I could live with if I have to:
chart = new Highcharts.StockChart({
chart: {
renderTo: 'container',
zoomType: 'xy'
},
rangeSelector: {
selected: 4
},
yAxis: [{
title: {
text: 'One',
style: {
color: 'blue'
}
},
labels: {
formatter: function() {
return (this.value > 0 ? '+' : '') + this.value + '%';
}
}
},
{
title: {
text: 'Two',
style: {
color: 'green'
}
},
labels: {
formatter: function() {
return this.value + '%';
},
style: {
color: 'green'
}
},
opposite: true
},
{
title: {
text: 'THree',
style: {
color: 'red'
}
},
labels: {
formatter: function() {
return this.value + '%';
},
style: {
color: 'red'
}
},
opposite: true
}
],
plotOptions: {
series: {
pare: 'percent'
}
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',
valueDecimals: 2
},
series: seriesOptions
});
}
});
Share
Improve this question
edited Nov 22, 2012 at 18:11
the Tin Man
161k44 gold badges221 silver badges306 bronze badges
asked Nov 22, 2012 at 17:54
Nick LewisNick Lewis
7821 gold badge11 silver badges20 bronze badges
1 Answer
Reset to default 7You can control those positions with a bination of yAxis.labels.x and yAxis.title.margin.
For example the first yAxis:
{
title: {
text: 'One',
style: {
color: 'blue'
},
margin: 25 //push out 25 pixels
},
labels: {
formatter: function() {
return (this.value > 0 ? '+' : '') + this.value + '%';
},
x: -20 //push out 20 pixels
}
}
Updated fiddle here.
本文标签: javascriptHighstock YAxis labels overlap eachotherStack Overflow
版权声明:本文标题:javascript - Highstock Y-Axis labels overlap eachother - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745183729a2646586.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论