Highcharts Demo

author(s): Jaskey

by AbhishekRohan

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container" style="height: 400px"></div>

CSS

/* .highcharts-axis-labels span{ 
  word-break:break-all!important;
  width:50px!important;
  white-space:normal!important;
} */

JavaScript

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column',
        },
        xAxis: {
            categories: ['This is a long Text', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec','这是一个很长很长很长的中文'],
            labels: {
                useHTML:true,//set to true
                style:{
                    width:'20px',
                    whiteSpace:'normal'//set to normal
                },
                step: 1,
                formatter: function () {//use formatter
                    return '<div align="center" style="word-wrap: break-word;word-break: break-all;width:20px">' + this.value + '</div>';
                }
            },

        },
      
        plotOptions: {
            series: {
                pointWidth: 30
            }
        },

        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0]
        }]
    });
});