@bitblit/ratchet-echarts 4.0.419-alpha → 4.0.421-alpha
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/lib/build/index.d.ts +1 -0
- package/lib/build/index.js +2 -0
- package/lib/build/index.js.map +1 -0
- package/lib/build/ratchet-echarts-info.d.ts +5 -0
- package/lib/build/ratchet-echarts-info.js +15 -0
- package/lib/build/ratchet-echarts-info.js.map +1 -0
- package/lib/common/echart-canvas-config.d.ts +4 -0
- package/lib/common/echart-canvas-config.js +2 -0
- package/lib/common/echart-canvas-config.js.map +1 -0
- package/lib/{types.d.ts → common/echart-ratchet.d.ts} +2 -15
- package/lib/common/echart-ratchet.js +49 -0
- package/lib/common/echart-ratchet.js.map +1 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +3 -0
- package/lib/common/index.js.map +1 -0
- package/package.json +8 -9
- package/lib/index.mjs +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ratchet-echarts-info.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/build/index.ts"],"names":[],"mappings":"AAIA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class RatchetEchartsInfo {
|
|
2
|
+
constructor() { }
|
|
3
|
+
static buildInformation() {
|
|
4
|
+
const val = {
|
|
5
|
+
version: 'LOCAL-SNAPSHOT',
|
|
6
|
+
hash: 'LOCAL-HASH',
|
|
7
|
+
branch: 'LOCAL-BRANCH',
|
|
8
|
+
tag: 'LOCAL-TAG',
|
|
9
|
+
timeBuiltISO: 'LOCAL-TIME-ISO',
|
|
10
|
+
notes: 'LOCAL-NOTES',
|
|
11
|
+
};
|
|
12
|
+
return val;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ratchet-echarts-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ratchet-echarts-info.js","sourceRoot":"","sources":["../../src/build/ratchet-echarts-info.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,kBAAkB;IAG7B,gBAAuB,CAAC;IAEjB,MAAM,CAAC,gBAAgB;QAC5B,MAAM,GAAG,GAAqB;YAC5B,OAAO,EAAE,gBAAgB;YACzB,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,cAAc;YACtB,GAAG,EAAE,WAAW;YAChB,YAAY,EAAE,gBAAgB;YAC9B,KAAK,EAAE,aAAa;SACrB,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echart-canvas-config.js","sourceRoot":"","sources":["../../src/common/echart-canvas-config.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import { BuildInformation } from '@bitblit/ratchet-common';
|
|
2
1
|
import { EChartsOption } from 'echarts';
|
|
3
2
|
import { Canvas } from 'canvas';
|
|
4
|
-
|
|
5
|
-
declare class
|
|
6
|
-
private constructor();
|
|
7
|
-
static buildInformation(): BuildInformation;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface EChartCanvasConfig {
|
|
11
|
-
width: number;
|
|
12
|
-
height: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare class EChartRatchet {
|
|
3
|
+
import { EChartCanvasConfig } from './echart-canvas-config.js';
|
|
4
|
+
export declare class EChartRatchet {
|
|
16
5
|
static renderChartUsingProvidedCanvas(opt: EChartsOption, canvas: Canvas): Promise<Buffer>;
|
|
17
6
|
static renderChart(opts: EChartsOption, config: EChartCanvasConfig): Promise<Buffer>;
|
|
18
7
|
static renderChartToPngFile(filename: string, opts: EChartsOption, config: EChartCanvasConfig): Promise<Buffer>;
|
|
19
8
|
}
|
|
20
|
-
|
|
21
|
-
export { type EChartCanvasConfig, EChartRatchet, RatchetEchartsInfo };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as echarts from 'echarts';
|
|
2
|
+
import { Canvas } from 'canvas';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
export class EChartRatchet {
|
|
5
|
+
static async renderChartUsingProvidedCanvas(opt, canvas) {
|
|
6
|
+
if (!opt) {
|
|
7
|
+
throw new Error('You must supply an opts parameter');
|
|
8
|
+
}
|
|
9
|
+
if (!canvas) {
|
|
10
|
+
throw new Error('You must supply an canvas parameter');
|
|
11
|
+
}
|
|
12
|
+
let rval = null;
|
|
13
|
+
opt.animation = false;
|
|
14
|
+
const canvasHtml = canvas;
|
|
15
|
+
const chart = echarts.init(canvasHtml);
|
|
16
|
+
chart.setOption(opt);
|
|
17
|
+
rval = canvas.toBuffer();
|
|
18
|
+
return rval;
|
|
19
|
+
}
|
|
20
|
+
static async renderChart(opts, config) {
|
|
21
|
+
if (!opts) {
|
|
22
|
+
throw new Error('You must supply an opts parameter');
|
|
23
|
+
}
|
|
24
|
+
if (!config) {
|
|
25
|
+
throw new Error('You must supply an config parameter');
|
|
26
|
+
}
|
|
27
|
+
const canvas = new Canvas(config.width, config.height);
|
|
28
|
+
const rval = await this.renderChartUsingProvidedCanvas(opts, canvas);
|
|
29
|
+
return rval;
|
|
30
|
+
}
|
|
31
|
+
static async renderChartToPngFile(filename, opts, config) {
|
|
32
|
+
if (!opts) {
|
|
33
|
+
throw new Error('You must supply an opts parameter');
|
|
34
|
+
}
|
|
35
|
+
if (!config) {
|
|
36
|
+
throw new Error('You must supply an config parameter');
|
|
37
|
+
}
|
|
38
|
+
if (!filename || filename.trim().length === 0) {
|
|
39
|
+
throw new Error('You must supply a non-empty filename parameter');
|
|
40
|
+
}
|
|
41
|
+
if (!filename.toLowerCase().endsWith('.png')) {
|
|
42
|
+
throw new Error('Your filename should end with .png - this generates a png file');
|
|
43
|
+
}
|
|
44
|
+
const rval = await this.renderChart(opts, config);
|
|
45
|
+
fs.writeFileSync(filename, rval);
|
|
46
|
+
return rval;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=echart-ratchet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echart-ratchet.js","sourceRoot":"","sources":["../../src/common/echart-ratchet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,OAAO,aAAa;IACjB,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,GAAkB,EAAE,MAAc;QACnF,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,IAAI,GAAW,IAAI,CAAC;QAExB,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;QACtB,MAAM,UAAU,GAAgB,MAAgC,CAAC;QAGjE,MAAM,KAAK,GAAY,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAmB,EAAE,MAA0B;QAC7E,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,MAAM,GAAW,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/D,MAAM,IAAI,GAAW,MAAM,IAAI,CAAC,8BAA8B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE7E,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,QAAgB,EAAE,IAAmB,EAAE,MAA0B;QACxG,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,IAAI,GAAW,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1D,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAIA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitblit/ratchet-echarts",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.421-alpha",
|
|
4
4
|
"description": "Library for using echarts on Node",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"module": "./lib/index.mjs",
|
|
7
|
-
"types": "./lib/types.d.ts",
|
|
8
6
|
"files": [
|
|
9
7
|
"lib/**",
|
|
10
8
|
"bin/**"
|
|
11
9
|
],
|
|
12
10
|
"exports": {
|
|
13
|
-
".":
|
|
14
|
-
|
|
15
|
-
"import": "./lib
|
|
11
|
+
"./package.json": "./package.json",
|
|
12
|
+
"./*": {
|
|
13
|
+
"import": "./lib/*.js",
|
|
14
|
+
"types": "./lib/*.d.ts"
|
|
16
15
|
}
|
|
17
16
|
},
|
|
18
17
|
"contributors": [
|
|
@@ -31,12 +30,12 @@
|
|
|
31
30
|
"config": {},
|
|
32
31
|
"license": "Apache-2.0",
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"@bitblit/ratchet-common": "4.0.
|
|
33
|
+
"@bitblit/ratchet-common": "4.0.421-alpha",
|
|
35
34
|
"canvas": "2.11.2",
|
|
36
|
-
"echarts": "5.5.
|
|
35
|
+
"echarts": "5.5.1"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
|
-
"@bitblit/ratchet-common": "4.0.
|
|
38
|
+
"@bitblit/ratchet-common": "4.0.421-alpha",
|
|
40
39
|
"canvas": "^2.11.2",
|
|
41
40
|
"echarts": "^5.5.0"
|
|
42
41
|
}
|
package/lib/index.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import*as r from"echarts";import{Canvas as t}from"canvas";import e from"fs";class n{constructor(){}static buildInformation(){return{version:"419",hash:"f7352c5a308ba70beca8c882dfb412b619fa6b6d",branch:"alpha-2024-07-30-4",tag:"alpha-2024-07-30-4",timeBuiltISO:"2024-07-30T23:10:17-0700",notes:"No notes"}}}class a{static async renderChartUsingProvidedCanvas(t,e){if(!t)throw new Error("You must supply an opts parameter");if(!e)throw new Error("You must supply an canvas parameter");let n=null;t.animation=!1;const a=e;return r.init(a).setOption(t),n=e.toBuffer(),n}static async renderChart(r,e){if(!r)throw new Error("You must supply an opts parameter");if(!e)throw new Error("You must supply an config parameter");const n=new t(e.width,e.height);return await this.renderChartUsingProvidedCanvas(r,n)}static async renderChartToPngFile(r,t,n){if(!t)throw new Error("You must supply an opts parameter");if(!n)throw new Error("You must supply an config parameter");if(!r||0===r.trim().length)throw new Error("You must supply a non-empty filename parameter");if(!r.toLowerCase().endsWith(".png"))throw new Error("Your filename should end with .png - this generates a png file");const a=await this.renderChart(t,n);return e.writeFileSync(r,a),a}}export{a as EChartRatchet,n as RatchetEchartsInfo};
|
|
2
|
-
//# sourceMappingURL=index.mjs.map
|