Langsung ke konten
Skillpedia
Website & UI (frontend)18k Β· #10735

lightweight-charts

Fungsinya

Skill ini membantu agent AI bekerja dengan pustaka Lightweight Charts untuk membuat dan memperbarui grafik. Skill ini untuk pengembang yang membangun grafik harga atau grafik berbasis waktu di aplikasi web.

Kapan dipakai

  • βœ“Saat Anda ingin menambahkan grafik candlestick, garis, atau histogram ke halaman web.
  • βœ“Saat Anda perlu mengalirkan data harga langsung atau historis ke grafik yang sudah ada.
  • βœ“Saat Anda ingin menambahkan penanda, tooltip, panel, atau warna ke grafik.

Link skill

https://github.com/tradingview/lightweight-charts/blob/master/.github/skills/lightweight-charts/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/tradingview/lightweight-charts/blob/master/.github/skills/lightweight-charts/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBisakah Anda menunjukkan cara menambahkan grafik candlestick dengan pembaruan harga langsung memakai Lightweight Charts?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memeriksa versi pustaka yang dipakai proyek Anda, membaca tipenya, lalu menulis kode dengan nama opsi yang benar. Agent menghindari menebak metode yang tidak ada.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Lightweight Charts skill

Works the same whether the project is a downstream npm consumer app or an upstream lightweight-charts source checkout. Detect which one you are in (below) and resolve every API name from whatever typings are locally available.

Source lookup order

Do not assume you are inside the upstream source repository.

  1. In a consumer app, inspect the installed package first:
    • node_modules/lightweight-charts/package.json for the actual version.
    • node_modules/lightweight-charts/dist/typings.d.ts for the API surface.
  2. In the upstream repo, inspect dist/typings.d.ts first, then src/ if generated output is unavailable.
  3. Use official docs/examples as supporting evidence, but local typings win when they disagree.

Verify before answering (copy-paste):

node -p "require('./node_modules/lightweight-charts/package.json').version"
rg -n "createSeriesMarkers|addSeries|IPrimitivePaneRenderer|createImageWatermark|createOptionsChart" node_modules/lightweight-charts/dist/typings.d.ts
# upstream checkout instead of a consumer app:
rg -n "createSeriesMarkers|IPrimitivePaneRenderer|createImageWatermark|createOptionsChart" dist/typings.d.ts src

If the relevant file is unavailable, say what could not be verified. Do not invent option names, methods, exports, or wrapper behavior.

If the user's code imports from lightweight_charts import ... (underscore), uses pandas/asyncio, or talks about a Python window wrapper, they are probably using the third-party Python wrapper rather than the TypeScript package. Say that clearly before giving core lightweight-charts v5 JavaScript advice.

Mental model

Eight layers, in dependency order. Most bugs come from confusing one for another:

  1. Chart β€” createChart(container, options) returns an IChartApi. One chart per container element.
  2. Series β€” added via chart.addSeries(SeriesType, options, paneIndex?). Each call returns an ISeriesApi. v5 requires importing the series type explicitly.
  3. Scales β€” chart.timeScale() (ITimeScaleApi), chart.priceScale(id) (IPriceScaleApi). Govern range, ticks, autoscale, visibility.
  4. Data model β€” arrays of { time, … } points. Time = UTCTimestamp | BusinessDay | string. UTCTimestamp is seconds, not milliseconds. Times must be unique and ascending per series.
  5. Interaction β€” chart.subscribeCrosshairMove, chart.subscribeClick, timeScale.subscribeVisibleLogicalRangeChange, etc.
  6. Layout β€” chart.panes(), chart.addPane(). Adding a series with an out-of-range paneIndex auto-creates the pane.
  7. Extension β€” pane primitives, series primitives, custom series, watermarks, custom renderers (canvas via fancy-canvas).
  8. Wrappers β€” React/Vue/Web Components/iOS/Android. Lifecycle is the wrapper's responsibility; the core library is framework-agnostic.

v5 essentials

The conventions that catch people copying older snippets:

import { createChart, CandlestickSeries, LineSeries } from 'lightweight-charts';

const chart = createChart(container, { /* ChartOptions */ });
const candles = chart.addSeries(CandlestickSeries, { /* options */ });
candles.setData([
    { time: 1700000000, open: 1, high: 2, low: 0.5, close: 1.5 },
]);

Key v5 changes versus older snippets:

  • chart.addSeries(SeriesType, options, paneIndex?) replaces addLineSeries / addCandlestickSeries / …
  • createSeriesMarkers(series, markers) replaces series.setMarkers(...). The returned primitive owns .setMarkers(...) / .markers().
  • createTextWatermark(pane, options) and createImageWatermark(pane, imageUrl, options) replace the watermark chart option.
  • Series types are tree-shaken β€” importing them is required for ESM.

If a snippet calls addLineSeries or series.setMarkers, it's v4 or older. Confirm the user's version before forwarding it.

When the task targets v5, show the v5 API directly β€” do not hedge by mixing in v4 syntax.

Triage (problem β†’ API β†’ avoid)

User asks about First check Answer with Avoid
v5 series creation package version + typings chart.addSeries(SeriesType, options) addLineSeries / addCandlestickSeries
markers createSeriesMarkers export marker primitive + required color series.setMarkers
timezone formatter need vs data semantics Intl.DateTimeFormat in formatters fake timeScale.timezone
realtime updates last-bar vs full replace series.update(point)
Pertanyaan umum

Apakah agent perlu pustaka terpasang di proyek saya?

Cara ini paling baik jika pustaka sudah terpasang, karena agent bisa membaca versi dan tipe yang tepat. Agent juga bisa memakai dokumentasi resmi bila diperlukan.

Bisakah membantu pembungkus React atau Vue?

Bisa. Skill ini mencakup opsi pembungkus untuk kerangka kerja tersebut.

Apa yang terjadi jika agent tidak bisa memastikan suatu detail?

Agent akan menyebutkan apa yang tidak bisa diperiksa, sehingga Anda tahu apa yang perlu diverifikasi sendiri.

Detail

Deskripsi asli dari pembuat

Use when working with TradingView's lightweight-charts β€” creating charts, adding series (Line/Area/Bar/Candlestick/Histogram), configuring time and price scales, streaming realtime or historical data, panes, markers, per-bar/per-point colors, tooltips, coordinate conversion, custom plugins or primitives, non-financial horizontal scales, SSR/browser loading, or React/Vue/Web Components wrappers. Covers v5 API conventions and the common time, scale, marker, plugin, and wrapper foot-guns.

repo: tradingview/lightweight-charts

Popularitas

Bintang GitHub
18k
Peringkat
#10735
Lisensi
Apache-2.0
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa