A key-value table is a type of table widget. It allows you to customize table content in the form of key values. It can clearly display data in a table on a visualization application. It only supports the display of two columns of data, and cannot add new columns. This topic describes the configuration items of key-value tables.

Settings

Key-value table panel
  • Search for Configurations: In the right-side panel of Canvas Editor, click the Settings tab, and click Search for Configurations in the upper-right corner. Enter the required configuration item in the search box, and click the search icon to quickly locate the configuration item. Fuzzy match is supported. For more information, see Search for widget configuration items.
  • Size: indicates the size of a widget, including its pixel width and height. You can click the Proportional resizing icon to proportionally adjust the width and height of a widget. After you click this icon again, you can adjust the width and height as needed.
  • Position: the position of a widget, which is indicated by pixel X and Y coordinates. X-coordinate indicates the pixel distance between the upper-left corner of the widget and the left border of the canvas. Y-coordinate indicates the pixel distance between the upper-left corner of the widget and the upper border of the canvas.
  • Rotation Angle: the angle of a rotation that uses the center point of a widget as the rotation point. The unit is degrees (°). You can use one of the following methods to control the rotation angle of a widget:
    • Directly enter the degrees in the Rotation Angle spin box or click the plus sign (+) or minus sign (-) to increase or decrease the value in the Rotation Angle spin box.
    • Drag the black dot in the Rotation control icon icon.
    • Click the Horizontal flip icon to horizontally flip a widget.
    • Click the Vertical flip icon to vertically flip a widget.
  • Opacity: the opacity of a widget. Valid values: 0 and 1. If this parameter is set to 0, the widget is hidden. If this parameter is set to 1, the widget is completely displayed. Default value: 1.
  • Table
    Parameter Description
    Responsive
    • If you turn on the switch, the table adapts the widget size and distributes it reasonably. Open key-value table adaptation
    • If you turn off the switch, the table displays the original size. Disable key-value table adaptation
    Border Line The style of the border line outside the table.
    • Line Width: the width of the border line.
    • Line Color: the color of the border line. For more information, see the color picker description.
    Text Style The font family of all the text in the table. Default value: Microsoft Yahei.
  • Cell: the spacing between cells.
    Parameter Description
    Left and Right Paddings The distance between the text in a cell and the left and right boundaries of the cell. Valid values: 0 to 50. Unit: px.
    Top and Bottom Paddings The distance between the text in the cell and the upper and lower boundaries of the cell. If Responsive configuration items is enabled and the table does not overflow, this configuration items takes effect only on the table header. The remaining rows are adaptive to the height. The value ranges from 0 to 50. Unit: px.
  • Table HeaderKey-value table header configuration items
    • First Row as Table Header: If you turn on the switch, the first row of the table serves as the header and you can configure the text style of the header. If you do not need to configure the table header, you can disable this configuration items and delete the label and value fields in the data. If you turn off the switch, the table has no header style.
    • Text Style: This feature is displayed only after the First Row as Table Header configuration items is enabled.
      Parameter Description
      Font Color The color of the header text.
      Font Size The size of the header text. Valid values: 0 to 100.
      Font Weight The font weight of the header text.
    • Background Color: the background color of the table header. The color is displayed only after the First Row as Table Header is configuration items.
  • Column
    • Width Percentage (%): the percentage of the first column to the width of the table.
    • Separator Line
      Parameter Description
      Line Width The thickness of the line separator between the two columns.
      Line Color The color of the line separator between the two columns.
    • First Column
      Parameter Description
      Text Style The color, font size, and font weight of the first column of text.
      Background Color The background color of the first column.
      Text Alignment The alignment of the first column. Valid values: Align Left, Align Right, and Align Center.
    • Second Column: Configure the second column style for the first column.
  • Row
    • Separator Line
      Parameter Description
      Line Width The thickness of the line separator between different rows.
      Line Color The color of the line separator between different rows.
    • Odd-EvenThe key-value table distinguishes odd and even rows.
      • If you turn on the switch, the system automatically distinguishes between odd and even rows, and you can configure the background color of odd and even rows.
        Parameter Description
        Odd Row Color The background color of the odd rows in the table.
        Even Row Color The background color of even rows in the table.
      • If you turn off the switch, the system does not distinguish between odd and even rows, and all are displayed as the background color of the column.

Data

Key-value table data panel

The following figure shows sample data:

[
  {
    "label": "Supports two data format",
    "value": "This is the first"
  },
  {
    "key0": "This is the second type",
    "key1": "value1",
    "key2": "value2",
    "key3": "value3",
    "key4": "value4"
  }
]
Table 1. Parameters
Field Description
label Optional. The content of the first list header.
value (Optional) The contents of the second list header.
Note The label and value fields represent the header content only when the First Row as Table Header option is enabled in the header configuration items.
The body data format of the table is {"first column key":"second column value",...}. Other data can be customized and distributed in the corresponding rows and columns of the table in the order of actual data content.
Notice
  • Currently, the key-value table widget supports only two columns. You cannot add columns.
  • You can configure data to increase the number of rows in a key-value table.
Table 2. Parameters
Parameter Description
Controlled Mode If you turn on the switch, data is not requested when a widget is initialized. Data requests are triggered only based on callback IDs or the method configured in Blueprint Editor. If you turn off the switch, data requests are automatically triggered. By default, the switch is turned off.
Auto Data Request After you select the Auto Data Request check box, you can enable dynamic polling, and manually specify the polling interval. If you do not select this check box, data is not automatically requested. You must manually refresh the page to request data or use Blueprint Editor or callback ID events to trigger data requests.
Data Source In the right-side panel of Canvas Editor, click the Data tab. Click Set next to Static Data. In the Configure Datasource panel, select a data source from the Data Source Type drop-down list. Enter code for data query in the code editor, click Preview Data Response to preview the response of the data source, and then view the response. For more information, see Configure widget data.
Data Filter If you select the Data Filter check box, you can convert the data structure, filter data, and perform simple calculations. If you click the plus sign (+) next to Add Filter, you can configure the script for the data filter in the editor that appears. For more information, see Use the data filter.
Data Response Result The response to a data request. If the data source changes, you can click the Refresh icon icon next to Data Response Result to view the data response in real time.

Interaction

This widget does not support interaction events.

Configure interactions in Blueprint Editor

  1. In Canvas Editor, right-click a widget in the Layer panel and select Add to Blueprint Editor.
  2. Click the Blueprint Editor icon icon in the upper-left corner of the page.
  3. On the blueprint editor configuration page, click the Key Table component in the Import Nodes section. On the canvas, you can view the key-value table configuration parameters in the blueprint editor as shown in the following figure. Key-value table blueprint editor parameters
    • Event
      Event Description
      On Completion of Data Interface Request The event is triggered with the processed JSON data after a data interface request is responded and processed by a filter. For more information about specific data examples, see the Data Response Result section on the Data tab of the canvas editor.
      On Failure of Data Interface Request When a data interface request fails (the request may be caused by network problems or interface errors, etc.), the event is returned and processed by the filter, and the processed JSON-formatted data is also thrown. For more information about specific data examples, see the Data Response Result section on the Data tab of the canvas editor.
    • Action
      Action Description
      Request Data Interface This action is performed to request the server data again. The data sent by an upstream data processing node or layer node is used as a parameter. For example, if the key-value table is configured with the API data source as http://api.test and the data passed to the Request Data Interface action is { id: '1'}, the final request interface is http://api.test?id=1.
      Import Data Interface After data of a widget is processed in accordance with its drawing format, the widget is imported for redrawing. You do not need to request server data again. For more information about specific data examples, see the Data Response Result section on the Data tab of the canvas editor.
      Update Widget Configurations Style configurations of widgets are dynamically updated. Before this action is executed, you must click the widget in Canvas Editor, click the Settings tab in the right-side panel, and click Copy Configurations to... to obtain widget configurations. After that, change the style field for the data processing node in Blueprint Editor.
      Show A widget is shown without the need to specify parameters.
      Hide A widget is hidden without the need to specify parameters.
      Hide/Show A widget is hidden or shown.
      Move A widget is moved to a specified location. The following example shows the reference data.
          {
            // The positioning type. to indicates absolute positioning, whereas by indicates relative positioning. The default value is to. 
              "positionType": "to",
            // The location, which is indicated by the x and y coordinates. 
            "attr": {
              "x": 0,
              "y": 0
            },
            // The animation type. 
            "animation": {
              "enable": false,
              // The duration in which animation is displayed. 
              "animationDuration": 1000,
              // The animation curve, which can be set to linear|easeInOutQuad|easeInOutExpo. 
              "animationEasing": "linear"
            }
          }