我需要在 highcharts 条形图的 y 轴上添加一些非常长的多行标签。
我的问题是长的多行标签导致以下标签被删除 - 可能是某种内部重叠故障保护。
我正处于增加标签宽度的地步,以便我可以用换行符控制自己的换行(内部换行也会产生与丢失标签相同的问题。)
我希望能够关闭此功能并自己处理重叠。
例子:
图表选项:
{
"colors": [
"#00AEEF"
],
"credits": {
"enabled": false
},
"chart": {
"type": "bar"
},
"tooltip": {},
"plotOptions": {
"column": {
"pointPadding": 0.2,
"borderWidth": 0
},
"series": {
"borderWidth": 0,
"dataLabels": {
"enabled": true,
"format": "{point.y:.1f}%"
}
}
},
"series": [
{
"showInLegend": false,
"data": [
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
70
],
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
62.5
],
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
41.25
],
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
26.25
],
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
18.75
],
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
11.25
],
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
7.5
],
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
3.75
],
[
"this is a pretty long label <br/>that will most likely cause the next<br/> row not to appear",
3.75
]
]
}
],
"xAxis": {
"minorGridLineWidth": 0,
"minorTickLength": 0,
"tickLength": 0,
"type": "category",
"labels": {
"overflow": "justify",
"style": {
"color": "#525151",
"fontSize": "12px",
"lineHeight": "10%",
"fontFamily": "Helvetica Neue, Helvetica ,Helvetica,Arial,sans-serif",
"width": "999px"
},
"y": -10
}
},
"yAxis": {
"min": 0,
"title": {
"text": "Percent (%)"
}
}
}
最佳答案
只需设置step: 1
,参见:http://jsfiddle.net/Yrygy/135/
Docs .
关于javascript - Highcharts - 长的多行 y 轴标签导致以下标签被删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23584574/