Hide some series in one chart

  • Last update:December 14, 2020
  • I. Overview

    You can control which series are not displayed through js.

    chart-serices hide.gif

    II. Example

    You can get the chart object through FR.Chart.WebUtils.getChart("chartID").getChartWithIndex(chartIndex).setSeriesVisible() and control whether to display this object.

    Note: This is not supported in the report block chart in dashboards.

     

    2.1 Report design

    Add a column chart to the report, and add another tab of line chart. Bind data and set chart styles for these two tabs. (You can refer to the attached template.)

    And drag the corresponding buttons to the bottom.

    image.png


    2.2 Add buttons and click events

    Add the following click events for the first button, this is to set series 1&2 of the column chart to be invisible:

    image (1).png

    var vanchart=FR.Chart.WebUtils.getChart("chart0").getChartWithIndex(0);//get first chart(Column Chart) from "chart0" component
    vanchart.setSeriesVisible([0,1]);//Set series 1&2 invisible


    Add the following click events for the second button, this is to set series 3&4 of the line chart to be invisible:

    image (2).png

    var vanchart=FR.Chart.WebUtils.getChart("chart0").getChartWithIndex(1);
    //get second chart(Column Chart) from "chart0" component
    vanchart.setSeriesVisible([2,3]);////Set series 3&4 invisible

     

    2.3 Preview effect

    Click preview, and you will see the effect as shown at the beginning.

    III. Download template

    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

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

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

    不再提示

    9s后關閉

    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