反馈已提交

网络繁忙

You are viewing 5.1 help doc. More details are displayed in the latest help doc.

Real-time data dashboard refreshes regularly

  • Recent Updates: April 19, 2022
  • 1. Overview

    1.1 Expected effect

    Users who use FineBI real-time data directly connected to the database often use FineBI dashboards as large screen displays, so they often need to refresh the dashboards on a regular basis. FineBI provides the ability to implement the dashboard refresh on a regular basis, enabling automatic refreshing of single dashboards, multiple dashboard panels and individual components.

    • The dashboard is refreshed at regular intervals, as shown in the following figure.

    12.png

    • The single component timed refresh effect, as shown below.

    2.png

    1.2 Implementation idea

    1)Creating JS files.

    2)Place the created refresh.js file in the FineBI installation directory %FineBI%/webapps/webroot.

    3)Call the JS file.

    1.3 Other Programs

    If this article does not meet the needs, you can contact technical support to get BI Preview Auto Refresh Template Plugin (QQ: 800049425).

    2. Timed refresh of individual dashboards

    2.1 Create JS file

    1)The timed refresh of the dashboard is implemented with custom JS, copy the following code to create the  refresh.js  file.

    setTimeout(function () {
    var b =document.title;
    var a =BI.designConfigure.reportId;//get dashboard id
    //Determine the dashboard id to achieve the specified dashboard refresh
    if (a=="7193a5c87fbb4915b8893e07a0c6759c") {
     setInterval(function () {
      BI.SharingPool.put("controlFilters", BI.Utils.getControlCalculations());
      //Data.SharingPool.put("controlFilters", BI.Utils.getControlCalculations());
      BI.Utils.broadcastAllWidgets2Refresh(true);
     }, 5000000);//5000000is the frequency of regular refresh, unitms
    }
    }, 2000)

    In the judgment of the dashboard ID, you need to modify the judgment condition to the dashboard ID you need to refresh; and 5000000 is the interval time of regular refresh, in milliseconds, modified according to your needs, usually should be greater than 300000.

    2)Modify the interval between scheduled JS file refreshes.

    • If the data is not updated every second. It is recommended that JS set the refresh time higher than 5 minutes, i.e. the interval between scheduled refreshes should be greater than 300000.

    Otherwise, it will cause problems such as downtime and a spike in memory usage, and since the project has a 5-minute cache time, the cache is read all the time during these 5 minutes, so when the refresh interval is less than 5 minutes, the data may not change.

    • If you want to set the refresh time in seconds. You need to turn off caching to circumvent the 5-minute cache time while turning on live data.

    Administrators can close the corresponding button in "Manage > System > BI Parameters > Cache Setting" and "Save" to take effect, the setting path is shown below.

    14.png

    3)Get the dashboard ID and modify the JS file dashboard ID.

    The dashboard ID can be obtained directly from the link address when editing the dashboard, for example, the link address when creating a new dashboard is 

    http://localhost:37799/webroot/decision/v5/design/report/7193a5c87fbb4915b8893e07a0c6759c/edit. The dashboard ID is ID 7193a5c87fbb4915b8893e07a0c6759c, as shown in the following figure.

    15.png

    After getting it, change a=="dashboard ID" in the Judgment ID.

    4)Close FineBI.

    16.png

    5)Place the created refresh.js  file in the FineBI installation directory %FineBI%/webapps/webroot as shown below.

    17.png

    2.2 Call JS files

    1)Under the %FineBI%/webapps/webroot/WEB_INF/lib,  you can find show.html  in fine-bi-adapter-5.1.jar ( 5.1 version is fine-bi-adapter-5.1.jar )

    18.png

    2)Insert the following code into that HTML file to call the previously created refresh.js  file, as shown in the following image.

    <!-- Add refresh function --> 
    <script type="text/javascript" src="/webroot/refresh.js"></script>

    Insert the code location as shown below.

    19.png

    Save the changes to this JAR package when you are done.

    2.3 Effect view

    After the configuration is complete, launch FineBI and press F12 on this dashboard preview page to view the page source code to determine if the JS was loaded successfully. The dashboard successfully loads the JS for the timed refresh. As shown in the figure below.

    20.png

    Note: If you change the frequency in JS, you can clear the browser cache after you save the modified file, you don't need to restart FineBI. 

    3. Timed refresh of multiple dashboards

    The operation steps of multiple dashboard timer refreshes are roughly similar to those of a single dashboard, so how should it work? Let's introduce it in detail below.

    3.1 Create JS file

    1)Createrefresh.js  file, the content is the same as section 2.1 of this chapter, you need to set the dashboard ID and the timer refresh time, please refer to section 2.1 of this article for the timer refresh frequency setting and precautions. Only in the place of judging the dashboard ID, fill in the ID of multiple dashboards that need to be set.

    setTimeout(function () {
    var b =document.title;
    var a =BI.designConfigure.reportId;//Get the dashboard id //Judgment on dashboard id to achieve specified template refresh
    if (a=="d5405b13bfeb454081be9627a9cfc97f" || a=="e1dcb1a61d6947e1adedced59bde9533") {  
    setInterval(function () {
      BI.SharingPool.put("controlFilters", BI.Utils.getControlCalculations());  
      //Data.SharingPool.put("controlFilters", BI.Utils.getControlCalculations());  
       BI.Utils.broadcastAllWidgets2Refresh(true);  
       }, 5000000);//5000000 is the frequency of timer refresh, unit ms
       }
       }, 2000);

    For example, in the above code, set that is "“d5405b13bfeb454081be9627a9cfc97f” and "e1dcb1a61d6947e1adedced59bde9533" two dashboard ID judgment, also want to add, in the judgment ID place If you want to add more dashboard IDs, you can add the condition|| a=="TemplateID".

    2)Dashboard IDs can be obtained directly from the link address when editing the dashboard.

    3)Close FineBI 。

    4)Place the refresh.js  file under %FineBI%/webapps/webroot. See Section 2.1 of this chapter for details.

    3.2 Call JS file

    See Section 2.2 of this chapter for details.

    3.3 Effect view

    If you look at the web source code of the dashboard, each dashboard adds JS for regular refreshing. See Section 2.3 of this chapter for details.

    4. Timed refresh of individual components

    If you want to refresh the data of a component on a regular basis when the dashboard is displayed, you can refer to the following steps.

    4.1 Create JS file

    1)Get the ID value of the timer refresh component

    In the dashboard edit page, press F12 to open the browser console,, select the Console page, enterBI.designModel.widgets , enter, and click... Get all the component information, after clicking on the component ID... Get the details of the component, as shown in the following figure.

    21.png

    Click the drop-down box, then you can find the component that needs to be refreshed according to the name under the component ID, and get the KEY value of the component. In this example, the component ID is f83b0b5ec717bf18 for unnamed component 1, as shown in the following figure.

    22.png

    2)Gets the dashboard ID of the component.

    Get this dashboard ID from the path as7193a5c87fbb4915b8893e07a0c6759c, as shown below.

    23.png

    3)Create the refresh.js  file and set the dashboard ID and the refresh frequency. See Section 2.1 of this document for the refresh frequency settings and considerations. For details, please refer to Section 2.1 of this chapter.

    The contents of the file are as follows.

    The contents of the file are as follows.

    setTimeout(function () {   
    var b =document.title;  
    var a =BI.designConfigure.reportId;//get dashboard id   //Determine the dashboard id to achieve the specified dashboard refresh  
    if (a=="fdcc1cb3b96445fcba18fdf27684740b") {    
    setInterval(function () {
    BI.Broadcasts.send(BICst.BROADCAST.REFRESH_PREFIX + "b07e0e200514dfcb"); //Refreshes the specified component
    }, 5000000);
     //5000000 is the frequency of timer refresh, unit ms
      }  
     }, 2000);

    Compared to the Template Refresh JS, we have added the judgment of the specified component. To judge the template ID and refresh the specified component, you need to modify the template ID and component ID to the corresponding ID value that you need to refresh. This example modifies a=="dashboard ID " and BI.Broadcasts.send(BICst.BROADCAST.REFRESH_PREFIX + "Component ID ")

    Note: After getting the template ID, you need to close BI before proceeding.

    4)Place therefresh.js  file under %FineBI%/webapps/webroot.

    4.2 Call JS file

    See Section 2.2 of this chapter for details.

    4.3 Effect view

    In this case, if you look at the template setup, the individual components will implement a timed refresh. If you look at the template's page source code, the above-timed refresh JS will be added. See Section 2.3 of this chapter for details.

    Attachment List


    Theme: Make Dashboards
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    售前咨询电话

    400-811-8890转1

    在线技术支持

    在线QQ:800049425

    热线电话:400-811-8890转2

    总裁办24H投诉

    热线电话:173-1278-1526

    文 档反 馈

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭