Blocks

更新时间:
复制 MD 格式

A block is a black box tool that encapsulates basic widgets. This topic describes the features of blocks to help you quickly get started.

Blocks define internal and external data transmission. Internally, blocks encapsulate business-related widget styles, widget layouts, default data, and blueprint logic. This default data excludes data sources other than static data and APIs. Externally, blocks define business-related data interfaces.

Limits

The block feature is available in the Professional Edition and higher. To use this feature, you can upgrade your DataV edition to Professional Edition or Premium Edition.

Block interface nodes

Blocks define internal and external data transmission. You can configure them in the blueprint editor using the Data Interface, Event Interface, and Action Interface nodes. The differences between these interfaces are as follows:

  • Data Interface: Receives data from external data sources into the block. The blueprint editor then distributes the data to internal widgets.

  • Event Interface: Receives events from internal widgets and exposes the event data externally.

  • Action Interface: Receives actions triggered by external widgets and causes internal widgets to execute corresponding business logic.

When using a block, treat it as a single unit. You can simply understand and set the externally defined block interfaces without focusing on the internal logic. For more information about how to configure and use block interfaces in the block editor, see Use block interfaces.

Block example

The following figure shows an example of a block. This block defines two data interfaces, one event interface, and three action interfaces. The functions of each interface type are explained as follows.

  • The Import Rose Chart data interface receives data and immediately imports it into the ECharts Rose Chart widget.

  • The List Carousel Click event interface receives data from the List Carousel widget when the When a row is clicked event occurs.

  • The Update Style action interface retrieves data, processes it through the Serial Data Processing logic node, and then calls the Update Widget Configuration action of the Vertical Capsule Column Chart widget.

The following figures show the external appearance of the Data Source Configuration, Interaction Configuration, and Blueprint Parameter Content for the block in the preceding example.

Data Source Configuration Interaction Configuration Blueprint Parameter Configuration

FAQ

  • Q: Can a block contain widgets?

    A: To configure the block component, you can drag a component from the layer bar in the block editor to the canvas.

  • Q: Can a block have interactions?

    A: You can export a block to the blueprint editor. In the editor, connect the block interface node to the corresponding component node to configure the business logic. For more information, see Use block interfaces.

  • Q: Can there be interactions between the inside and outside of a block?

    A: You can use an API to create a block, and then call that block's API on a visualization screen. For more information, see Use block APIs and Add a block.

  • Q: How do I debug a block?

    A: You can use the Block Preview feature to debug configured block interfaces and other features.

  • Q: After a block is created, how do I use it in the visualization application canvas editor?

    A: First, publish the block. Then, go to the visualization application canvas editor. In the editor, open the widget library and select the Blocks module. You can view the created blocks in the block list or add the blocks that you need. For more information, see Publish a block and Add a block.

  • Q: After a new version of a block is published, how do I perform a one-click upgrade for an old block that is in use in a visualization application?

    A: In the canvas editor, click the target block to open its configuration pane on the right. In the upper-right corner of the pane, click Upgrade Block Version. The method for upgrading a block is the same as for upgrading a widget.

  • Q: How can I create a block quickly and easily?

    A: In addition to creating a blank block on the Blocks panel, you can also upgrade a favorite asset to a block on the Favorite Widgets panel of the workbench.