@bishopbot/lightweight-charts

中文文档
6.0.1发布于 2026/10/31Apache-2.0TypeScriptES Module

Performant financial charts built with HTML5 canvas

原始使用文档
文档目录9 节
  1. Installing
  2. es6 via npm
  3. Latest master build
  4. CDN
  5. Build variants
  6. AI coding assistants
  7. Development
  8. Publishing
  9. License
Lightweight Charts logo

Lightweight Charts™

CircleCI npm version npm bundle size Dependencies count Downloads pkg.pr.new

This is a fork. It is published under the @bishopbot npm scope, not as lightweight-charts. The upstream project by TradingView keeps the unscoped name and the @tradingview scope, and is the project to install if you need the original. See Publishing below.

Demos | Documentation | Reddit

TradingView Lightweight Charts™ are one of the smallest and fastest financial HTML5 charts.

The Lightweight Charts™ library is the best choice for you if you want to display financial data as an interactive chart on your web page, or replace static image charts with interactive ones. It does this without affecting your web page's loading speed and performance. The size of the library is close to static images but if you have dozens of image charts on a web page then using this library can make the size of your web page smaller.

The library provides a rich set of charting capabilities out of the box, but you can also extend its functionality by building custom plugins. Browse the plugin catalog for ready-made plugins, or see the interactive plugin examples and plugin-examples/README.md to build your own.

Take a look at awesome-tradingview for related projects created by our community members.

Installing

es6 via npm

npm install @bishopbot/lightweight-charts

Latest master build

To try the latest master build without waiting for a release (powered by pkg.pr.new):

npm install https://pkg.pr.new/@bishopbot/lightweight-charts@master

The import and usage below applies to both npm installation options:

import { createChart, LineSeries } from '@bishopbot/lightweight-charts';

const chart = createChart(document.body, { width: 400, height: 300 });
const lineSeries = chart.addSeries(LineSeries);
lineSeries.setData([
    { time: '2019-04-11', value: 80.01 },
    { time: '2019-04-12', value: 96.63 },
    { time: '2019-04-13', value: 76.64 },
    { time: '2019-04-14', value: 81.89 },
    { time: '2019-04-15', value: 74.43 },
    { time: '2019-04-16', value: 80.01 },
    { time: '2019-04-17', value: 96.63 },
    { time: '2019-04-18', value: 76.64 },
    { time: '2019-04-19', value: 81.89 },
    { time: '2019-04-20', value: 74.43 },
]);

CDN

You can use unpkg:

https://unpkg.com/@bishopbot/lightweight-charts/dist/lightweight-charts.standalone.production.js

The standalone version creates window.LightweightCharts object with all exports from esm version:

const chart = LightweightCharts.createChart(document.body, { width: 400, height: 300 });
const lineSeries = chart.addSeries(LightweightCharts.LineSeries);
lineSeries.setData([
    { time: '2019-04-11', value: 80.01 },
    { time: '2019-04-12', value: 96.63 },
    { time: '2019-04-13', value: 76.64 },
    { time: '2019-04-14', value: 81.89 },
    { time: '2019-04-15', value: 74.43 },
    { time: '2019-04-16', value: 80.01 },
    { time: '2019-04-17', value: 96.63 },
    { time: '2019-04-18', value: 76.64 },
    { time: '2019-04-19', value: 81.89 },
    { time: '2019-04-20', value: 74.43 },
]);

Build variants

Dependencies includedModeES moduleIIFE (window.LightweightCharts)
NoPRODlightweight-charts.production.mjsN/A
NoDEVlightweight-charts.development.mjsN/A
Yes (standalone)PRODlightweight-charts.standalone.production.mjslightweight-charts.standalone.production.js
Yes (standalone)DEVlightweight-charts.standalone.development.mjslightweight-charts.standalone.development.js

AI coding assistants

This repository ships two Agent Skills for AI coding assistants, such as Claude Code and Codex. The skills give the assistant current v5 knowledge to work from, instead of outdated snippets it may remember from training:

  • lightweight-charts is about using the library. It covers the v5 API conventions, the mental model, and common time, scale, marker, plugin, and wrapper foot-guns.
  • lightweight-charts-plugin-authoring is about writing a plugin. The skill helps choose between a custom series and a primitive, build on @bishopbot/lwc-toolkit, and learn from the official plugin packages. It also warns about the common autoscale, whitespace, and hit-test traps. The create-lwc-plugin wizard offers to install this skill into a new plugin project.

Install either or both with the skills CLI; add --skill <name> to pick one of the two:

npx skills add bishop-bot/lightweight-charts

Development

See BUILDING.md for instructions on how to build the library from source.

Publishing

The packages of this fork are published under the @bishopbot scope:

Packagenpm name
Library@bishopbot/lightweight-charts
Plugin toolkit@bishopbot/lwc-toolkit
Plugins@bishopbot/lwc-plugin-<name>
Plugin scaffolding wizard@bishopbot/create-lwc-plugin

The library's peer dependency in every plugin is @bishopbot/lightweight-charts (^6.0.0); the upstream lightweight-charts stays an optional peer, so a project that already depends on the upstream 5.x line does not have to change it. See .agents/skills/npm-publish/SKILL.md for the release flow.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License. You may obtain a copy of the License in the LICENSE file. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This software incorporates several parts of tslib (https://github.com/Microsoft/tslib, (c) Microsoft Corporation) that are covered by BSD Zero Clause License.

This license requires specifying TradingView as the product creator. You shall add the "attribution notice" from the NOTICE file and a link to https://www.tradingview.com/ to the page of your website or mobile application that is available to your users. As thanks for creating this product, we'd be grateful if you add it in a prominent place. You can use the attributionLogo chart option for displaying an appropriate link to https://www.tradingview.com/ on the chart itself, which will satisfy the link requirement.

版本与发布记录

@bishopbot/lightweight-charts 共发布 3 个版本,首次发布于 2026/10/31;过去 12 个月发布了 3 个版本。

版本发布日期距今
6.0.1latest2026/10/312 天前
6.0.02026/10/313 天前
0.0.0-stage2026/10/313 天前

关于 @bishopbot/lightweight-charts 的常见问题

@bishopbot/lightweight-charts 是什么?

使用HTML5 canvas构建的高性能财务图表

如何安装 @bishopbot/lightweight-charts?

在项目目录运行 npm install @bishopbot/lightweight-charts,或使用 pnpm add / yarn add / bun add。

@bishopbot/lightweight-charts 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bishopbot/lightweight-charts 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bishopbot/lightweight-charts 可以商用吗?

@bishopbot/lightweight-charts 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bishopbot/lightweight-charts 还在维护吗?

最新版本 6.0.1 发布于 2026/10/31(2 天前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/10/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。