---
name: building-vela-charts
description: Builds financial charts with Vela (@luxalgo/vela) - a full chart app or a multi-chart grid with VelaWorkspace, or the bare Vela chart - fed by offline bars or a data provider (Binance, Coinbase, Hyperliquid or your own), with Pine Script indicators through @luxalgo/vela-pinets, themes, drawings and saved state. Use when adding a candlestick or trading chart to a web app, wiring market data or indicators into Vela, or debugging a Vela chart that stays empty, shows no indicator or loses its state, even if the user only asks for "a trading chart" or "a price chart".
license: Apache-2.0
title: building-vela-charts
canonical_url: https://skilld.dev/gh/luxalgo/vela/building-vela-charts
last_updated: 2026-11-12T02:47:19.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install luxalgo/vela/building-vela-charts`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/building-vela-charts`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/luxalgo/vela/building-vela-charts) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/building-vela-charts`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/building-vela-charts --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/building-vela-charts --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Building Vela charts

Install `@luxalgo/vela` (its UI kit, `@luxalgo/vela-ui`, comes with it). Vela runs in the
browser: in a server-rendered app, create the chart in client-only code.

## Pick the entry point

| Need | Use |
| --- | --- |
| A chart app: topbar, symbol search, timeframes, indicators, drawings, settings | `VelaWorkspace` from `@luxalgo/vela/workspace` with `layout: false` |
| Several synchronized charts under one chrome | `VelaWorkspace` with `layout: '2h'`, `'4'`, … |
| Only the chart surface, your own UI around it | `Vela` from `@luxalgo/vela` |

Default to `VelaWorkspace`: it is the batteries-included app, and the same options configure
a bare chart.

## A complete chart app

```ts
import { VelaWorkspace } from '@luxalgo/vela/workspace';
import { BinanceProvider } from '@luxalgo/vela/providers/binance';

const ws = new VelaWorkspace('#chart', {
    layout: false,                                       // one chart
    symbol: 'BTCUSDT',
    timeframe: '60',                                     // minutes; '4h', '1d', 'D', 'W', 'M' also parse
    live: true,                                          // stream the forming bar
    providers: { binance: () => new BinanceProvider() }, // public API, no key
    theme: 'dark',                                       // or 'light', or a createTheme(...) result
    persist: true,                                       // save layout, indicators, drawings
});
await ws.chart.ready();
```

The container needs a size: give `#chart` a height (the workspace fills it).

## The bare chart, offline

```ts
import { Vela } from '@luxalgo/vela';

// time: the bar's open time in epoch milliseconds
const bars = [{ time: 1730419200000, open: 100, high: 104, low: 99, close: 103, volume: 1200 } /* … */];
const chart = new Vela('#chart', { data: bars, timeframe: '1h', theme: 'dark', height: 480 });
await chart.ready();
```

`data` and provider fetching are exclusive: with `data`, `symbol` is ignored. To fetch instead,
set `symbol` and register a provider: `chart.data.registerProvider('binance', new BinanceProvider())`.

## Indicators

Built-in studies need nothing: `chart.addNativeIndicator('rsi')`, or the Indicators menu in
the workspace. Scripts need an engine, and **Vela ships none**. For Pine Script install
`@luxalgo/vela-pinets` and `pinets`, then:

```ts
import { VelaWorkspace } from '@luxalgo/vela/workspace';
import { PineWorkerEngine } from '@luxalgo/vela-pinets';

// workspace: one engine per chart, off the main thread
new VelaWorkspace('#chart', { /* … */ engines: { pine: () => new PineWorkerEngine() } });

// bare chart
chart.registerEngine('pine', new PineWorkerEngine());
const ema = chart.addIndicator(`//@version=5
indicator("EMA", overlay=true)
plot(ta.ema(close, 20))`);
ema.on('ready', () => console.log('computed'));
```

`addIndicator` returns its handle at once; values arrive later (`ready`). Use
`runScript(source)` when you need the computed values and a clean failure instead.

## Rules that prevent the common bugs

1. **An empty chart** usually means no provider serves the symbol (the load waits, the
   `data:unresolved` event fires), the provider refuses that timeframe for the symbol
   (`data:unavailable` fires with its `finest` timeframe), or the container has no height.
2. **A script that never shows** means no engine is registered for its language.
3. **Read state through the chart, not from your copies.** `chart.market` is the current
   market; switch it in place with `chart.setMarket({ symbol, timeframe })` (indicators and
   drawings survive), and listen to `market:changed`.
4. **Do not remove the bottom-left Vela mark** unless the page shows an equivalent visible
   attribution ("Vela" linking to the project): the license requires one.
   `chart.renderer.set('attribution', false)` turns it off.
5. **Tear down** with `ws.destroy()` or `chart.destroy()`; call `chart.resize()` after the
   container changes size without a window resize.
6. **Themes**: `createTheme`, `checkTheme` and `registerTheme` come from `@luxalgo/vela`, the
   `css` tag for part restyles from `@luxalgo/vela/ui`; the `theming-vela-ui` skill (shipped
   with `@luxalgo/vela-ui`) covers restyling in depth.

## Check your work

1. `await ws.chart.ready()` (or `chart.ready()`) resolves, and candles are visible.
2. `chart.inspect()` lists the series and drawings the chart generated, a check that does not
   depend on pixels.
3. For indicators, the handle's `ready` event fires and its legend row appears.

## Further reading

The docs ship with the package, matching the installed version:

- `node_modules/@luxalgo/vela/docs/user/workspace.md`: layouts, cells, sync, persistence,
  composing the topbar and the sidebar.
- `node_modules/@luxalgo/vela/docs/user/options.md`: every option.
- `node_modules/@luxalgo/vela/docs/user/api-reference.md`: the chart's methods, events and
  control surfaces (`renderer`, `panes`, `data`, `drawings`, `marks`, `replay`).
- Related skills: `using-vela-data-providers` (venues, symbols, writing a provider),
  `adding-vela-indicators` (built-in studies, Pine Script®, custom indicators and engines),
  `using-vela-drawing-tools` (the toolbar, drawings from code, saving them),
  `extending-vela-with-plugins` (buttons, menus, panels and chart types).
