Area chart

更新时间:
复制 MD 格式

This topic describes the style and configuration options for the Area chart widget.

Important

When you add a BI analysis widget in the canvas editor, an analyzer is automatically created for the widget in the Layers pane. You must create a dataset for the BI analysis widget. For more information about how to create a dataset and use the BI analyzer, see Add a dataset and BI analyzer interactions.

Chart style

An area chart is a type of line chart that combines lines and shaded areas to show the change trends of multi-dimensional, real-time data. You can customize the y-axis range, configure multiple data series, and display a specific series as a ticker board.

image

Configuration 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 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

    Parameter

    Description

    Chart Margin

    Click the 开关图标 icon to show or hide the chart margin. If this option is enabled, you can set the distance between the chart area and the top, bottom, left, and right borders of the widget. The default unit is px.

    Area Type

    The type of the area chart. Options: Basic and Stacking.

    Display Type

    The display type of the area chart. Options: Line and Curve.

    Line Type

    The type of the line. Options: Solid line, Dashed line, and Dotted line.

    Line Width

    The width of the line in px.

    Area Color

    The color of the area. For more information, see Color picker. You can map colors to different data series.

    Fill Color

    The fill color of the area. For more information, see Color picker. You can map colors to different data series. This option is available when Sync Fill Color is set to Do not sync.

    Point Color

    The color of the data points. For more information, see Color picker. You can map colors to different data series. This option is available when Sync Point Color is set to Do not sync.

    Sync Fill Color

    Specifies whether the fill color is the same as the area color. Options: Sync and Do not sync.

    Sync Point Color

    Specifies whether the point color is the same as the area color. Options: Sync and Do not sync.

    Opacity

    The opacity of the line and area. A larger value indicates higher opacity.

    Marker Symbol

    The style of the markers for data points in the area chart. You can set the shape and size of the markers. Click the 开关图标 icon to show or hide this option.

    Marker Outline

    The outline style of the markers for data points. You can set the line type, width, and color of the outline. Click the 开关图标 icon to show or hide this option.

    Line Label

    The style of the line labels. Click the 开关图标 icon to show or hide the line label options.

    • Label Field: The content of the label. The content must correspond to a field in the data panel. By default, the value of the y field is used.

    • Number Format: The number format for the labels. Options: Default, 11 (integer), 11.1 (floating-point number), 11.11 (floating-point number), 11% (percentage), 11.1% (percentage), 1,111 (thousands separator), and 1,111.1 (thousands separator). For more information about data display formats, see Data display formats. This option is available only when the y field is selected for Label Field.

    • Prefix and Suffix: The prefix and suffix of the line labels.

    • Relative Offset: The vertical and horizontal offset of the line labels relative to the line. The unit is px.

    • Rotation Angle: The rotation angle of the line labels relative to the line.

    • Layout Optimization: Automatically optimizes overlapping text and text near borders.

    • Text Style: The text style of the line labels, including the font, weight, size, and color.

    • Text Outline: The text outline style of the line labels, including the width and color of the outline.

    Texture

    The texture style of the area. Click the 开关图标 icon to show or hide the texture options.

    • Type: The type of the texture. Options: Point, Line, and Square.

    • Fill Style: The fill style of the texture. For more information, see Color picker. You can use the color picker to configure the color of the texture.

    • Outline Style: The outline style of the texture. For more information, see Color picker. You can use the color picker to configure the color of the texture. This option is available when Type is set to Point or Square.

    • Extra Style: Other styles of the texture, including Shape Size, Shape Spacing, Line Spacing, Rotation Angle, and the Interlaced switch.

  • Axes: The widget has an x-axis and a y-axis.

    • X-Axis

      • Show X-Axis: If this option is enabled, the x-axis is visible. If this option is disabled, the x-axis is hidden.

      • Data Type: Specifies the data type of the x-axis. Options include Numeric, Category, and Time.

      • Axis Line: Configures the style of the x-axis line, including the line type, width, and color. You can click the 开关图标 icon to show or hide this option.

      • Axis Title: Configures the style of the x-axis title. You can click the 开关图标 icon to show or hide this option.

        Parameter

        Description

        Title Display

        The text content of the x-axis title.

        Display Style

        The display style of the x-axis title, including the angle and offset.

        Text Style

        The font, weight, size, and color of the x-axis title text.

      • Tick Line: Configures the style of the x-axis tick lines, including the length, width, and color. You can click the 开关图标 icon to show or hide this option.

      • Axis Label: Configures the style of the x-axis labels. You can click the 开关图标 icon to show or hide this option.

        Parameter

        Description

        Display Format

        The display format for the data. This option is valid only for time-series data. For example, use YYYY/MM/DD HH:mm:ss for time, d for integers, and .1f for floating-point numbers.

        End Spacing

        The distance between the x-axis labels and the two ends of the axis. The unit is percent (%).

        Label Display

        The display style of the labels, including the number of x-axis labels, the prefix and suffix, the angle, the offset, and the alignment.

        Text Style

        The font, weight, size, and color of the x-axis label text.

      • Gridline: Configures the style of the x-axis gridlines, including the line type, width, color, length, and spacing. You can click the 开关图标 icon to show or hide this option.

    • Y-Axis

      • Show Y-Axis: If this option is enabled, the y-axis is visible. If this option is disabled, the y-axis is hidden.

      • Display Range: Defines the display range of the y-axis by specifying a minimum and maximum value.

        Parameter

        Description

        Minimum

        The minimum value of the y-axis. You can enter a custom value or select one of the following system options:

        • 0: The system sets the minimum value of the y-axis range to 0 by default.

        • Data Minimum: Uses the minimum value from the data.

        Maximum

        The maximum value of the y-axis. You can enter a custom value or select Data Maximum to use the maximum value from the data.

      • Axis Line: Configures the style of the y-axis line, including the line shape, width, and color. You can click the 开关图标 icon to show or hide this option.

      • Axis Title: Configures the style of the y-axis title. You can click the 开关图标 icon to show or hide this option.

        Parameter

        Description

        Title Display

        The text content of the y-axis title.

        Display Style

        The display style of the y-axis title, including the angle and offset.

        Text Style

        The font, weight, size, and color of the y-axis title text.

      • Tick Line: Configures the style of the y-axis tick lines, including the length, width, and color. You can click the 开关图标 icon to show or hide this option.

      • Axis Label: Configures the style of the y-axis labels. You can click the 开关图标 icon to show or hide this option.

        Parameter

        Description

        Display Format

        The number format for the y-axis labels. Options: Default, 11 (integer), 11.1 (floating-point number), 11.11 (floating-point number), 11% (percentage), 11.1% (percentage), 1,111 (thousands separator), and 1,111.1 (thousands separator). For more information about data display formats, see Data display formats.

        End Spacing

        The distance between the y-axis labels and the two ends of the axis. The unit is percent (%).

        Label Display

        The display style of the labels, including the number of y-axis labels, the prefix and suffix, the angle, the offset, and the alignment.

        Text Style

        The font, weight, size, and color of the y-axis label text.

      • Gridline: Configures the style of the y-axis gridlines, including the line type, width, color, length, and spacing. You can click the 开关图标 icon to show or hide this option.

  • Animation: Configures the animation effect style of the area chart.

    Parameter

    Description

    Enable Animation

    If this option is enabled, you can configure the animation effect for the area chart.

    Animation Effect

    The type of animation effect. The system provides multiple common animation effects, such as Fade, Scale In, and Slide In. This option is available only when Enable Animation is turned on.

    Animation Duration

    The duration of the animation effect in ms. This option is available only when Enable Animation is turned on.

  • Interaction: Configures the interaction effect style of the area chart widget.

    • Tooltip: Configures the style of the tooltip that appears when you hover over or click the area chart on the preview or publish page. You can click the 开关图标 icon to enable or disable the tooltip.

      Parameter

      Description

      Mode

      The mode of the tooltip. Options: Simple and General.

      Trigger Method

      The method to trigger the tooltip. Options: Hover and Click.

      Display Position

      The display position of the tooltip. Options: Top, Bottom, Left, and Right.

      Title Spacing

      The spacing between titles in the tooltip. The unit is px.

      Title Text

      The style of the title text in the tooltip, including the font, weight, size, and color.

      Content Display

      This option is available when Mode is set to General. Click the 加号图标 or 垃圾桶图标 icon to add or delete a content display series for the tooltip. Click the 横排列图标 or 竖排列图标 icon to arrange multiple content display series. Click the 复制图标 icon to copy the current content display series configuration and add a new series with the same configuration.

      • Field Name: The field name for the tooltip content. This must match a field in the data panel.

      • Display Name: The display name for the tooltip content.

      • Suffix: The suffix for the tooltip content.

      Content Spacing

      The spacing between content text in the tooltip. The unit is px.

      Content Text

      The style of the content text in the tooltip, including the font, weight, size, and color.

      Suffix

      The suffix style for the content text in the tooltip.

      Popup Background

      The background style of the tooltip popup.

      • Background Margin: The horizontal and vertical margins of the tooltip popup background.

      • Background Color: The background color of the tooltip.

      • Border Style: The border style of the tooltip, including the line type, border radius, line width, and border color.

      Axis Pointer

      The style of the axis pointer for the tooltip, including the type, width, and color. Click the 开关图标 icon to enable or disable the axis pointer.

      Note

      If you set the line type to Dashed line or Dotted line, you can also configure the dash length and the distance between dashes.

    • Selected State: Configures the style of an area when it is selected. You can click the 开关图标 icon to enable or disable the selected state style.

      Parameter

      Description

      Trigger Method

      The method to trigger the selection of an area. Options: Hover and Click.

      Selection Method

      The method to select areas. Options: Single and Multiple. If you select Single, the click event triggers only one data item in object format, and only one area can be highlighted. If you select Multiple, the click event can trigger multiple data items in array format, and multiple areas can be highlighted.

      Line Type

      Set the line type, width, and color. Click the 开关图标 icon to enable or disable the line type style.

      Selected Color

      Set the type, thickness, and color of the outline.

      Marker Size

      Set the marker size.

      Marker Outline

      Set the type, width, and color of the outline.

    • Overview Axis: If the area chart contains a large amount of data, you can configure the style of the overview axis interaction. You can click the 开关图标 icon to enable or disable the overview axis interaction effect.

      Parameter

      Description

      Default Range

      The data range displayed by the overview axis. The value ranges from 0 to 1.

      Slider Style

      The style of the overview axis slider, including the height, foreground color, and background color.

      Text Style

      The style of the text on the overview axis, including the font, weight, size, and color. This option is available only when the overview axis style is enabled.

      Background Trend

      The style of the background trend of the area chart displayed on the overview axis, including the line type, width, and color. This trend is usually consistent with the line data trend in the chart. This option is available only when the area chart has a single data series.

      Handle Style

      The style of the handles at both ends of the overview axis, including the width and height, the default and highlighted background colors, and the border radius and color.

  • Legend: Configures the style of the area chart legend.

    Parameter

    Description

    Enable Legend

    If this option is enabled, you can configure the legend style. If this option is disabled, you cannot configure the legend style.

    Legend Position

    The position of the legend relative to the widget's starting coordinate. Options: Top Left, Top Center, Top Right, Bottom Left, Bottom Center, Bottom Right, Left Top, Left Center, Left Bottom, Right Top, Right Center, and Right Bottom.

    Text Style

    The font, weight, size, and color of the legend text.

    Chart Spacing

    The horizontal and vertical spacing between the legend and the chart.

    Categorical Legend

    The style of the categorical legend.

    • Marker Size: The size of the legend markers.

    • Legend Spacing: The horizontal and vertical distance between different legend categories.

    • Maximum Width: The maximum width of the legend in px.

    • Enable Pagination: If this option is enabled, you can turn on pagination for the legend. You can configure the page number and arrow styles for when the legend has too many items and requires pagination. If this option is disabled, all legend items are displayed on a single page.

      • Maximum Rows: The maximum number of rows for the legend. If the number of rows exceeds this value, the legend will be paginated.

      • Page Number Style: The style of the page numbers, including the font, weight, size, and color.

      • Arrow Style: The size, default color, and disabled color of the arrows in the pagination style.

  • Condition: The condition for applying the style.

    Conditional Style: You can click the 加号图标 or 垃圾桶图标 icon to add or delete a conditional style. You can click the 横排列图标 or 竖排列图标 icon to arrange multiple conditional styles. You can click the 复制图标 icon to copy the current conditional style configuration and add a new style with the same configuration. For more information about the configuration, see Conditional tree.

    Parameter

    Description

    Line Type

    The line type for the current conditional style. Options: Solid line, Dashed line, and Dotted line. Click the 开关图标 icon to show or hide the line type.

    Line Width

    The line width for the current conditional style in px. Click the 开关图标 icon to show or hide the line width.

    Line Color

    The line color for the current conditional style. For more information, see Color picker. You can map colors to different data series. Click the 开关图标 icon to show or hide the line color.

    Point Color

    The point color for the current conditional style. For more information, see Color picker. You can map colors to different data series. Click the 开关图标 icon to show or hide the point color.

    Fill Color

    The fill color for the current conditional style. For more information, see Color picker. You can map colors to different data series. Click the 开关图标 icon to show or hide the fill color.

    Opacity

    The opacity of the line and area for the current conditional style. A larger value indicates higher opacity. Click the 开关图标 icon to show or hide the opacity.

    Marker Symbol

    The shape and size of the marker symbol for the current conditional style. Click the 开关图标 icon to show or hide the marker symbol.

    Marker Outline

    The line type, width, and color of the marker outline for the current conditional style. Click the 开关图标 icon to show or hide the marker outline.

Data panel (default mode)

Field description

Field

Description

colorField

(Optional) The color mapping field. You can use this field to configure color mapping for the areas.

x

The category of each area in the area chart. This corresponds to the x-axis value.

y

The value of each area in the area chart. This corresponds to the y-axis value.

Table 1. 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 asset 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.

Data panel (analysis mode)

Important

Before you can use the BI analysis feature provided by DataV datasets, the system makes the following changes to the area chart.

  • The data source for the Area Chart API is switched from static data to a DataV dataset.

  • The DataV dataset configuration is updated. This operation does not cause any loss of field configurations.

For more information about the operations in the BI analysis data panel, see BI analysis data panel.

Field description

Field

Description

x

The category of each area in the area chart. This corresponds to the x-axis value.

y

The value of each area in the area chart. This corresponds to the y-axis value.

Series

The color mapping series value. You can use this field to configure color mapping for areas in different data series.

Note

For widgets added from the BI analysis module, the data panel is in analysis mode by default. For widgets from versions earlier than v5.x that are not in BI analysis mode, the data panel is in default mode. If a widget is added in analysis mode, you can click Default Mode in the upper-left corner of the data panel. In the dialog box that appears, you must confirm that you want to exit analysis mode and delete the corresponding analyzer for the BI analysis widget. After you exit analysis mode, the BI analysis widget is converted to a v5.x widget, and its data panel switches to default mode.

Interaction panel

Interaction description

Interaction

Description

When a data point is selected (point)

Select Enable to enable this interaction feature for the widget. The Area chart widget has an interaction configuration. When a data item is clicked, a callback value is triggered. By default, the x and y fields in the data are returned. For more information about the configuration, see Configure a callback ID for a ticker board widget.

When a data point is selected (line)

Select Enable to enable this interaction feature for the widget. The Area chart widget has an interaction configuration. When a data item is clicked, a callback value is triggered. By default, the x and y fields in the data are returned. For more information about the configuration, see Configure a callback ID for a ticker board widget.

When a data point is selected (area)

Select Enable to enable this interaction feature for the widget. The Area chart widget has an interaction configuration. When a data item is clicked, a callback value is triggered. By default, the x and y fields in the data are returned. For more information about the configuration, see Configure a callback ID for a ticker board widget.

When a legend item is clicked

Select Enable to enable this interaction feature for the widget. The Area chart widget has an interaction configuration. When a legend item is clicked, a callback value is triggered. By default, the value and checked fields in the data are returned. For more information about the configuration, see Configure a callback ID for a ticker board widget.

When a line is clicked

Select Enable to enable this interaction feature for the widget. The Area chart widget has an interaction configuration. When a line is clicked, a callback value is triggered. By default, the mappingData field in the data is returned. For more information about the configuration, see Configure a callback ID for a ticker board widget.

Blueprint editor interaction configuration

Note

You cannot configure Blueprint Editor interactions for an area chart widget in BI analysis mode. You can configure blueprint interactions only in default mode.

  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 Area Chart widget in the Added Nodes pane. The configuration parameters for the area chart appear on the canvas.

    • Events

      Event

      Description

      When the Line Chart API Request Completes

      This event is triggered when the data API request is successful and the returned data is processed by the filter. The processed data is returned in JSON format. For a data example, see the Data Response section on the Data tab of the widget's configuration panel in the canvas editor.

      When the Line Chart API Request Fails

      This event is triggered when the data API request fails due to a network issue or an API error and the returned data is processed by the filter. The processed data is returned in JSON format. For a data example, see the Data Response section on the Data tab of the widget's configuration panel in the canvas editor.

      When a data point is selected (point)

      This event is triggered when you click a point on the area chart. The data item that corresponds to the point is returned.

      When a data point is selected (line)

      This event is triggered when you click a line on the area chart. The data item that corresponds to the line is returned.

      When a data point is selected (area)

      This event is triggered when you click an area on the area chart. The data item that corresponds to the area is returned.

      When a legend item is clicked

      This event is triggered when you click a legend item of the area chart. The data item that corresponds to the legend item is returned.

      When a line is clicked

      This event is triggered when a line is clicked. The data item that corresponds to the line is returned. The following code provides a data example.

      {
        "mappingData": []  // Mapping data
      }
    • Actions

      Action

      Description

      Line Chart API Request

      Re-requests server-side data using the output from upstream data processing nodes or layer nodes as parameters. For example, if the API data source for a line chart is https://api.test and the data passed to the Request Line Chart API action is { id: '1'}, the final request URL is https://api.test?id=1.

      Line Chart Import API

      Processes the data in the required format and imports it into the widget to redraw the chart. You do not need to send a request to the server-side for data again. For a data example, see the Data Response section on the Data tab of the widget's configuration panel in the canvas editor.

      Highlight

      Highlights the element corresponding to the data item. The following code provides a reference data example.

      return {
        "data": {
          "x": data.x,// The data item to highlight
          "colorField": data.colorField
        },
        "style": {
          "fillStyle": "#f00"// Fill color
        }
      }

      Clear Highlight

      Clears the highlight. No parameter is required.

      Update Widget Configuration

      Dynamically updates the style configuration of the widget. In the Configuration panel of the widget, click Copy Configuration to Clipboard to get the widget configuration data. Then, change the field values for the corresponding styles in the data processing node on the Blueprint Editor configuration page as needed.

      Show

      Shows the widget. The following code provides a reference data example.

      return{
        "animationType": "",
        "animationDuration": 1000,
        "animationEasing": "linear"
      }

      Hide

      Hides the widget. The following code provides a reference data example.

      return{
        "animationType": "",
        "animationDuration": 1000,
        "animationEasing": "linear"
      }

      Toggle Visibility

      Toggles the visibility of the widget. The following code provides a reference data example.

      return {
        "animationIn": {
          "animationType": "",
          "animationDuration": 1000,
          "animationEasing": "linear"
        },
        "animationOut": {
          "animationType": "",
          "animationDuration": 1000,
          "animationEasing": "linear"
        }
      }

      Move

      Moves the widget to a specified position. The following code provides a reference data example.

          return{      
            // Move mode. Options: to (absolute positioning) and by (relative positioning). Default value: to.
              "positionType": "to",
            // The destination position (x- and y-coordinates).
            "attr": {
              "x": 0,
              "y": 0
            },
            // Animation settings.
            "animation": {
              "enable": false,
              // Animation duration.
              "animationDuration": 1000,
              // Animation curve. Options: linear, easeInOutQuad, and easeInOutExpo.
              "animationEasing": "linear"
            }
          }