> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xpertai.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Bar Chart

Bar charts are a common type of comparison chart that can be used to compare data between different categories or groups. For example, bar charts can be used to compare monthly sales revenue or compare sales revenue across different products.
Bar charts, as the most basic chart type, have multiple display forms. From a data perspective, they can be divided into four categories:

* Basic: One dimension and one measure;
* Multi-dimension: One measure and multiple dimensions;
* Multi-measure: One dimension and multiple measures;
* Multi-dimension multi-measure: Multiple dimensions and multiple measures;

If divided by bar direction, they can be:

* Horizontal
* Vertical

## Basic Bar Chart

The most basic bar chart consists of one dimension and one measure. Although you select the bar chart type, you can still change the display type of the measure component to one of: Bar, Line, Scatter. Similarly, line charts (Line) and scatter charts (Scatter) can also be changed to the other two display types.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/basic-attributes.png" alt="Small" />

Chart display is as follows:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/basic.png" alt="Small" />

## Multi-dimension Bar Chart

Generally, multi-dimension means two dimensions. More than that and the chart becomes quite cluttered.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/multi-dimensions-attributes.png" alt="Small" />

With two dimensions, one dimension serves as the default primary dimension, and the other as the secondary dimension, which can have its role set to `Group`, `Stacked`, or `Trellis`:

* **Group**: Members under the secondary dimension will be displayed side by side under the same primary dimension member.
* **Stacked**: Members under the secondary dimension will be stacked under the same primary dimension member.
* **Trellis**: Group by this dimension's members and display separately in small grids.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/dimension-role.png" alt="Small" />

### Group

When the secondary dimension role is set to **Group**, the display effect is as follows:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/multi-dimensions-group.png" alt="Small" />

### Stacked

When the secondary dimension role is set to **Stacked**, the display effect is as follows:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/multi-dimensions-stacked.png" alt="Small" />

### Trellis

When the secondary dimension role is set to **Trellis**, the display effect is as follows:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/multi-dimensions-trellis.png" alt="Small" />

In the chart settings panel, you can set **Trellis Horizontal Count** to determine the horizontal distribution count of grids. The vertical count will be automatically calculated:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/trellis-h-number.png" alt="Small" />

## Multi-measure Bar Chart

In multi-measure cases, measure components will be displayed side by side. If one measure's unit differs from others, such as growth rate being a percentage while others are amounts, you can set this measure's role to `Axis2`, and it will be displayed on a different value axis, forming a dual-axis combination chart.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/multi-measures.png" alt="Small" />

If you change the **Shape** property of one or more measure components to others like **Line** or **Scatter**, it forms a combination chart (Combination Chart):

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/multi-meausres-combine.png" alt="Small" />

## Multi-dimension Multi-measure Bar Chart

Multi-dimension multi-measure bar charts combine multi-dimension and multi-measure charts. Multiple dimensions follow the same display logic as multi-dimension charts, and multiple measure components will be displayed side by side:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/multi-dim-measures.png" alt="Small" />

## Bar Direction

Changing the direction property of the bar chart switches the display of the chart's X-axis and Y-axis:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/chart-orient.png" alt="Small" />

Horizontal bar chart display effect:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/h.png" alt="Small" />

## Polar Coordinates

Setting the bar chart's variant to **Polar Coordinates** yields a bar chart in polar coordinate system:

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/variant-polar.png" alt="Small" />

Combined with different direction properties, you can get two polar coordinate effects:

* Polar horizontal bar chart

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/polar.png" alt="Small" />

* Polar vertical bar chart

<img src="https://mintlify.s3.us-west-1.amazonaws.com/xpertai/en/bi/widget/analysis-card/radar.png" alt="Small" />

## 示例

<iframe src="https://app.xpertai.cn/public/story/point/ffca59a9-f433-4dce-943f-a4ee27d43bf6" width="100%" height="1000px" frameBorder="0" scrolling="no" allowFullScreen />
