JS Compare between Chart Series

  • Last update:  2020-12-15
  • I. Overview

    1.1 Problem

    In [Chart]>[Special Effects]>[Conditional Display], data between series cannot be directly compared.

    Now we want to achieve the comparison of the values between the series as shown in the figure below. When the Household sales volume is less than the Digital products, the column color becomes red.


    1.2 Solution

    Through comparison between the series using JS, and change the color based on the comparison.

    II. Sample

    2.1 Report design

    Create a new data set ds1, the database query statement is: 

    SELECT * FROM SALES_BASIC

    Merge the cells of a region, insert a column chart, and bind the chart data as shown below:

    In the [Style]>[Label] settings, select [use label], select [Custom] for the text, enter the following JS code in a text box:

    function(){   
        if(this.points[0].value<=this.points[1].value)   
            this.points[0].color="red";    
    }


    2.2 Preview effect

    1.PC

    Save the report and click [Pagination preview]:

     

    2.Mobile


    III. Download template

    Attachment List


    Theme: Report Application
    • 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