Highcharts x axis label text wrapping lost on setting label step

后端 未结 2 1782
情书的邮戳
情书的邮戳 2021-01-22 16:03

I have a problem with the Highcharts label wrapping on the X axis .It is lost on setting the label step property as shown in the links below

Correct: http://jsfiddle.ne

相关标签:
2条回答
  • 2021-01-22 16:39

    It's a bit of a hack, but you could replace each space in the name with <br /> by using the formatter:

    labels: {
        step: 1,
        formatter: function () {
            return this.value.replace(/ /g, '<br />');
        }
    }
    

    It's not exactly what you want as it doesn't split the name according to the space available between ticks, but maybe you can improve the formatter to better suit your needs (splitting by a given n characters for example instead of by space).

    See it running here.

    0 讨论(0)
  • 2021-01-22 16:55

    You can use width paramter for labales:

    http://jsfiddle.net/ahwmv/2/

    labels: {
                style:{
                    width:'50px',
                },
                step: 1
            }
    
    0 讨论(0)
提交回复
热议问题