# BarChart

**📖 Live documentation:** https://cds.coinbase.com/components/charts/BarChart/?platform=mobile

A bar chart component for comparing values across categories. Supports horizontal and vertical orientations, stacked bars, and grouped series.

## Import

```tsx
import { BarChart } from '@coinbase/cds-mobile/visualizations/chart'
```

## Examples

BarChart is a wrapper for [CartesianChart](/components/charts/CartesianChart) for comparing discrete categories, with a default value-axis minimum that follows the baseline (`0` when baseline is not set). Charts are built using `@shopify/react-native-skia`.

### Basics

Bar charts are a useful component for comparing discrete categories of data.
They are helpful for highlighting trends to users or allowing them to compare proportions at a glance.

To start, pass in a series of data to the chart.

```jsx
<BarChart
  height={150}
  inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
  series={[
    {
      id: 'prices',
      data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
    },
  ]}
  showYAxis
  yAxis={{
    showGrid: true,
  }}
/>
```

#### Layout

You can set `layout` to `horizontal` to render the chart horizontally.

```jsx
function HorizontalBars() {
  const dataset = [
    { month: 'Jan', seoul: 21 },
    { month: 'Feb', seoul: 28 },
    { month: 'Mar', seoul: 41 },
    { month: 'Apr', seoul: 73 },
    { month: 'May', seoul: 99 },
    { month: 'June', seoul: 144 },
    { month: 'July', seoul: 319 },
    { month: 'Aug', seoul: 249 },
    { month: 'Sept', seoul: 131 },
    { month: 'Oct', seoul: 55 },
    { month: 'Nov', seoul: 48 },
    { month: 'Dec', seoul: 25 },
  ];

  return (
    <BarChart
      height={400}
      layout="horizontal"
      series={[
        {
          id: 'seoul',
          label: 'Seoul rainfall',
          data: dataset.map((d) => d.seoul),
          color: 'var(--color-accentBoldBlue)',
        },
      ]}
      showXAxis
      showYAxis
      xAxis={{
        label: 'rainfall (mm)',
        showGrid: true,
      }}
      yAxis={{
        position: 'left',
        data: dataset.map((d) => d.month),
      }}
    />
  );
}
```

### Multiple Series

You can also provide multiple series of data to the chart. Series will have their bars for each data point rendered side by side.

```tsx
function MultipleSeries() {
  const theme = useTheme();

  return (
    <BarChart
      height={400}
      series={[
        {
          id: 'series1',
          data: [5, 1, 3],
          color: `rgb(${theme.spectrum.blue40})`,
          label: 'Series 1',
        },
        {
          id: 'series2',
          data: [2, 4, 6],
          color: `rgb(${theme.spectrum.yellow40})`,
          label: 'Series 2',
        },
        {
          id: 'series3',
          data: [1, 2, 3],
          color: `rgb(${theme.spectrum.red40})`,
          label: 'Series 3',
        },
      ]}
      legend
      showXAxis
      showYAxis
      xAxis={{
        data: ['Group A', 'Group B', 'Group C'],
        showLine: true,
        showTickMarks: true,
      }}
      yAxis={{
        showLine: true,
        showGrid: true,
        showTickMarks: true,
      }}
    />
  );
}
```

### Series Stacking

You can also configure stacking for your chart using the `stacked` prop.

```tsx
function StackedBars() {
  const theme = useTheme();

  return (
    <BarChart
      stacked
      height={400}
      series={[
        {
          id: 'series1',
          data: [5, 1, 3, 3, 0, 2, 1],
          color: `rgb(${theme.spectrum.blue40})`,
          label: 'Series 1',
        },
        {
          id: 'series2',
          data: [2, 4, 6, 0, 3, 1, 2],
          color: `rgb(${theme.spectrum.yellow40})`,
          label: 'Series 2',
        },
        {
          id: 'series3',
          data: [1, 2, 3, 1, 0, 2, 3],
          color: `rgb(${theme.spectrum.red40})`,
          label: 'Series 3',
        },
      ]}
      legend
      showXAxis
      showYAxis
      xAxis={{
        data: ['Group A', 'Group B', 'Group C', 'Group D', 'Group E', 'Group F', 'Group G'],
        showLine: true,
        showTickMarks: true,
      }}
      yAxis={{
        showLine: true,
        showGrid: true,
        showTickMarks: true,
      }}
    />
  );
}
```

You can also configure multiple stacks by setting the `stackId` prop on each series.

```tsx
function MonthlyGainsMultipleStacks() {
  const theme = useTheme();

  return (
    <BarChart
      height={400}
      series={[
        {
          id: 'series1',
          data: [5, 1, 3],
          color: `rgb(${theme.spectrum.blue40})`,
          stackId: 'stack1',
        },
        {
          id: 'series2',
          data: [2, 4, 6],
          color: `rgb(${theme.spectrum.yellow40})`,
          stackId: 'stack1',
        },
        {
          id: 'series3',
          data: [1, 2, 3],
          color: `rgb(${theme.spectrum.red40})`,
          stackId: 'stack1',
        },
        {
          id: 'series4',
          data: [3, 0, 2],
          color: `rgb(${theme.spectrum.purple40})`,
          stackId: 'stack2',
        },
        {
          id: 'series5',
          data: [0, 3, 1],
          color: `rgb(${theme.spectrum.teal40})`,
          stackId: 'stack2',
        },
        {
          id: 'series6',
          data: [1, 0, 2],
          color: `rgb(${theme.spectrum.green40})`,
          stackId: 'stack2',
        },
      ]}
      showXAxis
      showYAxis
      xAxis={{
        data: ['Group A', 'Group B', 'Group C'],
        showLine: true,
        showTickMarks: true,
      }}
      yAxis={{
        showLine: true,
        showGrid: true,
        showTickMarks: true,
      }}
    />
  );
}
```

#### Stack Gap

```tsx
function StackGap() {
  const theme = useTheme();

  return (
    <BarChart
      height={400}
      series={[
        {
          id: 'series1',
          data: [5, 1, 3],
          color: `rgb(${theme.spectrum.blue40})`,
          stackId: 'stack1',
        },
        {
          id: 'series2',
          data: [2, 4, 6],
          color: `rgb(${theme.spectrum.yellow40})`,
          stackId: 'stack1',
        },
        {
          id: 'series3',
          data: [1, 2, 3],
          color: `rgb(${theme.spectrum.red40})`,
          stackId: 'stack1',
        },
        {
          id: 'series4',
          data: [3, 0, 2],
          color: `rgb(${theme.spectrum.purple40})`,
          stackId: 'stack2',
        },
        {
          id: 'series5',
          data: [0, 3, 1],
          color: `rgb(${theme.spectrum.teal40})`,
          stackId: 'stack2',
        },
        {
          id: 'series6',
          data: [1, 0, 2],
          color: `rgb(${theme.spectrum.green40})`,
          stackId: 'stack2',
        },
      ]}
      stackGap={4}
      barMinSize={8}
      showXAxis
      showYAxis
      xAxis={{
        data: ['Group A', 'Group B', 'Group C'],
        showLine: true,
        showTickMarks: true,
      }}
      yAxis={{
        showLine: true,
        showGrid: true,
        showTickMarks: true,
      }}
    />
  );
}
```

### Border Radius

Bars have a default borderRadius of `4`. You can change this by setting the `borderRadius` prop on the chart.

Stacks will only round the top corners of touching bars.

```jsx
function RoundedStacks() {
  const theme = useTheme();

  return (
    <BarChart
      stacked
      borderRadius={1000}
      height={300}
      maxWidth={384}
      padding={0}
      series={[
        {
          id: 'purple',
          data: [null, 6, 8, 10, 7, 6, 6, 8, 9, 12, 10, 4],
          color: `rgb(${theme.spectrum.purple30})`,
        },
        {
          id: 'blue',
          data: [null, 10, 12, 11, 10, 9, 10, 11, 7, 4, 12, 18],
          color: `rgb(${theme.spectrum.blue30})`,
        },
        {
          id: 'cyan',
          data: [null, 7, 10, 12, 11, 10, 8, 11, 5, 12, 2, 9],
          color: `rgb(${theme.spectrum.teal30})`,
        },
        {
          id: 'green',
          data: [10, null, null, null, 1, null, null, 6, null, null, null, null],
          color: `rgb(${theme.spectrum.green30})`,
        },
      ]}
      showXAxis
      xAxis={{
        data: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
        tickLabelFormatter: (value) => {
          if (value === 'D') {
            return <TSpan style={{ fontWeight: 'bold' }}>{value}</TSpan>;
          }
          return value;
        },
        categoryPadding: 0.25,
      }}
      style={{ margin: '0 auto' }}
    />
  );
}
```

#### Round Baseline

You can also round the baseline of the bars by setting the `roundBaseline` prop on the chart.

```jsx
function MonthlyRewards() {
  const theme = useTheme();
  const months = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];

  return (
    <BarChart
      roundBaseline
      stacked
      borderRadius={1000}
      height={300}
      maxWidth={384}
      inset={0}
      series={[
        {
          id: 'purple',
          data: [null, 6, 8, 10, 7, 6, 6, 8, 9, 12, 10, 4],
          color: `rgb(${theme.spectrum.purple30})`,
        },
        {
          id: 'blue',
          data: [null, 10, 12, 11, 10, 9, 10, 11, 7, 4, 12, 18],
          color: `rgb(${theme.spectrum.blue30})`,
        },
        {
          id: 'cyan',
          data: [null, 7, 10, 12, 11, 10, 8, 11, 5, 12, 2, 9],
          color: `rgb(${theme.spectrum.teal30})`,
        },
        {
          id: 'green',
          data: [10, null, null, null, 1, null, null, 6, null, null, null, null],
          color: `rgb(${theme.spectrum.green30})`,
        },
      ]}
      showXAxis
      xAxis={{
        data: months,
        tickLabelFormatter: (value) => {
          if (value === 11) {
            return <TSpan style={{ fontWeight: 'bold' }}>{months[value]}</TSpan>;
          }
          return months[value];
        },
        categoryPadding: 0.25,
      }}
      stackMinSize={24}
      style={{ margin: '0 auto' }}
    />
  );
}
```

### Data

#### Negative

```tsx
function PositiveAndNegativeCashFlow() {
  const ThinSolidLine = memo((props: SolidLineProps) => <SolidLine {...props} strokeWidth={1} />);

  const categories = Array.from({ length: 31 }, (_, i) => `3/${i + 1}`);
  const gains = [
    5, 0, 6, 18, 0, 5, 12, 0, 12, 22, 28, 18, 0, 12, 6, 0, 0, 24, 0, 0, 4, 0, 18, 0, 0, 14, 10, 16,
    0, 0, 0,
  ];

  const losses = [
    -4, 0, -8, -12, -6, 0, 0, 0, -18, 0, -12, 0, -9, -6, 0, 0, 0, 0, -22, -8, 0, 0, -10, -14, 0, 0,
    0, 0, 0, -12, -10,
  ];
  const series = [
    { id: 'gains', data: gains, color: 'var(--color-fgPositive)' },
    { id: 'losses', data: losses, color: 'var(--color-fgNegative)' },
  ];

  return (
    <BarChart
      height={150}
      inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
      series={series}
      xAxis={{ data: categories }}
      stacked
      showXAxis
      showYAxis
      yAxis={{
        showGrid: true,
        GridLineComponent: ThinSolidLine,
        tickLabelFormatter: (value) => `$${value}M`,
      }}
    />
  );
}
```

#### Null

You can pass in `null` or `0` values to not render a bar for that data point.

```jsx
<BarChart
  showXAxis
  showYAxis
  height={150}
  inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
  series={[
    {
      id: 'weekly-data',
      data: [45, null, 38, 0, 19, null, 32],
    },
  ]}
  xAxis={{
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    showTickMarks: true,
    showLine: true,
  }}
  yAxis={{
    requestedTickCount: 5,
    tickLabelFormatter: (value) => `$${value}k`,
    showGrid: true,
    showTickMarks: true,
    showLine: true,
    tickMarkSize: 1.5,
    domain: { max: 50 },
  }}
/>
```

You can also use the `BarStackComponent` prop to render an empty circle for zero values.

```tsx
function MonthlyRewards() {
  const theme = useTheme();
  const months = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];
  const currentMonth = 7;
  const purple = [null, 6, 8, 10, 7, 6, 6, 8, null, null, null, null];
  const blue = [null, 10, 12, 11, 10, 9, 10, 11, null, null, null, null];
  const cyan = [null, 7, 10, 12, 11, 10, 8, 11, null, null, null, null];
  const green = [10, null, null, null, 1, null, null, 6, null, null, null, null];

  const series = [
    { id: 'purple', data: purple, color: `rgb(${theme.spectrum.purple30})` },
    { id: 'blue', data: blue, color: `rgb(${theme.spectrum.blue30})` },
    { id: 'cyan', data: cyan, color: `rgb(${theme.spectrum.teal30})` },
    { id: 'green', data: green, color: `rgb(${theme.spectrum.green30})` },
  ];

  const CustomBarStackComponent = ({ children, ...props }: BarStackComponentProps) => {
    if (props.height === 0) {
      const diameter = props.width;
      return (
        <Bar
          roundBottom
          roundTop
          borderRadius={1000}
          fill="var(--color-bgTertiary)"
          height={diameter}
          width={diameter}
          x={props.x}
          y={props.y - diameter}
        />
      );
    }

    return <DefaultBarStack {...props}>{children}</DefaultBarStack>;
  };

  return (
    <BarChart
      roundBaseline
      showXAxis
      stacked
      BarStackComponent={CustomBarStackComponent}
      borderRadius={1000}
      height={300}
      inset={0}
      series={series}
      showYAxis={false}
      stackMinSize={3}
      width={384}
      xAxis={{
        tickLabelFormatter: (index) => {
          if (index == currentMonth) {
            return <TSpan style={{ fontWeight: 'bold' }}>{months[index]}</TSpan>;
          }
          return months[index];
        },
        categoryPadding: 0.25,
      }}
    />
  );
}
```

#### Range

You can pass in `[min, max]` tuples as data points to render bars that span a range of values.

```tsx
function PriceRange() {
  const candles = btcCandles.slice(0, 180).reverse();
  const data = candles.map((candle) => [parseFloat(candle.low), parseFloat(candle.high)]);

  const min = Math.min(...data.map(([low]) => low));
  const max = Math.max(...data.map(([, high]) => high));

  const tickFormatter = useCallback(
    (value: number) =>
      new Intl.NumberFormat('en-US', {
        style: 'currency',
        currency: 'USD',
        notation: 'compact',
        maximumFractionDigits: 0,
      }).format(value),
    [],
  );

  return (
    <BarChart
      series={[{ id: 'prices', data, color: assets.btc.color }]}
      showYAxis
      yAxis={{ domain: { min, max }, showGrid: true, tickLabelFormatter: tickFormatter }}
      height={150}
    />
  );
}
```

### Customization

#### Bar Spacing

There are two ways to control the spacing between bars. You can set the `barPadding` prop to control the spacing between bars within a series. You can also set the `categoryPadding` prop to control the spacing between stacks of bars.

```jsx
<BarChart
  height={150}
  inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
  series={[
    {
      id: 'pageViews',
      data: [24, 13, 98, 39, 48, 38, 43],
      color: 'var(--color-fgPositive)',
    },
    {
      id: 'uniqueVisitors',
      data: [12, 15, 18, 21, 24, 27, 30],
      color: 'var(--color-fgNegative)',
    },
  ]}
  borderRadius={0}
  barPadding={0}
  showYAxis
  yAxis={{
    showGrid: true,
  }}
  xAxis={{
    categoryPadding: 0.2,
  }}
/>
```

#### Minimum Size

To better emphasize small values, you can set the `stackMinSize` or `barMinSize` prop to control the minimum size for entire stacks or individual bar.

##### Minimum Stack Size

You can set the `stackMinSize` prop to control the minimum size for entire stacks. This will only apply to stacks that have a value that is not `null` or `0`. It will proportionally scale the values of each bar in the stack to reach the minimum size.

```jsx
<BarChart
  height={150}
  inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
  series={[
    {
      id: 'pageViews',
      data: [24, 3, 98, null, 48, null, 43],
      color: 'var(--color-fgPositive)',
    },
    {
      id: 'uniqueVisitors',
      data: [12, 1, 18, null, 24, 1, 30],
      color: 'var(--color-fgNegative)',
    },
  ]}
  stackMinSize={2}
  stacked
  showYAxis
  yAxis={{
    showGrid: true,
  }}
/>
```

##### Minimum Bar Size

You can also set the `barMinSize` prop to control the minimum size for individual bars. This will only apply to bars that have a value that is not `null` or `0`.

```jsx
<BarChart
  showXAxis
  showYAxis
  height={150}
  inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
  series={[
    {
      id: 'weekly-data',
      data: [45, 52, 0, 45, null, 1, 32],
    },
  ]}
  xAxis={{
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    showTickMarks: true,
    showLine: true,
  }}
  yAxis={{
    requestedTickCount: 5,
    tickLabelFormatter: (value) => `$${value}k`,
    showGrid: true,
    showTickMarks: true,
    showLine: true,
    tickMarkSize: 1.5,
    domain: { max: 50 },
  }}
  barMinSize={4}
/>
```

#### Multiple Axes

You can render bars from separate y axes in one `BarPlot`, however they aren't able to be stacked.

```jsx
function MultipleYAxes() {
  const theme = useTheme();

  return (
    <CartesianChart
      legend
      height={150}
      inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
      legendPosition="bottom"
      series={[
        {
          id: 'revenue',
          label: 'Revenue ($)',
          data: [455, 520, 380, 455, 285, 235],
          yAxisId: 'revenue',
          color: theme.color.accentBoldYellow,
        },
        {
          id: 'profitMargin',
          label: 'Profit Margin (%)',
          data: [23, 20, 16, 38, 12, 9],
          yAxisId: 'profitMargin',
          color: theme.color.fgPositive,
        },
      ]}
      xAxis={{
        data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
        scaleType: 'band',
      }}
      yAxis={[
        {
          id: 'revenue',
          domain: { min: 0 },
        },
        {
          id: 'profitMargin',
          domain: { min: 0, max: 100 },
        },
      ]}
    >
      <XAxis showLine showTickMarks />
      <YAxis
        showGrid
        showLine
        showTickMarks
        axisId="revenue"
        position="left"
        requestedTickCount={5}
        width={60}
        tickLabelFormatter={(value) => `$${value}k`}
      />
      <YAxis
        showLine
        showTickMarks
        axisId="profitMargin"
        position="right"
        requestedTickCount={5}
        tickLabelFormatter={(value) => `${value}%`}
      />
      <BarPlot />
    </CartesianChart>
  );
}
```

When using horizontal layout, you can use multiple x axes.

```jsx
<CartesianChart
  layout="horizontal"
  legend
  height={400}
  inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
  legendPosition="bottom"
  series={[
    {
      id: 'revenue',
      label: 'Revenue ($)',
      data: [455, 520, 380, 455, 285, 235],
      xAxisId: 'revenue',
      color: 'var(--color-accentBoldYellow)',
    },
    {
      id: 'profitMargin',
      label: 'Profit Margin (%)',
      data: [23, 20, 16, 38, 12, 9],
      xAxisId: 'profitMargin',
      color: 'var(--color-fgPositive)',
    },
  ]}
  xAxis={[
    {
      id: 'revenue',
      domain: { min: 0 },
    },
    {
      id: 'profitMargin',
      domain: { min: 0, max: 100 },
    },
  ]}
  yAxis={{
    data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
    scaleType: 'band',
  }}
>
  <YAxis showLine showTickMarks position="left" />
  <XAxis
    showGrid
    showLine
    showTickMarks
    axisId="revenue"
    position="top"
    requestedTickCount={5}
    height={60}
    tickLabelFormatter={(value) => `$${value}k`}
  />
  <XAxis
    showLine
    showTickMarks
    axisId="profitMargin"
    position="bottom"
    requestedTickCount={5}
    tickLabelFormatter={(value) => `${value}%`}
  />
  <BarPlot />
</CartesianChart>
```

### Animations

You can configure chart transitions using the `transitions` prop.

```jsx
<BarChart
  {...props}
  transitions={{
    enter: { type: 'spring', stiffness: 700, damping: 80 },
    update: { type: 'spring', stiffness: 700, damping: 20 },
  }}
/>
```

Also, you can toggle animations by setting `animate` to `true` or `false`.

```jsx
<BarChart {...props} animate={false} />
```

#### Stagger Delay

You can set `staggerDelay` (in milliseconds) on bar transitions to create a cascading animation effect where bars animate sequentially from left to right. The delay is distributed across bars based on their horizontal position — the leftmost bar starts immediately, and the rightmost bar starts after the full `staggerDelay` duration.

```jsx
<BarChart
  {...props}
  transitions={{
    enter: { type: 'spring', stiffness: 700, damping: 80, staggerDelay: 250 },
  }}
/>
```

#### Delay

You can set `delay` (in milliseconds) on transitions to add a pause before the animation starts.

```jsx
<BarChart
  {...props}
  transitions={{
    enter: { type: 'spring', stiffness: 700, damping: 80, delay: 250 },
  }}
/>
```

### Accessibility

BarChart supports screen reader accessibility through `enableScrubbing` and `getScrubberAccessibilityLabel`. You do not need to add a [Scrubber](/components/charts/Scrubber) component—the chart renders invisible tap targets that screen reader users can navigate with swipe or tap.

```tsx
function AccessibleBarChart() {
  const categories = useMemo(() => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'], []);
  const values = useMemo(() => [40, 65, 55, 80, 72, 90], []);

  const getScrubberAccessibilityLabel = useCallback(
    (index: number) => `${categories[index]}: ${values[index]}`,
    [categories, values],
  );

  return (
    <BarChart
      enableScrubbing
      showXAxis
      showYAxis
      accessibilityLabel={`Bar chart with ${values.length} months. Swipe to navigate.`}
      height={180}
      inset={{ top: 16, right: 16, bottom: 0, left: 0 }}
      getScrubberAccessibilityLabel={getScrubberAccessibilityLabel}
      series={[{ id: 'bars', data: values, color: 'var(--color-accentBoldPurple)' }]}
      xAxis={{ data: categories, showGrid: true }}
      yAxis={{ domain: { min: 0 }, showGrid: true }}
    />
  );
}
```

### Composed Examples

#### Candlesticks

You can render a candlestick chart by setting the `BarComponent` prop to a custom candlestick component.

```tsx
function Candlesticks() {
  const infoTextId = useId();
  const theme = useTheme();
  const [currentIndex, setCurrentIndex] = useState<number | undefined>();
  const stockData = btcCandles.slice(0, 90).reverse();
  const min = Math.min(...stockData.map((data) => parseFloat(data.low)));

  const ThinSolidLine = memo((props: SolidLineProps) => <SolidLine {...props} strokeWidth={1} />);

  const BandwidthHighlight = memo(({ stroke }: LineComponentProps) => {
    const { getXSerializableScale, drawingArea } = useCartesianChartContext();
    const { scrubberPosition } = useScrubberContext();
    const xScale = useMemo(() => getXSerializableScale(), [getXSerializableScale]);

    const rectWidth = useMemo(() => {
      if (xScale !== undefined && xScale.type === 'band') {
        return xScale.bandwidth;
      }
      return 0;
    }, [xScale]);

    const xPos = useDerivedValue(() => {
      const position = unwrapAnimatedValue(scrubberPosition);
      const xPos =
        position !== undefined && xScale
          ? getPointOnSerializableScale(position, xScale)
          : undefined;
      return xPos !== undefined ? xPos - rectWidth / 2 : 0;
    }, [scrubberPosition, xScale]);

    const opacity = useDerivedValue(() => (xPos.value !== undefined ? 1 : 0), [xPos]);

    return (
      <Rect
        color={stroke}
        height={drawingArea.height}
        opacity={opacity}
        width={rectWidth}
        x={xPos}
        y={drawingArea.y}
      />
    );
  });

  const candlesData = stockData.map((data) => [parseFloat(data.low), parseFloat(data.high)]);

  const CandlestickBarComponent = memo<BarComponentProps>(
    ({ x, y, width, height, originY, dataX }) => {
      const { getYScale } = useCartesianChartContext();
      const yScale = getYScale();

      const wickX = x + width / 2;
      const timePeriodValue = stockData[dataX as number];

      const open = parseFloat(timePeriodValue.open);
      const close = parseFloat(timePeriodValue.close);

      const bullish = open < close;
      const color = bullish ? theme.color.fgPositive : theme.color.fgNegative;
      const openY = yScale?.(open) ?? 0;
      const closeY = yScale?.(close) ?? 0;

      const bodyHeight = Math.abs(openY - closeY);
      const bodyY = openY < closeY ? openY : closeY;

      return (
        <>
          <SkiaLine
            color={color}
            p1={{ x: wickX, y }}
            p2={{ x: wickX, y: y + height }}
            strokeWidth={1}
          />
          <Rect color={color} height={bodyHeight} width={width} x={x} y={bodyY} />
        </>
      );
    },
  );

  const formatThousandsPrice = useCallback((price: number) => {
    const formattedPrice = new Intl.NumberFormat('en-US', {
      style: 'currency',
      currency: 'USD',
      minimumFractionDigits: 0,
      maximumFractionDigits: 0,
    }).format(price / 1000);

    return `${formattedPrice}k`;
  }, []);

  const formatTime = useCallback(
    (index: number | null) => {
      if (index === null || index === undefined || index >= stockData.length) return '';
      const ts = parseInt(stockData[index].start);
      return new Date(ts * 1000).toLocaleDateString('en-US', {
        month: 'short',
        day: 'numeric',
      });
    },
    [stockData],
  );

  return (
    <VStack gap={2}>
      <Text aria-live="polite" font="headline" id={infoTextId}>
        {currentIndex !== undefined
          ? `Open: ${formatThousandsPrice(parseFloat(stockData[currentIndex].open))}, Close: ${formatThousandsPrice(parseFloat(stockData[currentIndex].close))}`
          : formatThousandsPrice(parseFloat(stockData[stockData.length - 1].close))}
      </Text>
      <CartesianChart
        enableScrubbing
        animate={false}
        aria-labelledby={infoTextId}
        borderRadius={0}
        height={150}
        inset={{ top: 8, bottom: 8, left: 0, right: 0 }}
        onScrubberPositionChange={setCurrentIndex}
        series={[
          {
            id: 'stock-prices',
            data: candlesData,
          },
        ]}
        xAxis={{ scaleType: 'band' }}
        yAxis={{ domain: { min } }}
      >
        <XAxis tickLabelFormatter={formatTime} />
        <YAxis
          showGrid
          GridLineComponent={ThinSolidLine}
          tickLabelFormatter={formatThousandsPrice}
          width={40}
        />
        <Scrubber
          hideOverlay
          LineComponent={BandwidthHighlight}
          lineStroke={theme.color.fgMuted}
          seriesIds={[]}
        />
        <BarPlot
          BarComponent={CandlestickBarComponent}
          BarStackComponent={({ children }) => <>{children}</>}
        />
      </CartesianChart>
    </VStack>
  );
}
```

#### Monthly Sunlight

You can combine custom BarPlot components and transitions to create a springy sunlight chart.

```tsx
function SunlightChartExample() {
  const theme = useTheme();
  const dayLength = 1440;

  type SunlightChartData = Array<{
    label: string;
    value: number;
  }>;

  const sunlightData: SunlightChartData = [
    { label: 'Jan', value: 598 },
    { label: 'Feb', value: 635 },
    { label: 'Mar', value: 688 },
    { label: 'Apr', value: 753 },
    { label: 'May', value: 812 },
    { label: 'Jun', value: 855 },
    { label: 'Jul', value: 861 },
    { label: 'Aug', value: 828 },
    { label: 'Sep', value: 772 },
    { label: 'Oct', value: 710 },
    { label: 'Nov', value: 648 },
    { label: 'Dec', value: 605 },
  ];

  const ThinSolidLine = memo((props: SolidLineProps) => <SolidLine {...props} strokeWidth={1} />);

  return (
    <VStack gap={2}>
      <CartesianChart
        height={300}
        series={[
          {
            id: 'sunlight',
            data: sunlightData.map(({ value }) => value),
            yAxisId: 'sunlight',
            color: `rgb(${theme.spectrum.yellow40})`,
          },
          {
            id: 'day',
            data: sunlightData.map(() => dayLength),
            yAxisId: 'day',
            color: `rgb(${theme.spectrum.blue100})`,
          },
        ]}
        xAxis={{
          scaleType: 'band',
          data: sunlightData.map(({ label }) => label),
        }}
        yAxis={[
          {
            id: 'day',
            domain: { min: 0, max: dayLength },
            domainLimit: 'strict',
          },
          {
            id: 'sunlight',
            domain: { min: 0, max: dayLength },
            domainLimit: 'strict',
          },
        ]}
      >
        <YAxis
          axisId="day"
          showGrid
          showLine
          GridLineComponent={ThinSolidLine}
          position="left"
          label="Minutes of sunlight"
        />
        <XAxis showLine />
        <BarPlot seriesIds={['day']} transitions={{ enter: null }} />
        <BarPlot
          borderRadius={0}
          seriesIds={['sunlight']}
          transitions={{
            enter: { type: 'spring', stiffness: 700, damping: 40, staggerDelay: 1000 },
          }}
        />
      </CartesianChart>
      <Text color="fgMuted" font="caption" textAlign="center">
        2026 sunlight data for the first day of each month in Atlanta, Georgia, provided by NOAA.
      </Text>
    </VStack>
  );
}
```

#### Buy vs Sell

You can combine a horizontal BarChart with a custom legend to create a buy vs sell chart.

```tsx
function BuyVsSellExample() {
  function BuyVsSellLegend({ buy, sell }: { buy: number; sell: number }) {
    return (
      <HStack gap={1} justifyContent="space-between">
        <DefaultLegendEntry
          label={
            <Text font="legal" color="fgMuted">
              {buy}% bought
            </Text>
          }
          color="var(--color-fgPositive)"
        />
        <DefaultLegendEntry
          label={
            <Text font="legal" color="fgMuted">
              {sell}% sold
            </Text>
          }
          color="var(--color-fgNegative)"
        />
      </HStack>
    );
  }

  function BuyVsSellChart({
    buy,
    sell,
    animate = false,
    borderRadius = 3,
    height = 6,
    inset = 0,
    layout = 'horizontal',
    stackGap = 4,
    xAxis,
    yAxis,
    ...props
  }: Omit<BarChartProps, 'series'> & { buy: number; sell: number }) {
    return (
      <VStack gap={1.5}>
        <BarChart
          animate={animate}
          roundBaseline
          stacked
          borderRadius={borderRadius}
          height={height}
          inset={inset}
          layout={layout}
          series={[
            {
              id: 'buy',
              data: [buy],
              color: 'var(--color-fgPositive)',
              legendShape: 'circle',
            },
            {
              id: 'sell',
              data: [sell],
              color: 'var(--color-fgNegative)',
              legendShape: 'circle',
            },
          ]}
          stackGap={stackGap}
          xAxis={{ domainLimit: 'strict', ...xAxis }}
          yAxis={{ categoryPadding: 0, ...yAxis }}
          {...props}
        />
        <BuyVsSellLegend buy={buy} sell={sell} />
      </VStack>
    );
  }

  return <BuyVsSellChart buy={76} sell={24} />;
}
```

## Props

| Prop | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `BarComponent` | `BarComponent` | No | `-` | Component to render the bar. |
| `BarStackComponent` | `BarStackComponent` | No | `DefaultBarStack` | Custom component to render the stack container. Can be used to add clip paths, outlines, or other custom styling. |
| `alignContent` | `flex-start \| flex-end \| center \| stretch \| space-between \| space-around \| space-evenly` | No | `-` | - |
| `alignItems` | `flex-start \| flex-end \| center \| stretch \| baseline` | No | `-` | - |
| `alignSelf` | `auto \| FlexAlignType` | No | `-` | - |
| `allowOverflowGestures` | `boolean` | No | `-` | Allows continuous gestures on the chart to continue outside the bounds of the chart element. |
| `animate` | `boolean` | No | `true` | Whether to animate the chart. |
| `animated` | `boolean` | No | `-` | - |
| `aspectRatio` | `string \| number` | No | `-` | - |
| `background` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | - |
| `barMinSize` | `number` | No | `-` | Minimum size for individual bars in the stack. |
| `barPadding` | `number` | No | `0.1` | Padding between bar groups (0-1). |
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
| `borderColor` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | - |
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
| `borderRadius` | `number` | No | `4` | Border radius for the bar. |
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
| `bottom` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `color` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | - |
| `columnGap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `dangerouslySetBackground` | `string` | No | `-` | - |
| `display` | `flex \| none \| contents` | No | `-` | - |
| `elevation` | `0 \| 1 \| 2` | No | `-` | Determines box shadow styles. Parent should have overflow set to visible to ensure styles are not clipped. |
| `enableScrubbing` | `boolean` | No | `-` | Enables scrubbing interactions. When true, allows scrubbing and makes scrubber components interactive. |
| `fillOpacity` | `number` | No | `-` | Fill opacity for the bar. |
| `flexBasis` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `flexDirection` | `row \| column \| row-reverse \| column-reverse` | No | `-` | - |
| `flexGrow` | `number` | No | `-` | - |
| `flexShrink` | `number` | No | `-` | - |
| `flexWrap` | `wrap \| nowrap \| wrap-reverse` | No | `-` | - |
| `font` | `inherit \| FontFamily` | No | `-` | - |
| `fontFamilies` | `string[]` | No | `-` | Default font families to use within ChartText. If not provided, will be the default for the system. |
| `fontProvider` | `SkTypefaceFontProvider` | No | `-` | Skia font provider to allow for custom fonts. If not provided, the only available fonts will be those defined by the system. |
| `fontSize` | `inherit \| FontSize` | No | `-` | - |
| `fontWeight` | `inherit \| FontWeight` | No | `-` | - |
| `gap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `getScrubberAccessibilityLabel` | `((dataIndex: number) => string)` | No | `-` | Function that returns the accessibility label for each scrubber point. Receives dataIndex for each scrubber point label. |
| `height` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `inset` | `number \| Partial<ChartInset>` | No | `-` | Inset around the entire chart (outside the axes). |
| `justifyContent` | `flex-start \| flex-end \| center \| space-between \| space-around \| space-evenly` | No | `-` | - |
| `key` | `Key \| null` | No | `-` | - |
| `layout` | `horizontal \| vertical` | No | `'vertical'` | Chart layout - describes the direction bars/areas grow. - vertical (default): Bars grow vertically. X is category axis, Y is value axis. - horizontal: Bars grow horizontally. Y is category axis, X is value axis. |
| `left` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `legend` | `null \| string \| number \| bigint \| false \| true \| ReactElement<unknown, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| Promise<AwaitedReactNode>` | No | `-` | Whether to show the legend or a custom legend element. - true renders the default Legend component - A React element renders that element as the legend - false or omitted hides the legend |
| `legendAccessibilityLabel` | `string` | No | `'Legend'` | Accessibility label for the legend group. |
| `legendPosition` | `top \| bottom \| left \| right` | No | `'bottom'` | Position of the legend relative to the chart. |
| `lineHeight` | `inherit \| LineHeight` | No | `-` | - |
| `margin` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
| `marginBottom` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
| `marginEnd` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
| `marginStart` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
| `marginTop` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
| `marginX` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
| `marginY` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
| `maxHeight` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `maxWidth` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `minHeight` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `minWidth` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerDown` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerDownCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerEnter` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerEnterCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerLeave` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerLeaveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerMove` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerMoveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerUp` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onPointerUpCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
| `onScrubberPositionChange` | `((index: number) => void) \| undefined` | No | `-` | Callback fired when the scrubber position changes. Receives the dataIndex of the scrubber or undefined when not scrubbing. |
| `opacity` | `number \| AnimatedNode` | No | `-` | - |
| `overflow` | `visible \| hidden \| scroll` | No | `-` | - |
| `padding` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `paddingBottom` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `paddingEnd` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `paddingStart` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `paddingTop` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `paddingX` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `paddingY` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
| `position` | `absolute \| relative \| static` | No | `-` | - |
| `ref` | `null \| RefObject<View \| null> \| (instance: View \| null) => void \| (() => VoidOrUndefinedOnly)` | No | `-` | Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref). |
| `right` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `roundBaseline` | `boolean` | No | `-` | Whether to round the baseline of a bar (where the value is 0). |
| `rowGap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
| `scrubberAccessibilityLabelStep` | `number` | No | `-` | Number of data points to move between screen-reader samples. |
| `series` | `BarSeries[]` | No | `-` | Configuration objects that define how to visualize the data. Each series can optionally define its own BarComponent. |
| `showXAxis` | `boolean` | No | `-` | Whether to show the X axis. |
| `showYAxis` | `boolean` | No | `-` | Whether to show the Y axis. |
| `stackGap` | `number` | No | `-` | Gap between bars in the stack. |
| `stackMinSize` | `number` | No | `-` | Minimum size for the entire stack. |
| `stacked` | `boolean` | No | `-` | Whether to stack the areas on top of each other. When true, each series builds cumulative values on top of the previous series. |
| `stroke` | `string` | No | `-` | Stroke color for the bar outline. |
| `strokeWidth` | `number` | No | `-` | Stroke width for the bar outline. |
| `style` | `((false \|  \| RegisteredStyle<ViewStyle> \| Value \| AnimatedInterpolation<string \| number> \| WithAnimatedObject<ViewStyle> \| WithAnimatedArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>> \| readonly (Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>)[]>) & ((false \|  \| RegisteredStyle<ViewStyle> \| Value \| AnimatedInterpolation<string \| number> \| WithAnimatedObject<ViewStyle> \| WithAnimatedArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>> \| readonly (Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>)[]>) & (false \|  \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>>))) \| null` | No | `-` | Custom styles for the root element. |
| `styles` | `{ root?: StyleProp<ViewStyle>; chart?: StyleProp<ViewStyle>; }` | No | `-` | Custom styles for the component. |
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID Used to locate this view in end-to-end tests. |
| `textAlign` | `left \| right \| auto \| center \| justify` | No | `-` | - |
| `textDecorationLine` | `none \| underline \| line-through \| underline line-through` | No | `-` | - |
| `textDecorationStyle` | `solid \| dotted \| dashed \| double` | No | `-` | - |
| `textTransform` | `none \| capitalize \| uppercase \| lowercase` | No | `-` | - |
| `top` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `transform` | `string \| readonly (({ scaleX: AnimatableNumericValue; } & { scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scaleY: AnimatableNumericValue; } & { scaleX?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ translateX: AnimatableNumericValue \| ${number}%; } & { scaleX?: undefined; scaleY?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ translateY: AnimatableNumericValue \| ${number}%; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ perspective: AnimatableNumericValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotate: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateX: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateY: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateZ: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scale: AnimatableNumericValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ skewX: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ skewY: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; matrix?: undefined; }) \| ({ matrix: AnimatableNumericValue[]; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; }))[]` | No | `-` | - |
| `transition` | `{ type: timing; } & TimingConfig & { delay?: number \| undefined; } \| { type: spring; } & { mass?: number \| undefined; overshootClamping?: boolean \| undefined; energyThreshold?: number \| undefined; velocity?: number \| undefined; reduceMotion?: ReduceMotion \| undefined; } & { stiffness?: number \| undefined; damping?: number \| undefined; duration?: undefined; dampingRatio?: undefined; clamp?: undefined; } & { delay?: number \| undefined; } \| { type: spring; } & { mass?: number \| undefined; overshootClamping?: boolean \| undefined; energyThreshold?: number \| undefined; velocity?: number \| undefined; reduceMotion?: ReduceMotion \| undefined; } & { stiffness?: undefined; damping?: undefined; duration?: number \| undefined; dampingRatio?: number \| undefined; clamp?: { min?: number \| undefined; max?: number \| undefined; } \| undefined; } & { delay?: number \| undefined; }` | No | `-` | Transition for updates. |
| `transitions` | `{ enter?: BarTransition \| null; enterOpacity?: BarTransition \| null \| undefined; update?: BarTransition \| null \| undefined; } \| undefined` | No | `transitions = {{ enter: { type: 'spring', stiffness: 900, damping: 120, staggerDelay: 250 }, enterOpacity: { type: 'timing', duration: 200 }, update: { type: 'spring', stiffness: 900, damping: 120 } }}` | Transition configuration for enter and update animations. |
| `userSelect` | `none \| auto \| text \| contain \| all` | No | `-` | - |
| `width` | `null \| number \| AnimatedNode \| auto \| ${number}%` | No | `-` | - |
| `xAxis` | `(Partial<CartesianAxisConfigProps> & AxisBaseProps & { GridLineComponent?: LineComponent; LineComponent?: LineComponent \| undefined; TickMarkLineComponent?: LineComponent \| undefined; tickLabelFormatter?: ((value: number) => ChartTextChildren) \| undefined; TickLabelComponent?: AxisTickLabelComponent \| undefined; } & { axisId?: string \| undefined; position?: top \| bottom \| undefined; height?: number \| undefined; }) \| undefined` | No | `-` | Configuration for x-axis. Accepts axis config and axis props. To show the axis, set showXAxis to true. |
| `yAxis` | `(Partial<CartesianAxisConfigProps> & AxisBaseProps & { GridLineComponent?: LineComponent; LineComponent?: LineComponent \| undefined; TickMarkLineComponent?: LineComponent \| undefined; tickLabelFormatter?: ((value: number) => ChartTextChildren) \| undefined; TickLabelComponent?: AxisTickLabelComponent \| undefined; } & { axisId?: string \| undefined; position?: left \| right \| undefined; width?: number \| undefined; }) \| undefined` | No | `-` | Configuration for y-axis. Accepts axis config and axis props. To show the axis, set showYAxis to true. |
| `zIndex` | `number` | No | `-` | - |


