I. Overview
1.1 Problem Description
When the content of the chart label is too long, if the label is set inside, it will exceed the scope of the graph and affect the beauty of the report, as shown in the following figure:
1.2 Solution
By customizing the label, the label text can be displayed in a new line.
2. Example
2.1 Report Design
1) Create a new normal report, and create a new embedded dataset Embedded1, as shown in the figure below:
2) Merge a range of cells and insert a column chart, as shown in the figure below:
3) Select the column chart, select Cell Element> Style> Label in the attribute pane on the right, check Use Label, and enter the custom label code, as shown in the following figure:
Code show as below:
function(){
var a = this.value.toString();//Can convert a logical value into a string and return the result
var length = a.length;
var b = parseInt((a.length)/2);//Divide into 2 parts and round
var value= a.substring(0,b)+"<br>"+a.substring(b,length);//The part before the display, the part after the line break
return value
}
2.2 Effect Preview
Save the report, click Pagination Preview, the effect is shown in the following figure: