All Products
Search
Document Center

DataV:Button

Last Updated:Jan 15, 2025

This topic provides a guide for using the button widget.

Component overview

The button is a control widget that, when clicked, triggers specified operations such as navigation, submission, and selection or cancellation. It allows customization of color, size, label content, and hyperlink, and can interact with other widgets to display linked pages or prompt information in a visualization application.

Scenarios

Buttons are commonly used in visualization applications for interface switching, hyperlink navigation, and executing submission or confirmation instructions.

Effect display

  • Static Button

    image

  • Hyperlink Navigation

    screenshot_2025-01-10_18-00-15

  • Interactive Scenario

    screenshot_2025-01-10_18-16-21

Prerequisites

  • A data dashboard is available that supports creation using a template, a blank canvas.

  • Business data is ready for use. For more information, see Data Source.

Add button

  1. Access the DataV console.

  2. Navigate to Workbench > > All Applications > > Data Dashboard and select the desired dashboard to access the canvas editing page.

  3. In the left-side navigation pane, under the Component Library > Control > Button Class list, click the Button widget to add it to the canvas.

You can also use global search to add related widgets.

Integrate business data

After adding the widget, integrate the prepared business data for display. Click the button and in the right-side Data Source tab, select the data for the widget to render. image

  • The data fields received by the button are as follows.

    Field

    Description

    value

    This data is output when the Click Button Event is triggered. For more information about events, see Blueprint Interaction.

    An example data structure is as follows.

    [
      {
        "value": "Submit"
      }
    ]
  • The key configuration items for the data source are as follows.

    Configuration Item

    Description

    Select Data Source

    Supports integrating various types of data such as CSV files, APIs, and various databases. For more information, see Data Source. You can edit data fields using a visual table or code.

    Configure Filter (Optional)

    Used to customize filter code to achieve data structure transformation, filtering, display, and simple calculations. For more information, see Manage Data Filters.

    Configure Data Mapping

    Used to map fields from the selected data source to the corresponding fields of the widget to achieve real-time data matching. Click the image icon to configure field styles.

    View Response Results

    Used to display the data integrated into the widget in real-time. When the widget data source changes, the latest data will be displayed here.

    • Click the data response result to view the code of the data fields written.

    • Click to view the example to see the array type and code example received by the data source. You can refer to the example to write related fields.

    Other data request configurations:

    • Disable Loading State: When selected, the loading content during widget initialization will not be displayed when updating or previewing the data dashboard.

    • Controlled Mode: When selected, the widget will not request data in the initialization state. At this time, data requests can only be initiated through the blueprint editor or global variable events.

    • Automatic Update Request: When selected, the platform will dynamically poll and update data according to the polling time you set. If not selected, you need to manually refresh the page or trigger a request to update data through the blueprint editor and global variable events.

Configure button

Click the button widget to configure its basic style, global variables, and interaction occurrences in the right-side panel. This includes advanced configuration and blueprint interaction configuration.

Style configuration

In the Style panel, configure the text, background, border, and other styles of the button in different states. The configuration items are as follows.

Note

Click the image icon to quickly locate configuration items by searching keywords. The search supports fuzzy match. For more information, see Search Configuration Items.

The related configuration items are described as follows.

Configuration Item

Description

Illustration

Global Configuration

Defines the position distribution, transparency, and interaction penetration of the widget in the data dashboard.

  • Opacity: The smaller the value, the more transparent the widget. The value range is within 0~1.

  • Interaction Penetration: When enabled, the mouse can penetrate this widget to avoid the widget blocking the interaction between the mouse and the underlying widget when there are many widgets on the dashboard.

image

Global Style Configuration

Defines the display style of the button in the default state, including text content, text style, background style, and border style. The related instructions are as follows:

  • Text Content: The text displayed on the button.

  • Text Style: You can set the font, weight, color, font size, alignment, and font style of the text.

    • Font: Please select a font that is already installed on your system. If the font is not installed on the system, the text will be displayed in the default font. For more font information, see Font Library.

    • Font styles include the following:

      • Normal: Normal style.

      • Italic: Italic style.

      • Oblique: Used to set text that cannot be displayed in italics to an oblique style. For example, some fonts may not have an italic style, so you can use Oblique to tilt the text.

  • Background Style: Supports setting the background color or using a custom image as the background. You can click Click Here To Change to select an image. You can also directly enter the URL link address of the image.

    Note

    When selecting an image, you need to first create the image as a design resource for DataV-Board. For more information, see Create Design Resource.

    • Background Image Repeat: When enabled, if the background image cannot fill the button area, the image will be displayed repeatedly.

    • Background Image Size: Supports selecting various size styles such as cover, fill, auto, and stretch. Please choose reasonably according to the image size to avoid blank space or unreasonable trimming.

  • Border Style: You can set the line, color, thickness, and border radius of the border.

  • Hyperlink Configuration:

    • Hyperlink: After configuring the link, clicking the button in the preview or publish page will navigate to the corresponding link.

    • Open in New Window: When enabled, clicking the button in the preview or publish page will open a new window in the browser to display the content of the navigation link. If not enabled, the link content will be displayed on the current page.

image

Click Style Configuration

Define the display style of the current button when the mouse clicks the button. For detailed configuration information, see the configuration content in Global style configuration.

image

Hover Style Configuration

Define the display style of the current button when the mouse hovers over it. For specific configuration details, see the configuration content in Global style configuration.

image

Advanced configuration

Define the interaction between the button and other widgets. The configuration items are as follows.

Configuration Item

Description

Illustration

Interaction Occurrences

Defines the interaction behavior with other widgets to achieve widget filter interaction. Click the image icon to define related interaction occurrences and interaction actions.

image

Associate Global Variables

Global parameters can be associated in the widget to achieve parameter passing between widgets for widget interaction. Click the image icon to enable the corresponding instruction and associate the required global variable for the instruction.

Clicking the button will trigger a data request. By default, the Value configured in the data source panel is thrown. For configuration details, see Widget Interaction Configuration.

Blueprint interaction

Use the Blueprint Editor to visually define interaction relationships and behavior logic between widgets.

Procedure

  1. On the canvas editing page, click the image icon on the left side of the top menu bar to enter the blueprint editor.

  2. In the layer node list, hover over the button widget and click the image icon to add the widget to the main canvas.

  3. Configure the blueprint interaction effects of related widgets as needed through the connection method.

    The example is as follows. image

Configuration item description

The related interaction occurrences and actions are described as follows.

Note

Click the image icon after the corresponding occurrence or action on the right side of the blueprint configuration interface to view detailed descriptions of related parameters.

Category

Subcategory

Description

Occurrences

When Data Is Updated

This occurrence is thrown when the widget data is updated.

When Data Request Status Changes

This occurrence is thrown when the data request status changes. Status values include Void, Loading, Success, Error.

When Button Is Clicked

This occurrence is thrown when the button is clicked, and the corresponding data item of the occurrence is also thrown. The data example is as follows.

{
  "value": "Submit"
}

Actions

Import Data

After processing the data according to the widget rendering format, import it into the widget and redraw it. There is no need to request server data again. The data example is as follows.

[
  {
    "value": "Confirm"
  }
]

Request Data

Request server data again. The data thrown by the input data processing node or layer node will be used as a parameter. For example, if the API data source configured for the button is https://api.test, and the data passed to the Request Data action is { id: '1'}, the final request will be https://api.test?id=1.

Shift

Move the widget to a specified position. The data example is as follows.

    {
      // Movement method. Absolute positioning: to, relative positioning: by. Default value: to.
        "positionType": "to",
      // Specified position. x-coordinate, y-coordinate.
      "attr": {
        "x": 0,
        "y": 0
      },
      // Animation method.
      "animation": {
        "enable": false,
        // Animation delay.
        "animationDuration": 1000,
        // Animation curve. Optional values are: linear|easeInOutQuad|easeInOutExpo.
        "animationEasing": "linear"
      }
    }

Switch Visibility

Switch the widget to show or hide. The data example is as follows.

{
  "animationType": "fade",
  "animationDuration": 1000,
  "animationEasing": "linear"
}
  • animationType: Animation method. It can be configured as appear (appear/disappear), fade (fade in/fade out), slideToUp (fly in/fly out). If not configured, it means no animation.

  • animationDuration: Animation delay, default is 1000ms.

  • animationEasing: Animation curve. It can be configured as linear (uniform speed), easeInOutQuad (smooth), easeInOutExpo (slow-fast-slow).

Show

Hide

Update Widget Configuration

Dynamically update the style configuration of the widget.

  1. First, in the Style panel of the widget, click Copy Configuration To Clipboard to obtain the configuration data of the widget.

  2. As needed, change the field values of the corresponding style in the data processing node on the blueprint editor configuration page.