All components (283)
Candlestick chart
Data · CandlestickChart
What it is and when to use it
Open, high, low and close candles, for prices. A rising candle is hollow and a falling one is filled: colour is not the only thing telling them apart.
When to use it
- Prices per period: a quote, a commodity.
dataare the candles, in order:{ label, open, high, low, close }.
When not to
- A price without its range for the period:
LineChart.
Keyboard: Tab takes you to the drawing and the arrows move from candle to candle; Home and End go to the first and last. A spoken notice says the four values.
Accessibility: it is an image (role="img") with a written summary, and underneath goes a real table with the four values of each candle.
Fine-tuning: the --amset-series-* CSS variables of the other charts: -axis, -bar, -cap, -footer, -height, -label.
What it looks like
| Period | Open | High | Low | Close |
|---|---|---|---|---|
| Mon | 24 | 28 | 22 | 27 |
| Tue | 27 | 29 | 25 | 26 |
| Wed | 26 | 31 | 26 | 30 |
| Thu | 30 | 33 | 28 | 29 |
| Fri | 29 | 30 | 24 | 25 |
| Mon | 25 | 27 | 23 | 25 |
| Tue | 25 | 32 | 25 | 31 |
| Wed | 31 | 35 | 30 | 34 |
<CandlestickChart label="Silver, euros per ounce" data={velas} />Props
Import it with import { CandlestickChart } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
datarequired | readonly CandlePoint[] | The candles, in order: `{ label, open, high, low, close }`. |
labelrequired | string | What is being measured. Required: a chart without a title does not inform. |
className | string | Merged with the library classes; it does not replace them. |
error | ReactNode | The data has not arrived: it says so in the place of the drawing, with what is passed here. |
format | (value: number) => string | — |
height | number | Height of the drawing in pixels. By default, that of the size. |
loading | boolean | The data is on its way. |
size | "sm" | "md" | "lg" | — |
tableVisible | boolean | Also shows the table. For the screen reader it is always there. |
It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.
In the test bench
Every state and variant, to try one at a time, on its page at storybook.amsetui.com:
