@devexperts/dxcharts-lite

中文文档
2.7.39发布于 2026/10/08MPL 2.0TypeScriptCommonJS近 30 天下载 2.9万

DXCharts Lite

原始使用文档
文档目录10 节
  1. Overview
  2. Quick-start
  3. Installation
  4. Create chart
  5. Set data
  6. HTML-markup
  7. Configuration
  8. API
  9. Examples
  10. Demo

devexperts-logo

DXCharts Lite: Powerful financial charting tool

DXcharts Lite is a modern solution for visualizing financial data with a wide variety of chart types.
Originally developed as part of large tradings applications used by millions of users,
DXcharts Lite has matured into an independent product.
It can be used as a simple widget for blogs or as a component in enterprise trading solutions.

License: MPL 2.0   PRs: Welcome   Version


4 charts example


Overview

Get started with DXCharts Lite by installing the library and configuring it to your needs.

Quick-start

Installation

Install the library in your project:

npm install @devexperts/dxcharts-lite

Your package.json after installation:

"dependencies": {
    "@devexperts/dxcharts-lite": "1.0.0",
    ...
}

Create chart

If you use webpack or another bundler, import the createChart method and pass the element where the chart will be rendered as the first argument.

export const createChartInstance = () => {
    const container = document.getElementById('chart_container');
    const chartInstance = DXChart.createChart(container);
    return chartInstance;
};

The createChart method creates a new chart instance using ChartBootstrap class and returns it.

It accepts two parameters:

  • element: The HTML element where the chart will be rendered.
  • config (optional): An instance of ChartConfig.

Note: Set width: 100% and height: 100% for the parent container. By default, the chart auto-resizes to the parent, but you can change this by setting fixedSize in the config.

You should now see an empty chart on the screen.

Set data

To display data (e.g. Candles), you can use the bundled function to generate mock data. Import generateCandlesData and use it to generate candles.

export const generateMockData = () => {
    const candles = generateCandlesData();
    chart.setData({ candles });
};

You should now see a basic chart like the image below:

Basic chart

HTML-markup

Here is complete quick-start code example:

<html>
    <head>
        <script src="https://www.unpkg.com/@devexperts/[email protected]/dist/dxchart.min.js"></script>
        <script type="importmap">
            {
                "imports": {
                    "@devexperts/dxcharts-lite/": "https://www.unpkg.com/@devexperts/[email protected]/"
                }
            }
        </script>
    </head>
    <body>
        <div id="chart_container"></div>
    </body>
    <script type="module">
        import generateCandlesData from '@devexperts/dxcharts-lite/dist/chart/utils/candles-generator.utils';

        // create chart instance, pass parent container as 1st argument
        const container = document.getElementById('chart_container');
        const chart = DXChart.createChart(container);
        // create and set candles data
        const candles = generateCandlesData();
        chart.setData({ candles });
    </script>
</html>

Configuration

You can configure the chart using a ChartConfig object (optional).

ChartConfig sets the initial properties for the chart instance. Below is a table of available options (see documentation for details).

API

Each chart component has an API that allows you to change many parameters on the fly, modify appearance at runtime, and subscribe to various chart events (such as hovering over a candle).

Main components include:

Examples

We have created many examples with different chart configurations. You can find them here.

Demo

To demonstrate its capabilities, we've created a Demo version based on DXCharts Lite. Explore the full power of our library!

版本与发布记录

@devexperts/dxcharts-lite 共发布 67 个版本,首次发布于 2023/08/16;过去 12 个月发布了 20 个版本。

版本发布日期距今
2.7.39latest2026/10/081 个月前
2.7.382026/10/061 个月前
2.7.372026/09/221 个月前
2.7.362026/09/022 个月前
2.7.352026/08/212 个月前
2.7.342026/08/142 个月前

关于 @devexperts/dxcharts-lite 的常见问题

@devexperts/dxcharts-lite 是什么?

DXCharts Lite

如何安装 @devexperts/dxcharts-lite?

在项目目录运行 npm install @devexperts/dxcharts-lite,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:rxjs(>=6.6.7)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@devexperts/dxcharts-lite 支持 TypeScript 吗?

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

@devexperts/dxcharts-lite 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@devexperts/dxcharts-lite 可以商用吗?

@devexperts/dxcharts-lite 使用 MPL 2.0 许可。声明的许可为 MPL 2.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@devexperts/dxcharts-lite 的下载量有多少?

根据 npm 官方下载统计,@devexperts/dxcharts-lite 在 2026/10/12 – 2026/11/10 这 30 天内被下载 29,345 次,日均约 978 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@devexperts/dxcharts-lite 还在维护吗?

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