Blueprint editor hands-on examples

Updated at:

This topic provides hands-on examples to help you solve common issues in the blueprint editor.

Video link

Watch the video tutorial: Blueprint editor hands-on examples.

Example overview

Use a tab list to control component visibility

This example shows how to use the blueprint editor to control the visibility of multiple components with a Tab List component.

Note

Clicking TAB1 displays the column chart component. Clicking TAB2 displays the line chart component.

For the steps to configure this interaction, see Use a tab list to control component visibility.

Method 1: Use a branch judgment node

  1. In the canvas editor, add the components for the interaction. This example uses a Column Chart, a Tab List, and an Area Chart component. Right-click each component and export them to the blueprint editor.

  2. In the blueprint editor canvas, connect the nodes as shown in the following figure. Then, add the processing method in the branch judgment node. 控制显隐蓝图编辑器连线

    Note
    • If the Tab List parameter id=1 triggers the action, the Area Chart component is shown. Otherwise, it is hidden.

    • If the Tab List parameter id=2 triggers the action, the Column Chart component is shown. Otherwise, it is hidden.

Method 2: Use a serial processing node

  1. In the canvas editor, add the components for the interaction. Overlap the Area Chart and Column Chart components. Right-click them and select Group.成组

  2. In the Layers panel, click the grouped object. Enable Carousel for objects in group and set Trigger Method to Event Trigger.

  3. Right-click the Tab List and the Group and export them to the blueprint editor. Connect the nodes as shown in the following figure. Then, add the processing method in the serial processing node. 串行节点处理

    Note

    When a tab is clicked, the {id:"1"} parameter from the event is passed to the serial data processing node and becomes {index:0}. The value 0 indicates that the component index within the group starts from 0.

How to distribute data using merge requests

This example shows how to use the blueprint editor to request data with a General Title component and distribute it to a Ticker Board and a Multiline Text component.案例二样例

The steps to configure this interaction are as follows. For a detailed demonstration, see Distribute data to multiple components.

  1. In the canvas editor, add a Ticker Board and a General Title component. Clear the title, prefix, and suffix content of the Ticker Board component. Move the General Title component outside the canvas and modify its data.修改数据内容

  2. Export the components to the blueprint editor. Add a Sequence Execution node and add the processing method for the node.序列执行方法

Implement cross-screen interaction

This example shows how to use the WebSocket Node in the blueprint editor to implement cross-screen interaction.

The steps to configure this interaction are as follows. For a detailed demonstration, see Implement cross-screen interaction.

  1. You can establish a WebSocket service for two screens. For more information about how to build your own service or download the DataV-WS service package, see

    Build a custom WebSocket node service and download the DataV-WS service package.

  2. Create two visualization applications: a control end and a receiving end.

  3. For the control end, add a Tab List component and export it to the blueprint editor. For the receiving end, add a General Title component and export it to the blueprint editor.

  4. Set the sender's blueprint configuration.Blueprint configuration

  5. Configure the blueprint for the receiving end.配置接收端蓝图配置

Hands-on demo

Use a tab list to control component visibility

Method 1:

  1. On the canvas editor page, go to the All Assets tab. Add the components for the interaction to the canvas. This example uses a Tab List, a List Carousel, and a Lucky Draw component.

  2. After adding the components, select them in the Layers panel on the left. Right-click and select Export to Blueprint Editor.

  3. On the blueprint editor page, select the components from the Imported Nodes panel on the left and add them to the canvas. Add two Branch Judgment nodes and connect them as shown in the following figure.蓝图配置分值判断

  4. Click the upper branch judgment node. In the Configuration panel on the right, add the following processing method in the Other Configurations section:

    return data.id == 1;

    Similarly, add the following processing method for the lower branch judgment node:

    return data.id == 2;
  5. In the upper-right corner of the blueprint editor, click the Preview 预览 icon to view the result.预览方法一

Method 2: Use a serial processing node

  1. On the canvas editor page, go to the All Assets tab. Add the components for the interaction to the canvas. This example uses a Tab List, a Table with Progress Charts, and a Key-Value Table component.

  2. In the canvas editor, overlap the Table with Progress Charts and Key-Value Table components. In the Layers panel on the left, select both components. Right-click on the canvas and select Group.成组

  3. In the Layers panel, click the grouped object. Enable Carousel for objects in group and set Trigger Method to Event Trigger.

  4. Right-click the Tab List and the Group and select Export to Blueprint Editor. On the blueprint editor page, add the component nodes to the canvas from the Imported Nodes panel on the left.

  5. In the blueprint editor canvas, add a Serial Data Processing node. Connect the nodes as shown in the following figure and add the following method for the serial data processing node:

    return {
      "index": data.id - 1
    } 
    Note

    When a tab is clicked, the {id:"1"} parameter from the event is passed to the serial data processing node and becomes {index:0}. The value 0 indicates that the component index within the group starts from 0.

  6. In the upper-right corner of the blueprint editor, click the Preview 预览 icon to view the result.展示效果 串行处理节点

    Note

    When TAB1 is selected, the canvas displays the Table with Progress Charts component. When TAB2 is selected, the canvas displays the Key-Value Table component.

  7. For detailed instructions on how to use a tab list to control component visibility, see: How to use a tab list to control component visibility.

How to Distribute Data with Merge Requests

  1. On the canvas editor page, go to the All Assets tab. Add the components for the interaction to the canvas. This example uses a General Title, a Multiline Text, and a Ticker Board component.

  2. Select the General Title component. In the data configuration panel on the right, click Configure Data Source and set the data source as follows:

    [
        {
            "num": "123",
            "text": "This is the multiline text component",
            "value": "Data receiving component"
        }
    ]
  3. On the canvas editor page, select the three components in the Layers panel. Right-click each one and select Export to Blueprint Editor.

  4. On the blueprint editor page, click the three component nodes in the Imported Nodes panel to add them to the canvas. Add a Sequence Execution node to the canvas and connect the nodes as shown in the following figure.合并请求数据分发蓝图连线

  5. After connecting the nodes, add two methods for the sequence execution node in the Other Configurations section on the right.

    • Retrieve text data:

      return [{
        value:data[0].text
      }];
    • Retrieve ticker board data:

      return [{
        value:data[0].num
      }];
  6. In the upper-right corner of the blueprint editor configuration page, click the Preview 预览 icon to view the data distribution result.数据分发结果

  7. For detailed instructions on distributing data using merge requests, see How to distribute data using merge requests.

Implement cross-screen interaction

  1. You can establish a WebSocket service for two visualization applications. For information about how to build your own service or download the DataV-WS service package, see

    Build your own WebSocket node service and download the DataV-WS service package.

  2. Create two visualization applications: a control end and a receiving end.

  3. In the control end visualization application, add a Tab List component and export it to the blueprint editor.

  4. In the blueprint editor canvas, add a Serial Data Processing node and a WebSocket node. Connect them as shown in the following figure.跨屏联动蓝图配置

    Note
    • Configure the IP address of the WebSocket node service in the Other Configurations section on the right. There are two scenarios:

      • If you open the visualization application with HTTP, use the ws protocol. For example: ws://127.0.0.1:8181.

      • If you open the visualization application with HTTPS, use the wss protocol. For example: wss://xxx.

    • The screen ID and screen name are automatically filled.配置WebSocket节点

  5. After setting up the WebSocket node, add the following method for the serial data processing node in the Other Configurations section:

    return [{"value":data.content}]; 
  6. After configuring the control end, open the receiving end visualization application. In the canvas editor, add a General Title component and export it to the blueprint editor.

  7. On the blueprint editor page, add the General Title node from the Imported Nodes panel on the left to the canvas. Add a WebSocket node and connect them as shown in the following figure.

  8. Configure the WebSocket node for the receiving end in the same way. The Message Name for Receive Message in the node must be the same as the Message Name for Send Message. In this example, set both to test.

  9. After the setup is complete, click the Preview 预览 icon in the upper-right corner of the blueprint editor configuration page to view the cross-screen interaction result.分屏联动效果

  10. For more information about how to implement cross-screen interaction, see How to implement cross-screen interaction.