ChartsBar Chart

BarChart

A bar chart is a chart or graph that presents categorical data with rectangular bars.

GitHub LogoSource Code

Usage

This example demonstrates a simple bar chart with a single data series. Each bar represents a data point, and a tooltip appears on hover to display additional information.

Multiple bars

Use the measures property to define what columns you want to represent on the chart.

Stacked bars

Use the stack property to stack the bars. The value of the stack has no special meaning, it’s just a string that represents the grouping of the bars.

Mixed Stacked bars

The columns with the same value for the stack property will be stacked together.

Horizontal

Set the horizontal property to true to display the bars horizontally. You can also use the horizontalRangeSlider property to display a range slider to filter the data.

Split data

Use the splitBy property to split the data into different groups.

Formatting axis

The X and Y axis can be customized using the xAxis and yAxis properties.

Custom tooltip

The tooltip can be customized using the tooltip property. By default the tooltip will display the data point value in multiline format. You can change this to a single line format by setting the tooltip.type to single. You can define a title and a value formatters to customize the way these props are displayed. Alternatively, you can define a custom component to render the tooltip.

Filtering data

You can filter the data using the filters property. The filters are an array of objects that contain a field, operation, and value.

014002800420056007000

Custom ECharts options

If necessary, you can customize the chart’s option and take advantage of the additional properties offered by ECharts. In this sample, the Y axis labels are truncated when they are too long and a tooltip is shown when hovered.