简体   繁体   English

HighCharts。 如何将yAxis标题和yAxis标签对齐在一行中?

[英]HighCharts. How to align yAxis title and yAxis labels to right in one line?

Help please to config "Highcharts". 请帮助配置“Highcharts”。 I can not align the title and labels on the right side on the one line. 我无法在一行右侧对齐标题和标签。 Labels are cropped if they have been recalculated in formatter. 如果在格式化程序中重新计算了标签,则会对其进行裁剪。

在此输入图像描述

yAxis option config: yAxis选项配置:

chart: {
   spacingLeft: 0
},
yAxis: {
   offset: 12,
   title: {
      rotation: 0,
      align: 'high',
      y: -21,
      textAlign: 'right',
      x: 0,
      margin: 0,
      offset: 0,
      text: 'ttl'
   },
   labels: {
      x: 0,
      align: 'right',
      formatter: function(e) {
         return e.value * 333;
      }
   }
}

You can use title.x and labels.x properties to set the space. 您可以使用title.xlabels.x属性来设置空间。 The x value is included in chart size calculations: x值包含在图表大小计算中:

yAxis: {
    title: {
        rotation: 0,
        align: 'high',
        y: -21,
        textAlign: 'right',
        x: -10,
        margin: 0,
        offset: 0,
        text: 'ttl'
    },
    labels: {
        x: -10,
        align: 'right',
        formatter: function(e) {
            return e.value * 333;
        }
    }
}

Live demo: http://jsfiddle.net/BlackLabel/67bv3nts/ 现场演示: http //jsfiddle.net/BlackLabel/67bv3nts/

API Reference: API参考:

https://api.highcharts.com/highstock/yAxis.labels.x https://api.highcharts.com/highstock/yAxis.labels.x

https://api.highcharts.com/highstock/yAxis.title.x https://api.highcharts.com/highstock/yAxis.title.x

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM