Eidetic

Candlestick Chart

Charts
Trading

OHLC (Open, High, Low, Close) candlestick charts for trading and time-series data visualization.

Preview

Crypto trading chart with timeframe selection

Ethereum
ETH/USD
24h High

$3,920

24h Low

$3,850

Live Price

$3,910.72

09:0009:3010:0010:3011:0011:3012:00

Props

Component API reference

PropTypeDefaultDescription
data*CandleData[]Array of OHLC candle objects
timeframesstring[]Available timeframe options
activeTimeframestringCurrently selected timeframe
onTimeframeChange(tf: string) => voidTimeframe change handler
heightnumber256Chart height in pixels
showGridbooleantrueShow grid lines
bullColorstring'emerald-500'Color for bullish candles
bearColorstring'rose-500'Color for bearish candles

Usage

Import and implementation examples

// Define candle data (OHLC)
const candles = [
{ open: 45, close: 60, high: 70, low: 40 }, // green (bullish)
{ open: 60, close: 50, high: 65, low: 45 }, // red (bearish)
{ open: 50, close: 65, high: 75, low: 48 }, // green
]
// Render candlesticks
{candles.map((candle, i) => {
const isGreen = candle.close > candle.open
const bodyTop = Math.max(candle.open, candle.close)
const bodyBottom = Math.min(candle.open, candle.close)
const bodyHeight = bodyTop - bodyBottom
const wickTop = candle.high - bodyTop
const wickBottom = bodyBottom - candle.low
return (
<div key={i} className="flex flex-col items-center">
{/* Upper wick */}
<div style={{ height: `${wickTop}%`, backgroundColor: isGreen ? 'green' : 'red' }} />
{/* Body */}
<div style={{ height: `${bodyHeight}%`, backgroundColor: isGreen ? 'green' : 'red' }} />
{/* Lower wick */}
<div style={{ height: `${wickBottom}%`, backgroundColor: isGreen ? 'green' : 'red' }} />
</div>
)
})}

Features

Built-in functionality

  • OHLC data: Shows open, high, low, close prices per period
  • Color coding: Green for bullish, red for bearish movements
  • Timeframe selection: Switch between different time periods
  • Grid lines: Optional dashed grid for value reading
  • Hover states: Interactive candle highlighting
  • Dark mode: Full dark mode support

Accessibility

Accessibility considerations

ARIA Attributes

Chart container has role="img"aria-label describes the data rangeTimeframe tabs are keyboard navigable

Keyboard Navigation

KeyAction
TabNavigate between timeframe tabs
Enter / SpaceSelect timeframe

Notes

  • Provide data table alternative for screen readers
  • Price changes announced with direction
  • Color is supplemented with position indicators