Chart Label Wrap Display

  • Last update:  2021-03-12
  • 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.png


    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.png

    2) Merge a range of cells and insert a column chart, as shown in the figure below:

    3.png

    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:

    4.png

    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:

    5.png

    III. Template Download

    Click to download template:

    Chart_Label _Wrap_Display.cpt


    Attachment List


    Theme: Chart
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy