@nckrtl/chartjs-plugin-streaming
v3.0.1
Published
Chart.js v4 compatible plugin for live streaming data (fork of chartjs-plugin-streaming)
Downloads
81
Maintainers
Readme
@nckrtl/chartjs-plugin-streaming
Chart.js plugin for live streaming data
Note: This is a fork of the original chartjs-plugin-streaming updated for Chart.js v4 compatibility.
This package (@nckrtl/chartjs-plugin-streaming) v3.x requires Chart.js 4.0.0 or later. If you need support for older versions:
- For Chart.js 3.x, use version 2.0.0
- For Chart.js 2.9.x, 2.8.x or 2.7.x, use version 1.9.0 (tutorials and samples)
- For Chart.js 2.6.x, use version 1.2.0
Installation
npm install @nckrtl/chartjs-plugin-streamingUsage
ESM (ES Modules)
When using ES modules, you need to register both the plugin and the scale:
import Chart from 'chart.js/auto';
import {StreamingPlugin, RealTimeScale} from '@nckrtl/chartjs-plugin-streaming';
// IMPORTANT: Register both the plugin and the scale
Chart.register(StreamingPlugin, RealTimeScale);UMD (Script Tags)
When using script tags, the plugin automatically registers itself:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@nckrtl/[email protected]"></script>Documentation
Development
You first need to install node dependencies (requires Node.js):
npm installThe following commands will then be available from the repository root:
npm run build # build dist files
npm run build:dev # build and watch for changes
npm run lint # perform code linting
npm run package # create an archive with dist files
npm run docs # generate documentation (`dist/docs`)
npm run docs:dev # generate documentation and watch for changesLicense
chartjs-plugin-streaming is available under the MIT license.
