简体   繁体   中英

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

Help please to config "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:

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. The x value is included in chart size calculations:

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/

API Reference:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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