# Chart Lab

> Build a trading chart with the real open-source Stacklatte Charts packages running live, then copy the exact code (React, Angular, React Native, TypeScript), the validated ChartConfig JSON, or a ready-made prompt for your AI assistant. https://stacklatte.com/lab

## What it does

- Every chart option is a visible control: candlestick / line / area / sparkline, theme and custom colours, SMA, EMA, Bollinger Bands, VWAP, RSI, MACD, volume, custom panels, trade markers, zoom limits, 12/24-hour time, grid, crosshair, chart size, live feed down to 100 ms, dirty and empty data, and a 50,000-candle stress test.
- **Copy code** for React / Next.js, Angular, React Native and plain TypeScript. The generated code is type-checked against the real packages.
- **ChartConfig JSON**: the same chart as a validated, closed-enum document an AI can produce without inventing props.
- **Copy prompt for your AI**: a complete prompt that states the exact settings, includes the code and the rules (use only documented props).
- **Stock list**: 24 static sparklines (`<SLChart sparkline />`) with their own copyable code and prompt.

## Install

```sh
npm install @stacklatte/chart-react        # React / Next.js
npm install @stacklatte/chart-angular      # Angular 19+
npm install @stacklatte/chart-native @shopify/react-native-skia react-native-gesture-handler   # React Native / Expo
```

## Why use it instead of building your own

https://stacklatte.com/why (markdown: https://stacklatte.com/why.md). API reference for AI agents: https://stacklatte.com/llms.txt and https://stacklatte.com/llms-full.txt.

## FAQ

### Is Stacklatte Charts free?

Yes. It is open source under the MIT licence. There are no accounts, no API keys and no telemetry, and the charts make no network requests.

### Which package do I install?

One renderer for your platform: @stacklatte/chart-react for React and Next.js, @stacklatte/chart-angular for Angular 19+, @stacklatte/chart-native for React Native and Expo (iOS and Android). Every renderer re-exports the whole engine, so you never install @stacklatte/chart-engine separately for an app. Use @stacklatte/chart-engine alone only for Node code with no UI.

### Does it work with Next.js and server-side rendering?

Yes. Render the chart from a client component ('use client'). On the server it renders only its sized container and never touches the DOM, so there are no hydration errors.

### How do I show a list of small price charts, such as a stock list?

Use the sparkline prop: <SLChart data={closesToCandles(prices)} width={120} height={36} sparkline />. It draws the whole dataset as a smooth area, with no axes, crosshair or panels, and it does not capture touch, wheel or pointer events, so the page still scrolls. closesToCandles turns a plain array of closing prices into chart data.

### Does it support live streaming data?

Yes. Pass a new data array on every tick: replace the last candle while its interval is open, append when it rolls over. Increment scrollToLatestTrigger to jump to the newest candle. Updates repaint on the next animation frame.

### How fast is it?

60 fps (p95 frame about 17 to 18 ms) with 50,000 candles and EMA, Bollinger Bands, volume, RSI, MACD and the crosshair all on, measured in headless Chromium by the project's test suite, for React and Angular. The 50,000-candle scenario is also run on an iOS simulator.

Report a bug: bugs@stacklatte.com or https://github.com/Asterix19/charts/issues
