Displaying Value Indicators on the Category Axis

  • Last update:March 12, 2025
  • Overview

    Application Scenario

    In some cases, you need to set specific indicators for the category axis in the chart to keep track of the work progress. The following figure shows the effect.

    Implementation Method

    You can use the API  function FR.remoteEvaluate(Formula) and the built-in report function VALUE(TableData,TargetCol,OrgCol,Element) to customize the format of X axis labels.

    Example

    Data Preparation

    1. Create a general report and create a built-in dataset named ds1, as shown in the following figure.

    2. Create a built-in dataset named ds2, where the percents field represents the proportion of each salesperson's sales to the total sales, as shown in the following figure.

    Chart Insertion

    Merge required cells and insert a column chart, as shown in the following figure.

    Data Binding

    Bind the data to the column chart to display the sales of each product for each salesperson, as shown in the following figure.

    Custom Axis Label

    Choose Style > Axis > X Axis and select Custom for Axis Label Format. After entering the JavaScript code, you need to select Use HTML to Parse Text Content, as shown in the following figure.

    The JavaScript codes are as follows.

    function() {
            //The VALUE function returns the percentage data after calculation.
            var a=(FR.remoteEvaluate("value('ds2',2,1,'" + this+ "')")*100).toFixed(1);
            //The category name and percent are displayed together as the axis label, and the axis labels for Amy and Mike are marked in red.
            if(this=='Amy'||this=='Mike'){
            return "<font color='red'>"+this+":"+a+"%"+"</font>"     }else{
            return this+": "+a+"%";
        }
    }

    Effect Display

    PC

    Save the template and click Pagination Preview, as shown in the following figure.

    Mobile Terminal

    The template can be previewed on both the DataAnalyst app and the HTML5 terminal. The following figure shows the effect.

    Template Download

    For details, you can download the template: Value Indicator on the Category Axis.cpt.

    Notes

    During the template preview, you may find that the window "This call poses security risks. If you need to call it, modify Forbid Script to Call Formula in Security Mangament." pops up and NaN% is displayed in data, as shown in the following figure.

    In this case, you need to log in to the decision-making system, choose System Management > Security Management> Security, and disable Forbide Script to Call Formula, as shown in the following figure.


    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