echarts information provided abscissa vertical discharge

 

We need to add axisLabel in xAxis in, demo case are as follows:

Each line of text arranged two vertical discharge.

 

                    xAxis : [
                        {
                            type : 'category',
                            data : this.xAxis,
                            axisTick: {
                                alignWithLabel: true
                            },
                            axisLabel: {
                                interval: 0,
                                formatter: function(value) {
                                    //return value.split("").join("\n");
                                    //debugger
                                    var ret = "";//Splicing plus \ n returned item category 
                                    var maxLength = 2; // for each number of displayed text 
                                    var = valLength value.length; // X-axis category item number text 
                                    var rowN = Math.ceil (valLength / maxLength ); // category items need to change the number of row lines 
                                    IF (Rown>. 1) // if the text is larger than the category item. 3, 
                                    {
                                         for (var I = 0; I ++; I <Rown ) { 
                                            var TEMP "" =; // each interception string 
                                            var = I * start maxLength; // start position taken
                                            Start + End maxLength = var; // end position taken
                                             // here can also add a determination whether the last line, but not without impact, it does not add it 
                                            temp = value.substring (start, end) + '\ n-' ; 
                                            RET + = TEMP; // with final string 
                                        }
                                         return RET; 
                                    } 
                                    the else {
                                         return value; 
                                    } 
                                } 
                            }
                        }
                    ],

 

Guess you like

Origin www.cnblogs.com/chenmz1995/p/11536119.html