@lobehub/charts
Version:
React modern charts components built on recharts
74 lines (44 loc) • 1.86 kB
text/mdx
---
title: BarChart
description: Bar charts compare numerical values and use the length of each bar to represent the value of each variable.
category: Charts
order: 0
---
import DemoIndex from './demos/index.tsx?demo';
import DemoExample from './demos/example.tsx?demo';
import DemoXAxisLabelFormatter from './demos/xAxisLabelFormatter.tsx?demo';
import DemoGroups from './demos/groups.tsx?demo';
import DemoClickEvent from './demos/clickEvent.tsx?demo';
import DemoCustomTooltip from './demos/customTooltip.tsx?demo';
import DemoCustomColors from './demos/customColors.tsx?demo';
import DemoAxis from './demos/axis.tsx?demo';
import DemoNoData from './demos/noData.tsx?demo';
import DemoLoading from './demos/loading.tsx?demo';
<Demo of={DemoIndex} layout="bare" />
## Usage example
The example below shows a chart composition combining a `BarChart` with text elements.
<Demo of={DemoExample} />
## Usage example with custom X axis labels
The example below shows an interacive chart using the `xAxisLabelFormatter` prop.
<Demo of={DemoXAxisLabelFormatter} />
## Usage example with groups
The example below shows a chart with a group composition.
<Demo of={DemoGroups} />
## Usage example with click event
The example below shows an interacive chart using the `onValueChange` prop.
<Demo of={DemoClickEvent} />
## Usage example with custom tooltip
The example below shows a custom tooltip using `customTooltip` prop.
<Demo of={DemoCustomTooltip} />
## Usage example with a custom colors
The example below shows a chart with custom `colors`.
<Demo of={DemoCustomColors} />
## Usage example with x-axis and y-axis labels
The example below shows added axis labels using `xAxisLabel` and `yAxisLabel` props.
<Demo of={DemoAxis} />
## No Data
<Demo of={DemoNoData} />
## Loading
<Demo of={DemoLoading} />
## API
<Api name="BarChart" />