# Candlestick chart

Prices for a finance answer: rounded candles in soft up and down tones, volume as tints, a crosshair with a tooltip card, events on their day, and line or OHLC views.

Also called: stock chart, ohlc chart, trading chart.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Candlestick chart. Three months of a ticker with the earnings jump and the price cut marked. Point at a day for its numbers. Preview: https://chatcn.dev/preview/candlestick-chart-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/candlestick-chart
```

## Usage

```tsx
import { CandlestickChart } from "@/components/ui/chatcn/pro/candlestick-chart"

<CandlestickChart
  symbol="NWND"
  candles={[{ t: "2026-03-18", open: 52.48, high: 53.25, low: 51.62, close: 53.1, volume: 1900000 }, …]}
  events={[{ t: "2026-02-05", label: "Q4 earnings beat" }]}
  ranges={[["1M", 21], ["3M", 63], ["6M", 126]]}
  defaultRange="3M"
/>

<CandlestickChart variant="line" symbol="H100" candles={candles} />  // an area of closes
<CandlestickChart variant="ohlc" symbol="H100" candles={candles} />  // open and close ticks
```

One candle a day with a rounded body and a thin wick: a hollow green tint when it closed up, filled soft red when it closed down, and volume underneath as quiet tints of the same tones. The axis sits on the end side as in trading apps with the last price tagged on it and a dashed line across, and the headline is the last close with the change over the range. Point at a day, or move with the arrow keys, and the other days step back while a crosshair follows, tagging the close on the price axis and the day on the time axis, with a tooltip card of open, high, low, close, the change against the close before, the volume and any event; on phones the readout line carries the same numbers. Events such as a model launch sit on their day as small blue marks and are named in the readout, so an answer can point at why the price moved. `variant="line"` draws the closes as a line over a gradient in the range's direction, and `variant="ohlc"` draws a wick with an open tick to the start and a close tick to the end. The table button lists every day.

## Examples

### States

Example: States. One month in a narrow frame, loading, and a failed load. Preview: https://chatcn.dev/preview/candlestick-chart-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `symbol` | `string` | Ticker or name |
| `candles` | `Candle[]` | `{ t, open, high, low, close, volume? }`, oldest first |
| `events` | `CandleEvent[]` | `{ t, label }` |
| `ranges`, `defaultRange` | `[label, days][]` | Trading days per range |
| `variant` | `"candles" | "ohlc" | "line"` | Default `candles`. `ohlc` draws ticks, `line` an area of closes |
| `headline` | `ReactNode` | Default: the last close and the change. `null` hides it |
| `currency`, `locale` |  | Formatting |
| `height` | `number` | Default 300, volume included |
| `loading`, `error`, `onRetry` |  |  |
| `labels` | `Partial<CandlestickChartLabels>` | Every string, for translation |

## Keyboard

| Key | Action |
| --- | --- |
| Tab | Focus the chart |
| Arrow left, right | Previous or next day |
| Home, End | First or last day |

## Accessibility

- The chart is summarized in words with the range and the change, with a table of every day.
- Up and down are told by fill as well as color: up candles are hollow; OHLC bars tell them by which side the close tick sits higher.
- The readout says the pointed or focused day in words, including any event on it.

## Motion

Candles grow from their middle once over 640 ms, volume rises from the floor and the line draws in from the start. Pointing fades the other days over 150 ms. Under reduced motion they appear drawn.

Source: https://chatcn.dev/docs/components/candlestick-chart