highcharts - 适合长 Y 轴标签的 HighCharts
问题描述
我有一些大的垂直(Y)轴标签名称。当它们显示时,它们会缩小实际图表的大小,阅读它们会变得混乱。这是图像:
如图所示,标签未对齐。如何使它们正确对齐?
以下是我正在使用的图表选项:
{
"plotOptions": {
"series": {
"pointPadding": 0,
"borderWidth": 0
}
},
"chart": {
"height": "50%"
},
"rangeSelector": {
"selected": 1
},
"title": {
"text": "Index EOD Analysis"
},
"tooltip": {
"split": true
},
"yAxis": [
{
"labels": {
"align": "right",
"x": -3
},
"title": {
"text": "OHLC"
},
"height": "60%"
},
{
"labels": {
"align": "right",
"x": -3
},
"height": "20%",
"top": "60%",
"title": {
"text": "FII Consolidated PCR"
}
},
{
"labels": {
"align": "right",
"x": -3
},
"height": "20%",
"top": "80%",
"title": {
"text": "Net Seller Index"
}
}
],
"series": [
{...}
]
解决方案
您可以增加标签的宽度:
"yAxis": [...,
{
...
"title": {
...,
style: {
width: '200px'
}
}
}
]
现场演示:http: //jsfiddle.net/BlackLabel/eb4g6rtc/
API 参考: https ://api.highcharts.com/highcharts/yAxis.title.style
推荐阅读
- php - Laravel 5 - 设置内核以定期运行测试脚本。(定时任务)
- c++ - 在 C++ 中带有插入语句的 ORA-00933
- terraform - Terraform AWS vpc 自定义模块重新创建路由表和子网
- javascript - 无法在 JavaScript 文件中获取用 PHP 制作的 cookie
- python - python - 使用 loc 重新定位我的图例
- javascript - addEventListener 在表单上不起作用 - vanilla JS
- css - Laravel 错误资源解释为样式表,但使用 MIME 类型 text/html 传输
- vlookup - VLOOKUP 缺少条目?
- javascript - HTML 按钮未链接到 Javascript
- kotlin - 作为 CoroutineScope 和启动的参数,Job 有什么不同?