Switching multiple charts

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

    1.1 Problem

    In some scenarios, multiple carousel charts in a report need to be switched at the same time. The effect is shown in the figure below, how to achieve it?

    chart-swtich-multi.gif


    1.2 Solution

    Add a click event to the button, call the following interface through JS, and switch the carousel chart uniformly. After successful switching, the timers of all carousel charts will return to 0.

    chart.unifiedSwitchCarouselChart(direction)

    Note:

    • direction is an optional parameter, which indicates the direction of chart switching. A parameter of 1 means switching to the next chart, and a parameter of -1 means switching to the previous chart. 

    • This method does not support mobile terminals.

    II. Example

    2.1 Report design

    Add 2 chart blocks to the dashboard, and add multiple types of chart tabsto each chart. Bind the data source for them.

    image.png

    For the two chart blocks, the switching mode is selected as carousel, the carousel arrow is displayed, and the time interval is set to 5 seconds, as shown in the following figure:

    image (1).png


    2.2 Add click event

    Add a button to the report, add a click event to it with the following JS:

    image (2).png

    VanCharts.unifiedSwitchCarouselChart(1);

     

    2.3 Preview effect

    After saving, click Preview. After clicking the button, you can see the two chart blocks switching at the same time:

    chart-swtich-multi.gif

    III. Download template

    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • 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