Successfully!

Error!

Chart Custom Axis Label Format

  • Last update:  2021-03-12
  • I. Overview

    1.1 Application

    The chart can customize the axis label format. For example, the axis label of the X axis of the whirlwind chart defaults to a negative value on the left side.

    1.png

    You can modify these negative axis labels to positive values to achieve data comparison on both sides, as shown in the following figure:

    2.png


    1.2 Realization Idea

    The axis label format can be customized under the chart attributes pane, Style>Axis>X Axis>Custom, as shown in the following figure:

    3.png

    II. Example

    2.1 Data Preparation

    Create a new normal report and add the Emedded dataset populationpyramid to record the relevant data of men and women of different age groups, as shown in the following figure:

    4.png


    2.2 Insert Chart

    Take the cell chart as an example, merge a cell and insert a custom Bar Chart, as shown in the figure below:

    5.png


    2.3 Bind Data

    Select the chart and bind the chart data, as shown in the figure below:

    6.png


    2.4 Custom Axis Label Format

    1) Delete X Axis2 under Chart Attributes Pane Style> Axis, and add Y Axis2, as shown in the figure below:

    7.png

    2) Set the Maximum and Minimum values of the X axis, as shown in the figure below:

    8.png

    3) Customize the X-axis format to make the X-axis symmetrically distributed, as shown in the figure below:

    9.png

    The custom code is as follows:

    function(){
        if(this>0)
             return this+'%';
        else
             return this*(-1)+'%'; 
    }

    4) Under Style> Series in the chart attributes pane, add Stack and Axis1, as shown in the following figure:

    10.png


    2.5 Preview Effect

    Save the template, click Pagination Preview, the effect is as shown in the figure below:

    11.gif

    Note:Support both App and H5 terminal preview.

    III. Template Download

    Click to download template:

    NewBarchart2.cpt


    Attachment List


    Theme: Chart
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback