chartjs-plugin-streaming-react 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017-2021 Akihiko Kusanagi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ <p align="center">
2
+ <img src="docs/.vuepress/public/logo.svg" style="width: 300px;">
3
+ </p>
4
+
5
+ # chartjs-plugin-streaming
6
+
7
+ [![npm](https://img.shields.io/npm/v/chartjs-plugin-streaming.svg?style=flat-square)](https://npmjs.com/package/chartjs-plugin-streaming) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/nagix/chartjs-plugin-streaming/CI?style=flat-square)](https://github.com/nagix/chartjs-plugin-streaming/actions?query=workflow%3ACI+branch%3Amaster) [![Code Climate](https://img.shields.io/codeclimate/maintainability/nagix/chartjs-plugin-streaming.svg?style=flat-square)](https://codeclimate.com/github/nagix/chartjs-plugin-streaming) [![Awesome](https://awesome.re/badge-flat2.svg)](https://github.com/chartjs/awesome)
8
+
9
+ *[Chart.js](https://www.chartjs.org) plugin for live streaming data*
10
+
11
+ chartjs-plugin-streaming 2.x requires Chart.js 3.0.0 or later. If you need Chart.js 2.x support, use the following versions.
12
+
13
+ - For Chart.js 2.9.x, 2.8.x or 2.7.x, use [version 1.9.0](https://github.com/nagix/chartjs-plugin-streaming/releases/tag/v1.9.0) ([tutorials](https://nagix.github.io/chartjs-plugin-streaming/1.9.0/) and [samples](https://nagix.github.io/chartjs-plugin-streaming/1.9.0/samples/))
14
+ - For Chart.js 2.6.x, use [version 1.2.0](https://github.com/nagix/chartjs-plugin-streaming/releases/tag/v1.2.0)
15
+
16
+ ## Documentation
17
+
18
+ - [Introduction](https://nagix.github.io/chartjs-plugin-streaming/master/guide/)
19
+ - [Getting Started](https://nagix.github.io/chartjs-plugin-streaming/master/guide/getting-started.html)
20
+ - [Options](https://nagix.github.io/chartjs-plugin-streaming/master/guide/options.html)
21
+ - [Data Feed Models](https://nagix.github.io/chartjs-plugin-streaming/master/guide/data-feed-models.html)
22
+ - [Integration](https://nagix.github.io/chartjs-plugin-streaming/master/guide/integration.html)
23
+ - [Performance](https://nagix.github.io/chartjs-plugin-streaming/master/guide/performance.html)
24
+ - [Migration](https://nagix.github.io/chartjs-plugin-streaming/master/guide/migration.html)
25
+ - [Tutorials](https://nagix.github.io/chartjs-plugin-streaming/master/tutorials/)
26
+ - [Samples](https://nagix.github.io/chartjs-plugin-streaming/master/samples/)
27
+
28
+ ## Development
29
+
30
+ You first need to install node dependencies (requires [Node.js](https://nodejs.org/)):
31
+
32
+ ```bash
33
+ npm install
34
+ ```
35
+
36
+ The following commands will then be available from the repository root:
37
+
38
+ ```bash
39
+ npm run build # build dist files
40
+ npm run build:dev # build and watch for changes
41
+ npm run lint # perform code linting
42
+ npm run package # create an archive with dist files
43
+ npm run docs # generate documentation (`dist/docs`)
44
+ npm run docs:dev # generate documentation and watch for changes
45
+ ```
46
+
47
+ ## License
48
+
49
+ chartjs-plugin-streaming is available under the [MIT license](https://opensource.org/licenses/MIT).
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "chartjs-plugin-streaming-react",
3
+ "homepage": "https://github.com/NotPunchnox/chartjs-plugin-streaming-react",
4
+ "description": "Chart.js plugin for live streaming data",
5
+ "author": "punchnox <punchnoxpro@gmail.com>",
6
+ "version": "2.0.1",
7
+ "license": "MIT",
8
+ "jsdelivr": "dist/chartjs-plugin-streaming.min.js",
9
+ "unpkg": "dist/chartjs-plugin-streaming.min.js",
10
+ "main": "dist/chartjs-plugin-streaming.js",
11
+ "module": "dist/chartjs-plugin-streaming.esm.js",
12
+ "types": "types/index.d.ts",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/NotPunchnox/chartjs-plugin-streaming-react.git"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/NotPunchnox/chartjs-plugin-streaming-react/issues"
19
+ },
20
+ "keywords": [
21
+ "chart.js",
22
+ "plugin",
23
+ "live",
24
+ "streaming",
25
+ "scroll"
26
+ ],
27
+ "files": [
28
+ "bower.json",
29
+ "dist/*.js",
30
+ "types/*.d.ts"
31
+ ],
32
+ "directories": {
33
+ "doc": "docs",
34
+ "test": "test"
35
+ },
36
+ "scripts": {
37
+ "bower": "node scripts/create-bower-json",
38
+ "build": "rollup -c",
39
+ "build:dev": "rollup -c --watch",
40
+ "docs": "npm run build && vuepress build docs --no-cache",
41
+ "docs:dev": "npm run build && vuepress dev docs --no-cache",
42
+ "lint-js": "eslint \"**/*.js\"",
43
+ "lint-md": "eslint \"**/*.md\"",
44
+ "lint-types": "eslint \"types/**/*.ts\"",
45
+ "lint": "concurrently \"npm:lint-*\"",
46
+ "package": "npm run build && node scripts/create-packages"
47
+ },
48
+ "devDependencies": {
49
+ "@rollup/plugin-json": "^4.1.0",
50
+ "@rollup/plugin-node-resolve": "^13.0.0",
51
+ "@simonbrunel/vuepress-plugin-versions": "^0.2.0",
52
+ "@typescript-eslint/eslint-plugin": "^4.27.0",
53
+ "@typescript-eslint/parser": "^4.27.0",
54
+ "@vuepress/plugin-google-analytics": "1.8.2",
55
+ "@vuepress/plugin-html-redirect": "^0.1.4",
56
+ "archiver": "^5.3.0",
57
+ "chart.js": "^3.3.2",
58
+ "chartjs-adapter-luxon": "^1.0.0",
59
+ "chartjs-plugin-annotation": "^1.0.2",
60
+ "chartjs-plugin-datalabels": "^2.0.0-rc.1",
61
+ "chartjs-plugin-zoom": "^1.0.1",
62
+ "concurrently": "^6.2.0",
63
+ "eslint": "^7.29.0",
64
+ "eslint-config-chartjs": "^0.3.0",
65
+ "eslint-plugin-es": "^4.1.0",
66
+ "eslint-plugin-html": "^6.1.2",
67
+ "eslint-plugin-markdown": "^2.2.0",
68
+ "luxon": "^1.27.0",
69
+ "ng-hammerjs": "^2.0.8",
70
+ "rollup": "^2.52.1",
71
+ "rollup-plugin-analyzer": "^4.0.0",
72
+ "rollup-plugin-cleanup": "^3.2.1",
73
+ "rollup-plugin-terser": "^7.0.2",
74
+ "typescript": "^4.3.4",
75
+ "vuepress": "^1.8.2",
76
+ "vuepress-plugin-flexsearch": "^0.2.0",
77
+ "vuepress-plugin-redirect": "^1.2.5",
78
+ "vuepress-theme-chartjs": "^0.2.0"
79
+ },
80
+ "peerDependencies": {
81
+ "chart.js": "^3.0.0"
82
+ }
83
+ }
@@ -0,0 +1,48 @@
1
+ import { Chart, ChartComponent, ChartType, TimeScale, TimeScaleOptions, Plugin } from 'chart.js';
2
+
3
+ interface Options {
4
+ duration?: number;
5
+ delay?: number;
6
+ frameRate?: number;
7
+ refresh?: number;
8
+ onRefresh?: (this: RealTimeScale, chart: Chart) => void | null;
9
+ pause?: boolean;
10
+ ttl?: number;
11
+ }
12
+
13
+ export type RealTimeScaleOptions = TimeScaleOptions & {
14
+ realtime: Options;
15
+ }
16
+
17
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
18
+ export interface RealTimeScale<O extends RealTimeScaleOptions = RealTimeScaleOptions> extends TimeScale<O> {}
19
+
20
+ export const RealTimeScale: ChartComponent & {
21
+ prototype: RealTimeScale;
22
+ new <O extends RealTimeScaleOptions = RealTimeScaleOptions>(cfg: Record<string, unknown>): RealTimeScale<O>;
23
+ };
24
+
25
+ declare module 'chart.js' {
26
+ interface CartesianScaleTypeRegistry {
27
+ realtime: {
28
+ options: RealTimeScaleOptions;
29
+ }
30
+ }
31
+
32
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
+ interface PluginOptionsByType<TType extends ChartType> {
34
+ /**
35
+ * Per chart streaming plugin options.
36
+ */
37
+ streaming?: Options;
38
+ }
39
+
40
+ enum UpdateModeEnum {
41
+ quiet = 'quiet'
42
+ }
43
+ }
44
+
45
+ declare const registerables: ChartComponent[];
46
+
47
+ export const StreamingPlugin: Plugin;
48
+ export default registerables;