All Products
Search
Document Center

DataV:Basic pie chart (v3.x version)

Last Updated:May 17, 2023

A basic pie chart is a type of pie chart. It allows you to use polar coordinates to determine the size of a chart, display labels on the outside of a chart, switch between real values and percentage values, customize graphic styles, and configure multi-series data. It can clearly and intelligently display the proportions of each category. This topic describes the configuration items of a basic pie chart.

Parameter

  • 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 asset configurations.
  • 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.
  • Chart

    • Value Label

      Parameter

      Description

      Text

      The style of the numeric label text, including the text font style, font size, font color, and text weight.

      Real Value

      When enabled, the actual value of the data is displayed; when disabled, the percentage value of the data is displayed. 开启真实数值面板

      Number of decimal places

      The number of decimal places to display for the value. This can be configured only when the real value is disabled.

    • Category Label: the style of the category in the label. You can click the 眼睛图标icon on the right to display or hide the category label.

      The style of the category label text, including the text font style, font size, font color, and text weight.

    • Label Guide: the style of the label guide in the pie chart.

      Parameter

      Description

      Distance from label to center

      The horizontal distance between the label and the center of the pie chart. Valid values: 0 to 1.

      wheelbase center

      The vertical distance between the label and the center of the pie chart. Valid values: 0 to 1. If it is set too small, it will be surrounded to the center of the circle.

    • Legend: the legend style of the chart. You can click the 眼睛图标icon to display or hide the legend. 图例面板

      Parameter

      Description

      Text

      Set the style of the legend text, including the text font style, font size, font color, and font weight. For more information, see color picker instructions.

      Layout

      The positional relationship between the legends.

      • Spacing

        • Left and Right Spacing: The distance between the left and right sides of adjacent legends. This configuration items is only valid when there are multiple series.

        • Distance: the distance between the legend and the upper and lower boundaries of the widget.

      • Position: the position of the legend relative to the start coordinate of the widget. Valid values: Top Left, Top Center, Top Right, Bottom Left, and Bottom Center Bottom Right.

  • Axis: the radial axis style of the pie chart. 径向轴面板

    Parameter

    Description

    Radius

    The radius includes the inner and outer radius.

    • Inner Radius: the distance from the innermost side of the ring to the center of the axis. The value is a percentage of the component height. Valid values: 0 to 1.

    • Outer Radius: the distance from the outermost side of the ring to the center of the axis. The value is the proportion of the component height. Valid values: 0 to 1.

    Grid Line

    The grid line style of the polar axis. You can click 眼睛图标the icon to control the display of the grid line.

    Color: the color of the grid lines.

  • Series

    data series: Click the 加号图标or 垃圾桶图标icon on the right to add or delete a data series. Click the 横排列图标or 竖排列图标icon to configure the arrangement style of multiple data series.

    Color The color of the sector under this series.

  • Other scenarios

    • Easing Animation: the animation effect style of the pie chart. You can click the 眼睛图标icon to enable or disable the animation effect. 饼图动画面板

      Parameter

      Description

      Animation Settings

      • Easing Effect: the easing effect of the animation. The system provides a variety of common easing effects for you to choose from.

      • Sequential Animation of Each Series: If you turn on the switch, the animation of each series of sectors is played in sequence. If you turn off the switch, the animation of all sectors is played at the same time.

      • Start at Zero: If you turn on the switch, each sector is played from zero when the component renders the animation for the first time. If you turn off the switch, each sector is played from the start of each sector at the same time when the component renders the animation for the first time.

      Admission Animation

      The duration of the first animation rendered by the component. Unit: ms.

      Update Animation

      • Update Animation Duration: the duration of the animation when the widget data is updated. Unit: ms.

      • Start From Previous Position: If you turn on this switch, the animation starts from the position of the previous data when the widget data is updated. If you turn off this switch, the animation starts from the initial position when the widget data is updated.

    • dialog box: The style of the dialog box that appears when you move the pointer over or click a fan on the preview or publish page. Click 眼睛图标the icon to turn the dialog box on or off.

      Parameter

      Description

      Disappearing Delay Time

      When the trigger condition is not met, the dialog box will disappear. This configuration items sets the delay time before the dialog box disappears, in ms.

      Trigger Condition

      Trigger Action: dialog box the action to be triggered. This field is optional, including Hover and Click.

      Text Style

      The style of the text in the dialog box, including the font style, weight, font size, and color.

      Background Box Style

      The background box style of the dialog box.

      • Background Color: the background color of the dialog box.

      • Custom: the width and height of the dialog box. Unit: pixels. Click the 眼睛图标icon to turn custom dialog box on or off.

      • Pin: the inner margin of the dialog box. Unit: pixels.

      • Offset

        • Horizontal Offset: the horizontal offset of the dialog box relative to the mouse arrow. Unit: px.

        • Vertical Offset: the vertical offset of the dialog box relative to the mouse arrow. Unit: px.

      • Borders

        • Border: the border thickness of the dialog box. Unit: pixels.

        • Border Color: The border color of the dialog box.

The metadata of the filtering table.

The sample JSON code in the preceding figure is as follows.

[
  {
    "x": "Device",
    "y": 14
  },
  {
    "x": "Building materials",
    "y": 12
  },
  {
    "x": "Food",
    "y": 12
  }
]
Table 1. Field description

Parameter

Description

x

The category of each sector.

y

The value of each sector, which determines the percentage of each sector in the entire pie chart.

Table 1. Parameters
ParameterDescription
Controlled ModeIf 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 RequestAfter 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 SourceIn 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 asset data.
Data FilterIf 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 ResultThe 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

Select the Enable check box to enable interactions between widgets. When you click a sector of the basic pie chart, a data request is triggered, a callback value is thrown, and data of different sectors is dynamically loaded. By default, the x and y values in the data are returned. For more information, see Configure callback IDs.

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 蓝图图标icon in the upper-left corner.

  3. In Blueprint Editor, click the Basic Pie Chart widget in the Import Nodes pane. You can view the basic pie chart configuration parameters in the canvas.

    • Event

      Event

      Description

      When the basic pie chart interface request is completed

      The event is triggered with the processed JSON data after a data interface request is responded and processed by a filter. For specific data, see Data.

      When a data item is clicked

      The event that is raised when a sector of the basic pie chart is selected, and the data item corresponding to the sector is also raised.

    • Policy Action

      Policy Action

      Description

      Request a basic pie chart operation

      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 API data source is http://api.test and the data passed to the request basic pie chart interface is { id: '1'}, the final request interface is http://api.test?id=1.

      Import a basic pie chart

      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 specific data, see Data.

      Highlight

      Highlight the element corresponding to the data item. Example:

      {
        data: {
          x: 'Shanghai' // You can list multiple highlight conditions, similar to filter. 
        },
        options: {
          style: {
            fill: 'red'
          },
          selectMode: 'single',
          cancelHighlightFirst: true
        }
      }

      Unhighlight

      Cancels the highlighting of the element corresponding to the data item. Example:

      {
        data: {
          x: 'Shanghai'
        },
        options: {
          mode: 'single' // If the value is single, only one highlight is canceled when multiple data items are hit. If the value is multiple, all highlights are canceled when multiple data items are hit. 
        }
      }

      Clear components

      Clear component data. No parameters are required.

      Update component 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.

      Display

      A widget is shown without the need to specify parameters.

      Hide

      A widget is hidden without the need to specify parameters.

      Switch to the implicit state

      A widget is hidden or shown.

      Move

      A widget is moved to a specified location.

          {
            // 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"
            }
          }