Skip to main content

bar chart

Applicable Scenarios#

Data size comparison for report scenario.

Usage Instructions

Go to the Application Editor page, then drag the Chart Components > Bar Chart component into the corresponding container.

Properties

External properties received by the component

Property Name
Property Identifier
Type
Description
histogram orientationdirectionTypestring

Support horizontal and vertical. The vertical dimension is the X-axis, and the numeric value is the Y-axis, and conversely for horizontal. This document uses vertical as the attribute setting example.

Example: "lengthways"

Whether to stackisPileboolean

This property takes effect only when multiple Y-axes exist

Example: false

Display HeadlinesisTitleboolean

Example: true

chart titletitlestring

Example: "柱状图标题"

data filterfilterDataobject

Configurable data value ranges, see data filtering configuration

color schemesetColorarray

When multiple numerical or dimensional field groups exist, different categories are shown based on different color schemes, supporting customizable color palettes.

Example: [ "#2A70E2", "#46B690", "#EDB539", "#E46961", "#4FB3D2", "#805FDC" ]

Display null coordinatesxIsCountEmptyboolean

Example: false

Display axis nameisXaxisNameboolean

Example: true

NamexAxisNamestring

Example: ""

Display tagisXaxisAxisLabelShowboolean

Example: true

Display X-axis scaleisXaxisAxisTickShowboolean

Example: true

Text auto skewisXaxisAxisLabelRotateboolean

Example: false

Display grid linesisYAxisSplitlineLinestyleWidthboolean

Example: true

grid lines lineyAxisSplitlineLinestyleTypestring

Example: "solid"

Maximum valueyAxisMaxnumber
Minimum valueyAxisMinnumber
Display Y-axis nameisYAxisNameboolean

Example: true

NameyAxisNamestring

Example: ""

display numeric valueisYAxisShowboolean

Numeric value (Y-axis) display numeric value

Example: true

display numeric valueisSeriesShowSymbolboolean

data tag display numeric value

Example: true

display unitisUnitboolean

Example: false

Numeric value magnitudeunitnumber

Example: 1

number of decimal placesdecimalDigitsnumber

Example: 0

suffixsuffixstring

Example: ""

Data sourcedataSourceTypestring

Data source type selection

Example: "data-model"

data modeldataModelobject

Show model data source

data source variabledatasourceVariablearray

data source variable

APIsconnectorobject

Data display APIs source selection

calling methodconnectorMethodobject

The input/output parameters of the method must meet the component requirements. View the document (https://cloud.tencent.com/document/product/1301/71197#.E6.9F.B1.E7.8A.B6.E5.9B.BE.E3.80.81.E6.8A.98.E7.BA.BF.E5.9B.BE.E3.80.81.E9.A5.BC.E5.9B.BE)

API invocation method selection for displaying data

Query input parametersconnectorParamsobject

对APIs调用方法获取的数据进行筛选过滤。支持对象类型,例如 {name:'',value:''}

field selectionxFieldobject

X-axis value field selection

Statistical dimensionxStatisticsstring
field selectionyFieldobject

Numeric value (Y-axis) field selection

groupgroupKeystring

When only one field is selected for the Y-axis, the X-axis can be grouped by a fixed field. Example: X-axis shows salesperson, grouped by sales region.

grouping dimensiongroupKeyTimeSpanstring
Display legendsisLegendboolean

Example: true

legend positionlegendstring

Example: "bottom"

Events

None

Advanced Properties

It supports configuring axis styles, data labels, display units, and other properties.

  • Display unit: Numerical magnitude supports unit/ten/hundred/thousand/ten thousand/hundred thousand/million/ten million/hundred million.
  • Decimal places: Supports 0-10 decimal places.
  • Suffix: Supports customization. By default, it is generated based on the numerical magnitude as -/ten/hundred/thousand/ten thousand/hundred thousand/million/ten million/hundred million.

APIs Usage Scenarios

When selecting APIs as the data source during configuration, users need to define data within the APIs according to the parameter structure to ensure proper rendering in the statistical card component. For details, refer to Chart Component Parameter Definitions.

? When using APIs, properties such as data filtering, field selection, statistical method, and null value statistics must be defined by the user within the created APIs. Other properties remain consistent with the configuration in the data model usage scenario.

Usage Example

The following example data source is a sales performance table. The example data configuration is shown in the table below. For more data configuration operations, refer to Data Model.

Sales NameCustomer RegionTotal SalesOrder CountGender
Zhang SanBeijing10000003Male
Zhao SiBeijing20000002Male
Zhao SiShanghai1000001Male
Wang WuShanghai2000001Male
Wang WuShenzhen5000001Male
Li LiuBeijing50000006Female
Li LiuShenzhen2000001Female

Example 1: Comparison of Total Sales Performance by Salesperson (Vertical)

  1. Create a new Bar Chart component, go to the Properties > Basic Properties page on the right, click the Data Source drop-down menu, select Sales Performance Table, and choose a Statistical method.

  2. In Dimension (X-axis), click the Field Selection drop-down menu and select Sales Name.

  3. Under Value (Y-axis), click Add Y-axis Field. For Field type, select Total Sales; for Relationship type, select Sum.

  4. Scroll down the right-side properties, enter the Advanced Properties section, and click to enable Display Unit. Click the Quantity Level drop-down menu and set it to 10,000, then set the Suffix item to 10,000.

  5. Modify the title, axis styles, legend style, and other properties as needed. The final result is shown in the figure below:

Example 2: Comparison of Total Sales Performance by Salesperson (Vertical) - by Region

Based on the configuration of [Example 1], add a grouping field by clicking the Group drop-down menu and selecting Customer Region.

Final Effect Display:

Click to enable the Stacking function to view the stacking effect:

Example 3: Comparison of Total Sales Performance by Salesperson (Vertical) - Viewing Only Data for Male Gender

  1. Based on the configuration of [Example 1], click Data Filter.

  2. Set the corresponding data filter parameters, and click OK to add the filter condition.

Example 4: Comparison of "Number of Customer Coverage Regions" and "Total Sales Orders" by Salesperson (Horizontal)

  1. Click Bar Chart Orientation and select Horizontal.

  2. In Dimension (Y-axis), click the Field Selection drop-down menu and select Sales Name.

  3. Under Value (X-axis), click Add Field to add the following two fields:

  • Field 1: Customer Region; Statistical Method: Count
  • Field 2: Number of Sales Orders; Statistical Method: Sum
  1. Final Effect Display:

Limitation Description

The dimension axis does not support setting the time type, but supports setting the date type and datetime type.

Frequently Asked Questions

Why doesn't the chart support displaying Chinese names for fields such as association/enumeration?

Since the chart component retrieves statistical data by querying from the server-side, it currently does not support displaying Chinese names for association fields/enumeration fields/option set fields. If you need precise control over chart display, you can use the Universal Chart, which allows achieving various flexible display effects through configuration.

How to flexibly control various styles of the chart, such as centering the title?

Since the chart component itself only provides common configurations, for content that cannot be configured in the chart component, you can try using the Universal Chart to achieve various flexible display effects.

Relationship Between Chart Component and Universal Chart Component

  • The Universal Chart component is a versatile chart component that can be configured to generate various charts such as line charts, pie charts, area charts, maps, funnel charts, dashboards, and all other chart types. Using this component enables quick integration of all Echarts charts.
  • The UI configuration of the Universal Chart component is more flexible, supporting virtually all common chart types.
  • The Universal Chart component itself is independent of data. Data statistics can be achieved through Query, which is performed via APIs or MySQL connectors, and then bound to the Universal Chart component.