Mobile › Display

BarChart

Vertical bars for a few periods, such as days or months. Tap a bar to read its value.

Installation

npx expo install plankui-mobile react-native-safe-area-context expo-haptics

Usage

import { BarChart } from "plankui-mobile";

<BarChart data={[{ label: "Mon", value: 6120 }, { label: "Tue", value: 8410 }, { label: "Wed", value: 4300 }]} />

API reference

PropTypeDefaultDescription
data{ label: string; value: number }[]One bar each; up to about 12 fit a phone.
heightnumber160Height of the bars in points.
format(n: number) => stringtoLocaleStringFormats the value shown above.
defaultSelectednumberthe lastThe bar picked at first.
accessibilityLabelstring"Bar chart"What the chart shows.