@visactor/vgrammar-plot 0.6.0
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/README.md +3 -0
- package/README.zh-CN.md +0 -0
- package/cjs/area.d.ts +14 -0
- package/cjs/area.js +83 -0
- package/cjs/area.js.map +1 -0
- package/cjs/cell.d.ts +14 -0
- package/cjs/cell.js +51 -0
- package/cjs/cell.js.map +1 -0
- package/cjs/circle-packing.d.ts +17 -0
- package/cjs/circle-packing.js +76 -0
- package/cjs/circle-packing.js.map +1 -0
- package/cjs/enums.d.ts +24 -0
- package/cjs/enums.js +17 -0
- package/cjs/enums.js.map +1 -0
- package/cjs/image.d.ts +13 -0
- package/cjs/image.js +77 -0
- package/cjs/image.js.map +1 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +15 -0
- package/cjs/index.js.map +1 -0
- package/cjs/interval.d.ts +19 -0
- package/cjs/interval.js +102 -0
- package/cjs/interval.js.map +1 -0
- package/cjs/line.d.ts +14 -0
- package/cjs/line.js +52 -0
- package/cjs/line.js.map +1 -0
- package/cjs/path.d.ts +11 -0
- package/cjs/path.js +25 -0
- package/cjs/path.js.map +1 -0
- package/cjs/plot-all.d.ts +2 -0
- package/cjs/plot-all.js +19 -0
- package/cjs/plot-all.js.map +1 -0
- package/cjs/plot.d.ts +46 -0
- package/cjs/plot.js +265 -0
- package/cjs/plot.js.map +1 -0
- package/cjs/polygon.d.ts +12 -0
- package/cjs/polygon.js +44 -0
- package/cjs/polygon.js.map +1 -0
- package/cjs/rect-x.d.ts +13 -0
- package/cjs/rect-x.js +67 -0
- package/cjs/rect-x.js.map +1 -0
- package/cjs/rect-y.d.ts +13 -0
- package/cjs/rect-y.js +67 -0
- package/cjs/rect-y.js.map +1 -0
- package/cjs/rect.d.ts +13 -0
- package/cjs/rect.js +82 -0
- package/cjs/rect.js.map +1 -0
- package/cjs/rule-x.d.ts +12 -0
- package/cjs/rule-x.js +37 -0
- package/cjs/rule-x.js.map +1 -0
- package/cjs/rule-y.d.ts +12 -0
- package/cjs/rule-y.js +36 -0
- package/cjs/rule-y.js.map +1 -0
- package/cjs/rule.d.ts +12 -0
- package/cjs/rule.js +45 -0
- package/cjs/rule.js.map +1 -0
- package/cjs/sankey.d.ts +46 -0
- package/cjs/sankey.js +139 -0
- package/cjs/sankey.js.map +1 -0
- package/cjs/semantic-mark.d.ts +88 -0
- package/cjs/semantic-mark.js +846 -0
- package/cjs/semantic-mark.js.map +1 -0
- package/cjs/sunburst.d.ts +45 -0
- package/cjs/sunburst.js +134 -0
- package/cjs/sunburst.js.map +1 -0
- package/cjs/symbol.d.ts +13 -0
- package/cjs/symbol.js +53 -0
- package/cjs/symbol.js.map +1 -0
- package/cjs/text.d.ts +12 -0
- package/cjs/text.js +32 -0
- package/cjs/text.js.map +1 -0
- package/cjs/tree.d.ts +20 -0
- package/cjs/tree.js +128 -0
- package/cjs/tree.js.map +1 -0
- package/cjs/treemap.d.ts +41 -0
- package/cjs/treemap.js +109 -0
- package/cjs/treemap.js.map +1 -0
- package/cjs/util.d.ts +3 -0
- package/cjs/util.js +11 -0
- package/cjs/util.js.map +1 -0
- package/cjs/wordcloud-shape.d.ts +13 -0
- package/cjs/wordcloud-shape.js +85 -0
- package/cjs/wordcloud-shape.js.map +1 -0
- package/cjs/wordcloud.d.ts +13 -0
- package/cjs/wordcloud.js +81 -0
- package/cjs/wordcloud.js.map +1 -0
- package/dist/index.js +3291 -0
- package/dist/index.min.js +1 -0
- package/es/area.d.ts +14 -0
- package/es/area.js +83 -0
- package/es/area.js.map +1 -0
- package/es/cell.d.ts +14 -0
- package/es/cell.js +49 -0
- package/es/cell.js.map +1 -0
- package/es/circle-packing.d.ts +17 -0
- package/es/circle-packing.js +75 -0
- package/es/circle-packing.js.map +1 -0
- package/es/enums.d.ts +24 -0
- package/es/enums.js +13 -0
- package/es/enums.js.map +1 -0
- package/es/image.d.ts +13 -0
- package/es/image.js +74 -0
- package/es/image.js.map +1 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -0
- package/es/interval.d.ts +19 -0
- package/es/interval.js +103 -0
- package/es/interval.js.map +1 -0
- package/es/line.d.ts +14 -0
- package/es/line.js +50 -0
- package/es/line.js.map +1 -0
- package/es/path.d.ts +11 -0
- package/es/path.js +23 -0
- package/es/path.js.map +1 -0
- package/es/plot-all.d.ts +2 -0
- package/es/plot-all.js +50 -0
- package/es/plot-all.js.map +1 -0
- package/es/plot.d.ts +46 -0
- package/es/plot.js +263 -0
- package/es/plot.js.map +1 -0
- package/es/polygon.d.ts +12 -0
- package/es/polygon.js +43 -0
- package/es/polygon.js.map +1 -0
- package/es/rect-x.d.ts +13 -0
- package/es/rect-x.js +69 -0
- package/es/rect-x.js.map +1 -0
- package/es/rect-y.d.ts +13 -0
- package/es/rect-y.js +69 -0
- package/es/rect-y.js.map +1 -0
- package/es/rect.d.ts +13 -0
- package/es/rect.js +84 -0
- package/es/rect.js.map +1 -0
- package/es/rule-x.d.ts +12 -0
- package/es/rule-x.js +35 -0
- package/es/rule-x.js.map +1 -0
- package/es/rule-y.d.ts +12 -0
- package/es/rule-y.js +34 -0
- package/es/rule-y.js.map +1 -0
- package/es/rule.d.ts +12 -0
- package/es/rule.js +45 -0
- package/es/rule.js.map +1 -0
- package/es/sankey.d.ts +46 -0
- package/es/sankey.js +137 -0
- package/es/sankey.js.map +1 -0
- package/es/semantic-mark.d.ts +88 -0
- package/es/semantic-mark.js +833 -0
- package/es/semantic-mark.js.map +1 -0
- package/es/sunburst.d.ts +45 -0
- package/es/sunburst.js +133 -0
- package/es/sunburst.js.map +1 -0
- package/es/symbol.d.ts +13 -0
- package/es/symbol.js +51 -0
- package/es/symbol.js.map +1 -0
- package/es/text.d.ts +12 -0
- package/es/text.js +30 -0
- package/es/text.js.map +1 -0
- package/es/tree.d.ts +20 -0
- package/es/tree.js +127 -0
- package/es/tree.js.map +1 -0
- package/es/treemap.d.ts +41 -0
- package/es/treemap.js +108 -0
- package/es/treemap.js.map +1 -0
- package/es/util.d.ts +3 -0
- package/es/util.js +3 -0
- package/es/util.js.map +1 -0
- package/es/wordcloud-shape.d.ts +13 -0
- package/es/wordcloud-shape.js +84 -0
- package/es/wordcloud-shape.js.map +1 -0
- package/es/wordcloud.d.ts +13 -0
- package/es/wordcloud.js +80 -0
- package/es/wordcloud.js.map +1 -0
- package/package.json +73 -0
package/es/interval.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IntervalEncodeChannels, PlotIntervalEncoderSpec, SemanticTooltipOption, WithDefaultEncode, GenerateBaseEncodeSpec, Nil, ScaleSpec, ValueOf, CrosshairSpec, AttributeTransform, TransformSpec } from '@visactor/vgrammar';
|
|
2
|
+
import { SemanticMark } from './semantic-mark';
|
|
3
|
+
import { GrammarMarkType } from '@visactor/vgrammar';
|
|
4
|
+
import { PlotMakType } from './enums';
|
|
5
|
+
export declare class Interval extends SemanticMark<PlotIntervalEncoderSpec, IntervalEncodeChannels> {
|
|
6
|
+
static readonly type = PlotMakType.interval;
|
|
7
|
+
constructor(id?: string | number);
|
|
8
|
+
setMarkType(): GrammarMarkType.arc | GrammarMarkType.rect;
|
|
9
|
+
parseScaleByEncode(channel: IntervalEncodeChannels, option: ValueOf<WithDefaultEncode<PlotIntervalEncoderSpec, IntervalEncodeChannels>, IntervalEncodeChannels>): ScaleSpec | Nil;
|
|
10
|
+
setDefaultMarkTransform(): TransformSpec[];
|
|
11
|
+
setDefaultCrosshair(): Record<string, Pick<CrosshairSpec, 'crosshairShape' | 'crosshairType'>>;
|
|
12
|
+
setDefaultTooltip(): SemanticTooltipOption | Nil;
|
|
13
|
+
setMainMarkSpec(): {
|
|
14
|
+
attributeTransforms: AttributeTransform[];
|
|
15
|
+
} | {
|
|
16
|
+
attributeTransforms?: undefined;
|
|
17
|
+
};
|
|
18
|
+
convertMarkEncode(encode: WithDefaultEncode<PlotIntervalEncoderSpec, IntervalEncodeChannels>): GenerateBaseEncodeSpec<PlotIntervalEncoderSpec>;
|
|
19
|
+
}
|
package/es/interval.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { field as getFieldAccessor } from "@visactor/vgrammar-util";
|
|
2
|
+
|
|
3
|
+
import { SemanticMark } from "./semantic-mark";
|
|
4
|
+
|
|
5
|
+
import { getPalette, GrammarMarkType } from "@visactor/vgrammar";
|
|
6
|
+
|
|
7
|
+
import { isArray } from "@visactor/vutils";
|
|
8
|
+
|
|
9
|
+
import { PlotMakType } from "./enums";
|
|
10
|
+
|
|
11
|
+
export class Interval extends SemanticMark {
|
|
12
|
+
constructor(id) {
|
|
13
|
+
super(PlotMakType.interval, id);
|
|
14
|
+
}
|
|
15
|
+
setMarkType() {
|
|
16
|
+
var _a;
|
|
17
|
+
return "polar" === (null === (_a = this._coordinate) || void 0 === _a ? void 0 : _a.type) ? GrammarMarkType.arc : GrammarMarkType.rect;
|
|
18
|
+
}
|
|
19
|
+
parseScaleByEncode(channel, option) {
|
|
20
|
+
return this.parseScaleOfCommonEncode(channel, option);
|
|
21
|
+
}
|
|
22
|
+
setDefaultMarkTransform() {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
return [ {
|
|
25
|
+
type: "dodge",
|
|
26
|
+
minWidth: null === (_a = this.spec.style) || void 0 === _a ? void 0 : _a.minWidth,
|
|
27
|
+
maxWidth: null === (_b = this.spec.style) || void 0 === _b ? void 0 : _b.maxWidth,
|
|
28
|
+
innerGap: null === (_c = this.spec.style) || void 0 === _c ? void 0 : _c.innerGap,
|
|
29
|
+
categoryGap: null === (_d = this.spec.style) || void 0 === _d ? void 0 : _d.categoryGap
|
|
30
|
+
} ];
|
|
31
|
+
}
|
|
32
|
+
setDefaultCrosshair() {
|
|
33
|
+
return {
|
|
34
|
+
x: {
|
|
35
|
+
crosshairShape: "rect"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
setDefaultTooltip() {
|
|
40
|
+
var _a;
|
|
41
|
+
const encodeY = null === (_a = this.spec.encode) || void 0 === _a ? void 0 : _a.y;
|
|
42
|
+
return {
|
|
43
|
+
content: isArray(encodeY) ? encodeY.map((entry => ({
|
|
44
|
+
value: entry
|
|
45
|
+
}))) : [ {
|
|
46
|
+
value: encodeY
|
|
47
|
+
} ]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
setMainMarkSpec() {
|
|
51
|
+
var _a;
|
|
52
|
+
return "polar" === (null === (_a = this._coordinate) || void 0 === _a ? void 0 : _a.type) ? {
|
|
53
|
+
attributeTransforms: [ {
|
|
54
|
+
channels: [ "x", "y", "x1", "y1", "cx", "cy" ],
|
|
55
|
+
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
56
|
+
graphicAttributes.x = storedAttrs.cx, graphicAttributes.y = storedAttrs.cy, this._coordinate.transpose ? (graphicAttributes.startAngle = storedAttrs.y,
|
|
57
|
+
graphicAttributes.endAngle = storedAttrs.y1, graphicAttributes.innerRadius = storedAttrs.x,
|
|
58
|
+
graphicAttributes.outerRadius = storedAttrs.x1) : (graphicAttributes.startAngle = storedAttrs.x,
|
|
59
|
+
graphicAttributes.endAngle = storedAttrs.x1, graphicAttributes.innerRadius = storedAttrs.y,
|
|
60
|
+
graphicAttributes.outerRadius = storedAttrs.y1);
|
|
61
|
+
},
|
|
62
|
+
storedAttrs: "sizeAttrs"
|
|
63
|
+
} ]
|
|
64
|
+
} : {};
|
|
65
|
+
}
|
|
66
|
+
convertMarkEncode(encode) {
|
|
67
|
+
var _a, _b, _c, _d, _e;
|
|
68
|
+
const markEncoder = this.convertSimpleMarkEncode(encode), scaleXId = this.getScaleId("x"), scaleYId = this.getScaleId("y"), xAccessor = getFieldAccessor(markEncoder.x.field), res = {
|
|
69
|
+
x: (datum, el, params) => {
|
|
70
|
+
const scale = params[scaleXId], bandWidth = scale.bandwidth();
|
|
71
|
+
return scale.scale(xAccessor(datum)) + bandWidth / 4;
|
|
72
|
+
},
|
|
73
|
+
x1: (datum, el, params) => {
|
|
74
|
+
const scale = params[scaleXId], bandWidth = scale.bandwidth();
|
|
75
|
+
return scale.scale(xAccessor(datum)) + 3 * bandWidth / 4;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
if (isArray(null === (_a = markEncoder.y) || void 0 === _a ? void 0 : _a.field)) res.y = {
|
|
79
|
+
field: markEncoder.y.field[0],
|
|
80
|
+
scale: markEncoder.y.scale
|
|
81
|
+
}, res.y1 = {
|
|
82
|
+
field: markEncoder.y.field[1],
|
|
83
|
+
scale: markEncoder.y.scale
|
|
84
|
+
}; else {
|
|
85
|
+
const yAccessor = getFieldAccessor(markEncoder.y.field);
|
|
86
|
+
res.y = (datum, el, params) => {
|
|
87
|
+
const yVals = yAccessor(datum), scale = params[scaleYId];
|
|
88
|
+
return isArray(yVals) ? scale.scale(yVals[0]) : scale.scale(yVals);
|
|
89
|
+
}, res.y1 = (datum, el, params) => {
|
|
90
|
+
const scale = params[scaleYId], yVals = yAccessor(datum);
|
|
91
|
+
if (isArray(yVals) && yVals.length > 1) return scale.scale(yVals[1]);
|
|
92
|
+
const domain = scale.domain(), min = Math.min.apply(null, domain), max = Math.max.apply(null, domain), baseValue = min > 0 ? min : max < 0 ? max : 0;
|
|
93
|
+
return scale.scale(baseValue);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return markEncoder.color || markEncoder.group ? res.fill = null !== (_b = markEncoder.color) && void 0 !== _b ? _b : markEncoder.group : res.fill = null !== (_d = null === (_c = this.spec.style) || void 0 === _c ? void 0 : _c.fill) && void 0 !== _d ? _d : getPalette()[0],
|
|
97
|
+
"polar" === (null === (_e = this._coordinate) || void 0 === _e ? void 0 : _e.type) && (res.cx = (datum, el, params) => params[this._coordinate.id].origin().x,
|
|
98
|
+
res.cy = (datum, el, params) => params[this._coordinate.id].origin().y), res;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Interval.type = PlotMakType.interval;
|
|
103
|
+
//# sourceMapp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gBAEpD,OAAO,MAAM,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC;SACH;QAED,OAAO,GAAG,CAAC;IACb,CAAC;;AAvJe,aAAI,GAAG,WAAW,CAAC,QAAQ,CAAC","file":"interval.js","sourcesContent":["import type { IBandLikeScale } from '@visactor/vscale';\nimport { field as getFieldAccessor } from '@visactor/vgrammar-util';\nimport type {\n IntervalEncodeChannels,\n PlotIntervalEncoderSpec,\n SemanticTooltipOption,\n WithDefaultEncode,\n GenerateBaseEncodeSpec,\n Nil,\n ScaleSpec,\n ValueOf,\n CrosshairSpec,\n GenerateEncoderSpec,\n AttributeTransform,\n IElement,\n TransformSpec\n} from '@visactor/vgrammar';\nimport { SemanticMark } from './semantic-mark';\nimport { getPalette, GrammarMarkType } from '@visactor/vgrammar';\nimport type { IPolarCoordinate } from '@visactor/vgrammar-coordinate';\nimport { isArray } from '@visactor/vutils';\nimport { PlotMakType } from './enums';\n\nexport class Interval extends SemanticMark<PlotIntervalEncoderSpec, IntervalEncodeChannels> {\n static readonly type = PlotMakType.interval;\n constructor(id?: string | number) {\n super(PlotMakType.interval, id);\n }\n\n setMarkType() {\n return this._coordinate?.type === 'polar' ? GrammarMarkType.arc : GrammarMarkType.rect;\n }\n\n parseScaleByEncode(\n channel: IntervalEncodeChannels,\n option: ValueOf<WithDefaultEncode<PlotIntervalEncoderSpec, IntervalEncodeChannels>, IntervalEncodeChannels>\n ): ScaleSpec | Nil {\n return this.parseScaleOfCommonEncode(channel, option);\n }\n\n setDefaultMarkTransform(): TransformSpec[] {\n return [\n {\n type: 'dodge',\n minWidth: this.spec.style?.minWidth,\n maxWidth: this.spec.style?.maxWidth,\n innerGap: this.spec.style?.innerGap,\n categoryGap: this.spec.style?.categoryGap\n }\n ];\n }\n\n setDefaultCrosshair(): Record<string, Pick<CrosshairSpec, 'crosshairShape' | 'crosshairType'>> {\n return {\n x: { crosshairShape: 'rect' }\n };\n }\n\n setDefaultTooltip(): SemanticTooltipOption | Nil {\n const encodeY = this.spec.encode?.y;\n return {\n content: isArray(encodeY)\n ? encodeY.map(entry => {\n return {\n value: entry\n };\n })\n : [\n {\n value: encodeY\n }\n ]\n };\n }\n\n setMainMarkSpec() {\n return this._coordinate?.type === 'polar'\n ? {\n attributeTransforms: [\n {\n channels: ['x', 'y', 'x1', 'y1', 'cx', 'cy'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = storedAttrs.cx;\n graphicAttributes.y = storedAttrs.cy;\n if (this._coordinate.transpose) {\n graphicAttributes.startAngle = storedAttrs.y;\n graphicAttributes.endAngle = storedAttrs.y1;\n graphicAttributes.innerRadius = storedAttrs.x;\n graphicAttributes.outerRadius = storedAttrs.x1;\n } else {\n //\n graphicAttributes.startAngle = storedAttrs.x;\n graphicAttributes.endAngle = storedAttrs.x1;\n graphicAttributes.innerRadius = storedAttrs.y;\n graphicAttributes.outerRadius = storedAttrs.y1;\n }\n },\n storedAttrs: 'sizeAttrs'\n }\n ] as AttributeTransform[]\n }\n : {};\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<PlotIntervalEncoderSpec, IntervalEncodeChannels>\n ): GenerateBaseEncodeSpec<PlotIntervalEncoderSpec> {\n const markEncoder = this.convertSimpleMarkEncode(encode);\n const scaleXId = this.getScaleId('x');\n const scaleYId = this.getScaleId('y');\n const xAccessor = getFieldAccessor(markEncoder.x.field);\n const res: GenerateEncoderSpec<PlotIntervalEncoderSpec> = {\n x: (datum: any, el: IElement, params: any) => {\n const scale = params[scaleXId];\n const bandWidth = (scale as IBandLikeScale).bandwidth();\n\n return scale.scale(xAccessor(datum)) + bandWidth / 4;\n },\n x1: (datum: any, el: IElement, params: any) => {\n const scale = params[scaleXId];\n const bandWidth = (scale as IBandLikeScale).bandwidth();\n\n return scale.scale(xAccessor(datum)) + (3 * bandWidth) / 4;\n }\n };\n\n if (isArray(markEncoder.y?.field)) {\n res.y = { field: markEncoder.y.field[0], scale: markEncoder.y.scale };\n res.y1 = { field: markEncoder.y.field[1], scale: markEncoder.y.scale };\n } else {\n const yAccessor = getFieldAccessor(markEncoder.y.field);\n res.y = (datum: any, el: IElement, params: any) => {\n const yVals = yAccessor(datum);\n const scale = params[scaleYId];\n\n return isArray(yVals) ? scale.scale(yVals[0]) : scale.scale(yVals);\n };\n res.y1 = (datum: any, el: IElement, params: any) => {\n const scale = params[scaleYId];\n const yVals = yAccessor(datum);\n\n if (isArray(yVals) && yVals.length > 1) {\n return scale.scale(yVals[1]);\n }\n const domain = scale.domain();\n const min = Math.min.apply(null, domain);\n const max = Math.max.apply(null, domain);\n const baseValue = min > 0 ? min : max < 0 ? max : 0;\n\n return scale.scale(baseValue);\n };\n }\n\n if (markEncoder.color || markEncoder.group) {\n res.fill = markEncoder.color ?? markEncoder.group;\n } else {\n res.fill = this.spec.style?.fill ?? getPalette()[0];\n }\n\n if (this._coordinate?.type === 'polar') {\n (res as any).cx = (datum: any, el: IElement, params: any) => {\n const coord = params[this._coordinate.id];\n const origin = (coord as IPolarCoordinate).origin();\n\n return origin.x;\n };\n (res as any).cy = (datum: any, el: IElement, params: any) => {\n const coord = params[this._coordinate.id];\n const origin = (coord as IPolarCoordinate).origin();\n\n return origin.y;\n };\n }\n\n return res;\n }\n}\n"]}
|
package/es/line.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LineEncodeChannels, SemanticTooltipOption, WithDefaultEncode, BasicEncoderSpecMap, GenerateBaseEncodeSpec, Nil, ScaleSpec, ValueOf, CrosshairSpec } from '@visactor/vgrammar';
|
|
2
|
+
import { SemanticMark } from './semantic-mark';
|
|
3
|
+
import { GrammarMarkType } from '@visactor/vgrammar';
|
|
4
|
+
import { PlotMakType } from './enums';
|
|
5
|
+
export declare class Line extends SemanticMark<BasicEncoderSpecMap['line'], LineEncodeChannels> {
|
|
6
|
+
static readonly type = PlotMakType.line;
|
|
7
|
+
constructor(id?: string | number);
|
|
8
|
+
setMarkType(): GrammarMarkType;
|
|
9
|
+
protected parseScaleOfEncodeX(option: ValueOf<WithDefaultEncode<BasicEncoderSpecMap['line'], LineEncodeChannels>, LineEncodeChannels>): ScaleSpec | Nil;
|
|
10
|
+
parseScaleByEncode(channel: LineEncodeChannels, option: ValueOf<WithDefaultEncode<BasicEncoderSpecMap['line'], LineEncodeChannels>, LineEncodeChannels>): ScaleSpec | Nil;
|
|
11
|
+
setDefaultCrosshair(): Record<string, Pick<CrosshairSpec, 'crosshairShape' | 'crosshairType'>>;
|
|
12
|
+
setDefaultTooltip(): SemanticTooltipOption | Nil;
|
|
13
|
+
convertMarkEncode(encode: WithDefaultEncode<BasicEncoderSpecMap['line'], LineEncodeChannels>): GenerateBaseEncodeSpec<BasicEncoderSpecMap['line']>;
|
|
14
|
+
}
|
package/es/line.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SemanticMark } from "./semantic-mark";
|
|
2
|
+
|
|
3
|
+
import { getPalette, GrammarMarkType } from "@visactor/vgrammar";
|
|
4
|
+
|
|
5
|
+
import { PlotMakType } from "./enums";
|
|
6
|
+
|
|
7
|
+
export class Line extends SemanticMark {
|
|
8
|
+
constructor(id) {
|
|
9
|
+
super(PlotMakType.line, id);
|
|
10
|
+
}
|
|
11
|
+
setMarkType() {
|
|
12
|
+
return GrammarMarkType.line;
|
|
13
|
+
}
|
|
14
|
+
parseScaleOfEncodeX(option) {
|
|
15
|
+
const res = super.parseScaleOfEncodeX(option);
|
|
16
|
+
return res.type = "point", res;
|
|
17
|
+
}
|
|
18
|
+
parseScaleByEncode(channel, option) {
|
|
19
|
+
return this.parseScaleOfCommonEncode(channel, option);
|
|
20
|
+
}
|
|
21
|
+
setDefaultCrosshair() {
|
|
22
|
+
return {
|
|
23
|
+
x: {
|
|
24
|
+
crosshairShape: "line"
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
setDefaultTooltip() {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
return {
|
|
31
|
+
disableGraphicTooltip: !0,
|
|
32
|
+
title: null === (_a = this.spec.encode) || void 0 === _a ? void 0 : _a.x,
|
|
33
|
+
content: [ {
|
|
34
|
+
value: null === (_b = this.spec.encode) || void 0 === _b ? void 0 : _b.y
|
|
35
|
+
} ]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
convertMarkEncode(encode) {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
const markEncoder = this.convertSimpleMarkEncode(encode), res = {
|
|
41
|
+
y: markEncoder.y,
|
|
42
|
+
x: markEncoder.x
|
|
43
|
+
};
|
|
44
|
+
return markEncoder.color || markEncoder.group ? res.stroke = null !== (_a = markEncoder.color) && void 0 !== _a ? _a : markEncoder.group : res.stroke = null !== (_c = null === (_b = this.spec.style) || void 0 === _b ? void 0 : _b.stroke) && void 0 !== _c ? _c : getPalette()[0],
|
|
45
|
+
res;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
Line.type = PlotMakType.line;
|
|
50
|
+
//# sourceMappingURL=line.js.map
|
package/es/line.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/line.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,OAAO,IAAK,SAAQ,YAA6D;IAErF,YAAY,EAAoB;QAC9B,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,WAAW;QACT,OAAO,eAAe,CAAC,IAAI,CAAC;IAC9B,CAAC;IAES,mBAAmB,CAC3B,MAAuG;QAEvG,MAAM,GAAG,GAAG,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAE9C,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC;QACnB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,kBAAkB,CAChB,OAA2B,EAC3B,MAAuG;QAEvG,OAAO,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,mBAAmB;QACjB,OAAO;YACL,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE;SAC9B,CAAC;IACJ,CAAC;IAED,iBAAiB;;QACf,OAAO;YACL,qBAAqB,EAAE,IAAI;YAC3B,KAAK,EAAE,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,0CAAE,CAAC;YAC1B,OAAO,EAAE;gBACP;oBACE,KAAK,EAAE,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,0CAAE,CAAC;iBAC3B;aACF;SACF,CAAC;IACJ,CAAC;IAED,iBAAiB,CACf,MAA0E;;QAE1E,MAAM,WAAW,GAAG,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAEzD,MAAM,GAAG,GAAG;YACV,CAAC,EAAE,WAAW,CAAC,CAAC;YAChB,CAAC,EAAE,WAAW,CAAC,CAAC;SACmC,CAAC;QAEtD,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,EAAE;YAC1C,GAAG,CAAC,MAAM,GAAG,MAAA,WAAW,CAAC,KAAK,mCAAI,WAAW,CAAC,KAAK,CAAC;SACrD;aAAM;YACL,GAAG,CAAC,MAAM,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,0CAAE,MAAM,mCAAI,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;SACzD;QAED,OAAO,GAAG,CAAC;IACb,CAAC;;AA5De,SAAI,GAAG,WAAW,CAAC,IAAI,CAAC","file":"line.js","sourcesContent":["import type {\n LineEncodeChannels,\n SemanticTooltipOption,\n WithDefaultEncode,\n BasicEncoderSpecMap,\n GenerateBaseEncodeSpec,\n Nil,\n ScaleSpec,\n ValueOf,\n CrosshairSpec,\n GenerateEncoderSpec\n} from '@visactor/vgrammar';\nimport { SemanticMark } from './semantic-mark';\nimport { getPalette, GrammarMarkType } from '@visactor/vgrammar';\nimport { PlotMakType } from './enums';\n\nexport class Line extends SemanticMark<BasicEncoderSpecMap['line'], LineEncodeChannels> {\n static readonly type = PlotMakType.line;\n constructor(id?: string | number) {\n super(PlotMakType.line, id);\n }\n\n setMarkType() {\n return GrammarMarkType.line;\n }\n\n protected parseScaleOfEncodeX(\n option: ValueOf<WithDefaultEncode<BasicEncoderSpecMap['line'], LineEncodeChannels>, LineEncodeChannels>\n ): ScaleSpec | Nil {\n const res = super.parseScaleOfEncodeX(option);\n\n res.type = 'point';\n return res;\n }\n\n parseScaleByEncode(\n channel: LineEncodeChannels,\n option: ValueOf<WithDefaultEncode<BasicEncoderSpecMap['line'], LineEncodeChannels>, LineEncodeChannels>\n ): ScaleSpec | Nil {\n return this.parseScaleOfCommonEncode(channel, option);\n }\n\n setDefaultCrosshair(): Record<string, Pick<CrosshairSpec, 'crosshairShape' | 'crosshairType'>> {\n return {\n x: { crosshairShape: 'line' }\n };\n }\n\n setDefaultTooltip(): SemanticTooltipOption | Nil {\n return {\n disableGraphicTooltip: true,\n title: this.spec.encode?.x,\n content: [\n {\n value: this.spec.encode?.y\n }\n ]\n };\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<BasicEncoderSpecMap['line'], LineEncodeChannels>\n ): GenerateBaseEncodeSpec<BasicEncoderSpecMap['line']> {\n const markEncoder = this.convertSimpleMarkEncode(encode);\n\n const res = {\n y: markEncoder.y,\n x: markEncoder.x\n } as GenerateEncoderSpec<BasicEncoderSpecMap['line']>;\n\n if (markEncoder.color || markEncoder.group) {\n res.stroke = markEncoder.color ?? markEncoder.group;\n } else {\n res.stroke = this.spec.style?.stroke ?? getPalette()[0];\n }\n\n return res;\n }\n}\n"]}
|
package/es/path.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GrammarMarkType } from '@visactor/vgrammar';
|
|
2
|
+
import type { PathEncodeChannels, WithDefaultEncode, BasicEncoderSpecMap, GenerateBaseEncodeSpec, Nil, ScaleSpec, ValueOf } from '@visactor/vgrammar';
|
|
3
|
+
import { PlotMakType } from './enums';
|
|
4
|
+
import { SemanticMark } from './semantic-mark';
|
|
5
|
+
export declare class PathSemanticMark extends SemanticMark<BasicEncoderSpecMap['path'], PathEncodeChannels> {
|
|
6
|
+
static readonly type = PlotMakType.path;
|
|
7
|
+
constructor(id?: string | number);
|
|
8
|
+
setMarkType(): GrammarMarkType;
|
|
9
|
+
parseScaleByEncode(channel: PathEncodeChannels, option: ValueOf<WithDefaultEncode<BasicEncoderSpecMap['path'], PathEncodeChannels>, PathEncodeChannels>): ScaleSpec | Nil;
|
|
10
|
+
convertMarkEncode(encode: WithDefaultEncode<BasicEncoderSpecMap['path'], PathEncodeChannels>): GenerateBaseEncodeSpec<BasicEncoderSpecMap['path']>;
|
|
11
|
+
}
|
package/es/path.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GrammarMarkType } from "@visactor/vgrammar";
|
|
2
|
+
|
|
3
|
+
import { PlotMakType } from "./enums";
|
|
4
|
+
|
|
5
|
+
import { SemanticMark } from "./semantic-mark";
|
|
6
|
+
|
|
7
|
+
export class PathSemanticMark extends SemanticMark {
|
|
8
|
+
constructor(id) {
|
|
9
|
+
super(PlotMakType.path, id);
|
|
10
|
+
}
|
|
11
|
+
setMarkType() {
|
|
12
|
+
return GrammarMarkType.path;
|
|
13
|
+
}
|
|
14
|
+
parseScaleByEncode(channel, option) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
convertMarkEncode(encode) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
PathSemanticMark.type = PlotMakType.path;
|
|
23
|
+
//# sourceMappingURL=path.js.map
|
package/es/path.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAUrD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,gBAAiB,SAAQ,YAA6D;IAEjG,YAAY,EAAoB;QAC9B,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,WAAW;QACT,OAAO,eAAe,CAAC,IAAI,CAAC;IAC9B,CAAC;IACD,kBAAkB,CAChB,OAA2B,EAC3B,MAAuG;QAEvG,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iBAAiB,CACf,MAA0E;QAE1E,OAAO,IAAI,CAAC;IACd,CAAC;;AAnBe,qBAAI,GAAG,WAAW,CAAC,IAAI,CAAC","file":"path.js","sourcesContent":["import { GrammarMarkType } from '@visactor/vgrammar';\nimport type {\n PathEncodeChannels,\n WithDefaultEncode,\n BasicEncoderSpecMap,\n GenerateBaseEncodeSpec,\n Nil,\n ScaleSpec,\n ValueOf\n} from '@visactor/vgrammar';\nimport { PlotMakType } from './enums';\nimport { SemanticMark } from './semantic-mark';\n\nexport class PathSemanticMark extends SemanticMark<BasicEncoderSpecMap['path'], PathEncodeChannels> {\n static readonly type = PlotMakType.path;\n constructor(id?: string | number) {\n super(PlotMakType.path, id);\n }\n\n setMarkType() {\n return GrammarMarkType.path;\n }\n parseScaleByEncode(\n channel: PathEncodeChannels,\n option: ValueOf<WithDefaultEncode<BasicEncoderSpecMap['path'], PathEncodeChannels>, PathEncodeChannels>\n ): ScaleSpec | Nil {\n return null;\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<BasicEncoderSpecMap['path'], PathEncodeChannels>\n ): GenerateBaseEncodeSpec<BasicEncoderSpecMap['path']> {\n return null;\n }\n}\n"]}
|
package/es/plot-all.d.ts
ADDED
package/es/plot-all.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Interval } from "./interval";
|
|
2
|
+
|
|
3
|
+
import { Line } from "./line";
|
|
4
|
+
|
|
5
|
+
import { Cell } from "./cell";
|
|
6
|
+
|
|
7
|
+
import { RuleX } from "./rule-x";
|
|
8
|
+
|
|
9
|
+
import { RuleY } from "./rule-y";
|
|
10
|
+
|
|
11
|
+
import { Area } from "./area";
|
|
12
|
+
|
|
13
|
+
import { Plot } from "./plot";
|
|
14
|
+
|
|
15
|
+
import { ImageSemanticMark } from "./image";
|
|
16
|
+
|
|
17
|
+
import { PathSemanticMark } from "./path";
|
|
18
|
+
|
|
19
|
+
import { PolygonSemanticMark } from "./polygon";
|
|
20
|
+
|
|
21
|
+
import { RectXSemanticMark } from "./rect-x";
|
|
22
|
+
|
|
23
|
+
import { RectYSemanticMark } from "./rect-y";
|
|
24
|
+
|
|
25
|
+
import { RectSemanticMark } from "./rect";
|
|
26
|
+
|
|
27
|
+
import { Rule } from "./rule";
|
|
28
|
+
|
|
29
|
+
import { SymbolSemanticMark } from "./symbol";
|
|
30
|
+
|
|
31
|
+
import { TextSemanticMark } from "./text";
|
|
32
|
+
|
|
33
|
+
import { SankeySemanticMark } from "./sankey";
|
|
34
|
+
|
|
35
|
+
import { SunburstSemanticMark } from "./sunburst";
|
|
36
|
+
|
|
37
|
+
import { TreemapSemanticMark } from "./treemap";
|
|
38
|
+
|
|
39
|
+
import { CirclePackingSemanticMark } from "./circle-packing";
|
|
40
|
+
|
|
41
|
+
import { TreeSemanticMark } from "./tree";
|
|
42
|
+
|
|
43
|
+
import { WordcloudSemanticMark } from "./wordcloud";
|
|
44
|
+
|
|
45
|
+
import { WordcloudShapeSemanticMark } from "./wordcloud-shape";
|
|
46
|
+
|
|
47
|
+
Plot.useMarks([ Interval, Line, Cell, RuleX, RuleY, Area, ImageSemanticMark, PathSemanticMark, PolygonSemanticMark, RectSemanticMark, RectXSemanticMark, RectYSemanticMark, Rule, SymbolSemanticMark, TextSemanticMark, SankeySemanticMark, SunburstSemanticMark, TreemapSemanticMark, CirclePackingSemanticMark, TreeSemanticMark, WordcloudSemanticMark, WordcloudShapeSemanticMark ]);
|
|
48
|
+
|
|
49
|
+
export { Plot };
|
|
50
|
+
//# sourceMappingURL=plot-all.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plot-all.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,IAAI,CAAC,QAAQ,CAAC;IACZ,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,IAAI;IACJ,iBAAiB;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,IAAI;IACJ,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;IACnB,yBAAyB;IACzB,gBAAgB;IAChB,qBAAqB;IACrB,0BAA0B;CAC3B,CAAC,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC","file":"plot-all.js","sourcesContent":["import { Interval } from './interval';\nimport { Line } from './line';\nimport { Cell } from './cell';\nimport { RuleX } from './rule-x';\nimport { RuleY } from './rule-y';\nimport { Area } from './area';\nimport { Plot } from './plot';\nimport { ImageSemanticMark } from './image';\nimport { PathSemanticMark } from './path';\nimport { PolygonSemanticMark } from './polygon';\nimport { RectXSemanticMark } from './rect-x';\nimport { RectYSemanticMark } from './rect-y';\nimport { RectSemanticMark } from './rect';\nimport { Rule } from './rule';\nimport { SymbolSemanticMark } from './symbol';\nimport { TextSemanticMark } from './text';\nimport { SankeySemanticMark } from './sankey';\nimport { SunburstSemanticMark } from './sunburst';\nimport { TreemapSemanticMark } from './treemap';\nimport { CirclePackingSemanticMark } from './circle-packing';\nimport { TreeSemanticMark } from './tree';\nimport { WordcloudSemanticMark } from './wordcloud';\nimport { WordcloudShapeSemanticMark } from './wordcloud-shape';\n\nPlot.useMarks([\n Interval,\n Line,\n Cell,\n RuleX,\n RuleY,\n Area,\n ImageSemanticMark,\n PathSemanticMark,\n PolygonSemanticMark,\n RectSemanticMark,\n RectXSemanticMark,\n RectYSemanticMark,\n Rule,\n SymbolSemanticMark,\n TextSemanticMark,\n SankeySemanticMark,\n SunburstSemanticMark,\n TreemapSemanticMark,\n CirclePackingSemanticMark,\n TreeSemanticMark,\n WordcloudSemanticMark,\n WordcloudShapeSemanticMark\n]);\n\nexport { Plot };\n"]}
|
package/es/plot.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { CoordinateType } from '@visactor/vgrammar-coordinate';
|
|
3
|
+
import type { BaseEventHandler, IMorphConfig, ViewSpec, CoordinateOption, IPlot, IPlotMarkConstructor, IPlotOptions, PlotSpec } from '@visactor/vgrammar';
|
|
4
|
+
export declare class Plot implements IPlot {
|
|
5
|
+
static useMarks(marks: IPlotMarkConstructor[]): void;
|
|
6
|
+
private _view;
|
|
7
|
+
private _semanticMarks;
|
|
8
|
+
private _hasInited?;
|
|
9
|
+
private _coordinate;
|
|
10
|
+
private _logger;
|
|
11
|
+
constructor(option?: IPlotOptions);
|
|
12
|
+
private _mergeScales;
|
|
13
|
+
protected parseViewSpec(): ViewSpec;
|
|
14
|
+
run(morphConfig?: IMorphConfig): this;
|
|
15
|
+
runAsync(morphConfig?: IMorphConfig): Promise<this>;
|
|
16
|
+
release(): this;
|
|
17
|
+
updateSpec(spec: PlotSpec): this;
|
|
18
|
+
parseSpec(spec: PlotSpec, isUpdate?: boolean): this;
|
|
19
|
+
getImageBuffer(): Buffer;
|
|
20
|
+
on(type: string, handler: BaseEventHandler): this;
|
|
21
|
+
off(type: string, handler?: BaseEventHandler): this;
|
|
22
|
+
protected getCoordinateId(viewId?: string | number): string;
|
|
23
|
+
coordinate(type: CoordinateType, spec?: Omit<CoordinateOption, 'type'>): this;
|
|
24
|
+
interval(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
25
|
+
line(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
26
|
+
area(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
27
|
+
cell(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
28
|
+
ruleX(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
29
|
+
ruleY(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
30
|
+
image(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
31
|
+
path(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
32
|
+
polygon(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
33
|
+
rectX(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
34
|
+
rectY(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
35
|
+
rect(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
36
|
+
rule(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
37
|
+
symbol(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
38
|
+
text(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
39
|
+
sankey(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
40
|
+
sunburst(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
41
|
+
tree(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
42
|
+
treemap(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
43
|
+
circlePacking(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
44
|
+
wordcloud(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
45
|
+
wordcloudShape(): import("@visactor/vgrammar").ISemanticMark<any, any>;
|
|
46
|
+
}
|
package/es/plot.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2
|
+
return new (P || (P = Promise))((function(resolve, reject) {
|
|
3
|
+
function fulfilled(value) {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function rejected(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function step(result) {
|
|
18
|
+
var value;
|
|
19
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P((function(resolve) {
|
|
20
|
+
resolve(value);
|
|
21
|
+
}))).then(fulfilled, rejected);
|
|
22
|
+
}
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
import { Logger, isNil } from "@visactor/vutils";
|
|
28
|
+
|
|
29
|
+
import { mergeGrammarSpecs } from "./util";
|
|
30
|
+
|
|
31
|
+
import { PlotMakType } from "./enums";
|
|
32
|
+
|
|
33
|
+
import { Factory, SIGNAL_VIEW_BOX, View } from "@visactor/vgrammar";
|
|
34
|
+
|
|
35
|
+
export class Plot {
|
|
36
|
+
static useMarks(marks) {
|
|
37
|
+
marks.forEach((mark => {
|
|
38
|
+
Factory.registerPlotMarks(mark.type, mark);
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
constructor(option) {
|
|
42
|
+
this._view = new View(option), this._semanticMarks = [], this._logger = Logger.getInstance();
|
|
43
|
+
}
|
|
44
|
+
_mergeScales(scales, prevScales) {
|
|
45
|
+
return scales.reduce(((res, scale) => {
|
|
46
|
+
if (scale.id) {
|
|
47
|
+
const prevScale = res.find((prev => prev.id === scale.id));
|
|
48
|
+
if (prevScale) {
|
|
49
|
+
if (scale.domain.data && scale.domain.field) if (prevScale.domain.data && prevScale.domain.field) scale.domain.data === prevScale.domain.data && scale.domain.field !== prevScale.domain.field ? prevScale.domain.field = [].concat(prevScale.domain.field).concat(scale.domain.field) : scale.domain.data !== prevScale.domain.data && (prevScale.domain = {
|
|
50
|
+
datas: [ {
|
|
51
|
+
data: prevScale.domain.data,
|
|
52
|
+
field: prevScale.domain.field
|
|
53
|
+
}, {
|
|
54
|
+
data: scale.domain.data,
|
|
55
|
+
field: scale.domain.field
|
|
56
|
+
} ],
|
|
57
|
+
sort: prevScale.domain.sort
|
|
58
|
+
}), isNil(scale.domain.sort) || (prevScale.domain.sort = scale.domain.sort); else if (prevScale.domain.datas) {
|
|
59
|
+
const prevData = prevScale.domain.datas.find((entry => entry.data !== scale.domain.data));
|
|
60
|
+
prevData && scale.domain.field !== prevData.field ? prevData.field = [].concat(prevData.field).concat(scale.domain.field) : prevData || prevScale.domain.datas.push({
|
|
61
|
+
data: scale.domain.data,
|
|
62
|
+
field: scale.domain.field
|
|
63
|
+
}), isNil(scale.domain.sort) || (prevScale.domain.sort = scale.domain.sort);
|
|
64
|
+
}
|
|
65
|
+
} else res.push(scale);
|
|
66
|
+
}
|
|
67
|
+
return res;
|
|
68
|
+
}), prevScales);
|
|
69
|
+
}
|
|
70
|
+
parseViewSpec() {
|
|
71
|
+
const spec = {
|
|
72
|
+
data: [],
|
|
73
|
+
marks: [],
|
|
74
|
+
scales: [],
|
|
75
|
+
coordinates: [],
|
|
76
|
+
signals: [],
|
|
77
|
+
projections: [],
|
|
78
|
+
events: []
|
|
79
|
+
};
|
|
80
|
+
return this._semanticMarks.forEach((mark => {
|
|
81
|
+
this._coordinate && mark.coordinate(this._coordinate);
|
|
82
|
+
const {data: data, marks: marks, scales: scales, coordinates: coordinates, signals: signals, projections: projections, events: events} = mark.toViewSpec();
|
|
83
|
+
data && data.length && (spec.data = mergeGrammarSpecs(data, spec.data)), marks && marks.length && (spec.marks = spec.marks.concat(marks)),
|
|
84
|
+
scales && scales.length && (spec.scales = this._mergeScales(scales, spec.scales)),
|
|
85
|
+
coordinates && coordinates.length && (spec.coordinates = mergeGrammarSpecs(coordinates, spec.coordinates)),
|
|
86
|
+
signals && signals.length && (spec.signals = spec.signals.concat(signals)), projections && projections.length && (spec.projections = spec.projections.concat(projections)),
|
|
87
|
+
events && events.length && (spec.events = spec.events.concat(events));
|
|
88
|
+
})), spec.marks = [ {
|
|
89
|
+
type: "group",
|
|
90
|
+
layout: {
|
|
91
|
+
display: "relative",
|
|
92
|
+
updateViewSignals: !0
|
|
93
|
+
},
|
|
94
|
+
dependency: [ SIGNAL_VIEW_BOX ],
|
|
95
|
+
encode: {
|
|
96
|
+
update: (datum, elment, params) => ({
|
|
97
|
+
x: params.viewBox.x1,
|
|
98
|
+
y: params.viewBox.y1,
|
|
99
|
+
width: params.viewBox.width(),
|
|
100
|
+
height: params.viewBox.height()
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
marks: spec.marks
|
|
104
|
+
} ], spec;
|
|
105
|
+
}
|
|
106
|
+
run(morphConfig) {
|
|
107
|
+
return this._view && (this._hasInited || this._view.parseSpec(this.parseViewSpec()),
|
|
108
|
+
this._hasInited = !0, this._view.runSync(morphConfig)), this;
|
|
109
|
+
}
|
|
110
|
+
runAsync(morphConfig) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, (function*() {
|
|
112
|
+
return this._view && (this._hasInited || this._view.parseSpec(this.parseViewSpec()),
|
|
113
|
+
this._hasInited = !0, yield this._view.runAsync(morphConfig)), this;
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
release() {
|
|
117
|
+
return this._view && this._view.release(), this;
|
|
118
|
+
}
|
|
119
|
+
updateSpec(spec) {
|
|
120
|
+
return this.parseSpec(spec, !0), this;
|
|
121
|
+
}
|
|
122
|
+
parseSpec(spec, isUpdate) {
|
|
123
|
+
var _a;
|
|
124
|
+
spec.coordinate && this.coordinate(spec.coordinate.type, spec.coordinate), (null === (_a = null == spec ? void 0 : spec.marks) || void 0 === _a ? void 0 : _a.length) && spec.marks.forEach((mark => {
|
|
125
|
+
const plotMark = Factory.createPlotMark(mark.type);
|
|
126
|
+
plotMark.parseSpec(mark), this._semanticMarks.push(plotMark);
|
|
127
|
+
}));
|
|
128
|
+
const viewSpec = this.parseViewSpec();
|
|
129
|
+
return viewSpec.width = spec.width, viewSpec.height = spec.height, viewSpec.background = spec.background,
|
|
130
|
+
viewSpec.padding = spec.padding, isUpdate ? this._view.updateSpec(viewSpec) : this._view.parseSpec(viewSpec),
|
|
131
|
+
this._hasInited = !0, this;
|
|
132
|
+
}
|
|
133
|
+
getImageBuffer() {
|
|
134
|
+
var _a, _b;
|
|
135
|
+
return null === (_b = null === (_a = this._view) || void 0 === _a ? void 0 : _a.getImageBuffer) || void 0 === _b ? void 0 : _b.call(_a);
|
|
136
|
+
}
|
|
137
|
+
on(type, handler) {
|
|
138
|
+
return this._view && this._view.addEventListener(type, handler), this;
|
|
139
|
+
}
|
|
140
|
+
off(type, handler) {
|
|
141
|
+
return this._view && this._view.removeEventListener(type, handler), this;
|
|
142
|
+
}
|
|
143
|
+
getCoordinateId(viewId = "0") {
|
|
144
|
+
return `coordinate-${viewId}`;
|
|
145
|
+
}
|
|
146
|
+
coordinate(type, spec) {
|
|
147
|
+
return this._coordinate = Object.assign({
|
|
148
|
+
type: type,
|
|
149
|
+
id: this.getCoordinateId()
|
|
150
|
+
}, spec), this;
|
|
151
|
+
}
|
|
152
|
+
interval() {
|
|
153
|
+
const mark = Factory.createPlotMark(PlotMakType.interval);
|
|
154
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.interval} before use it`),
|
|
155
|
+
mark;
|
|
156
|
+
}
|
|
157
|
+
line() {
|
|
158
|
+
const mark = Factory.createPlotMark(PlotMakType.line);
|
|
159
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.line} before use it`),
|
|
160
|
+
mark;
|
|
161
|
+
}
|
|
162
|
+
area() {
|
|
163
|
+
const mark = Factory.createPlotMark(PlotMakType.area);
|
|
164
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.area} before use it`),
|
|
165
|
+
mark;
|
|
166
|
+
}
|
|
167
|
+
cell() {
|
|
168
|
+
const mark = Factory.createPlotMark(PlotMakType.cell);
|
|
169
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.cell} before use it`),
|
|
170
|
+
mark;
|
|
171
|
+
}
|
|
172
|
+
ruleX() {
|
|
173
|
+
const mark = Factory.createPlotMark(PlotMakType.ruleX);
|
|
174
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${this.ruleX} before use it`),
|
|
175
|
+
mark;
|
|
176
|
+
}
|
|
177
|
+
ruleY() {
|
|
178
|
+
const mark = Factory.createPlotMark(PlotMakType.ruleY);
|
|
179
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.ruleY} before use it`),
|
|
180
|
+
mark;
|
|
181
|
+
}
|
|
182
|
+
image() {
|
|
183
|
+
const mark = Factory.createPlotMark(PlotMakType.image);
|
|
184
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.image} before use it`),
|
|
185
|
+
mark;
|
|
186
|
+
}
|
|
187
|
+
path() {
|
|
188
|
+
const mark = Factory.createPlotMark(PlotMakType.path);
|
|
189
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.path} before use it`),
|
|
190
|
+
mark;
|
|
191
|
+
}
|
|
192
|
+
polygon() {
|
|
193
|
+
const mark = Factory.createPlotMark(PlotMakType.polygon);
|
|
194
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.polygon} before use it`),
|
|
195
|
+
mark;
|
|
196
|
+
}
|
|
197
|
+
rectX() {
|
|
198
|
+
const mark = Factory.createPlotMark(PlotMakType.rectX);
|
|
199
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.rectX} before use it`),
|
|
200
|
+
mark;
|
|
201
|
+
}
|
|
202
|
+
rectY() {
|
|
203
|
+
const mark = Factory.createPlotMark(PlotMakType.rectY);
|
|
204
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.rectY} before use it`),
|
|
205
|
+
mark;
|
|
206
|
+
}
|
|
207
|
+
rect() {
|
|
208
|
+
const mark = Factory.createPlotMark(PlotMakType.rect);
|
|
209
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.rect} before use it`),
|
|
210
|
+
mark;
|
|
211
|
+
}
|
|
212
|
+
rule() {
|
|
213
|
+
const mark = Factory.createPlotMark(PlotMakType.rule);
|
|
214
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.rule} before use it`),
|
|
215
|
+
mark;
|
|
216
|
+
}
|
|
217
|
+
symbol() {
|
|
218
|
+
const mark = Factory.createPlotMark(PlotMakType.symbol);
|
|
219
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.symbol} before use it`),
|
|
220
|
+
mark;
|
|
221
|
+
}
|
|
222
|
+
text() {
|
|
223
|
+
const mark = Factory.createPlotMark(PlotMakType.text);
|
|
224
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.text} before use it`),
|
|
225
|
+
mark;
|
|
226
|
+
}
|
|
227
|
+
sankey() {
|
|
228
|
+
const mark = Factory.createPlotMark(PlotMakType.sankey);
|
|
229
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.sankey} before use it`),
|
|
230
|
+
mark;
|
|
231
|
+
}
|
|
232
|
+
sunburst() {
|
|
233
|
+
const mark = Factory.createPlotMark(PlotMakType.sunburst);
|
|
234
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.sunburst} before use it`),
|
|
235
|
+
mark;
|
|
236
|
+
}
|
|
237
|
+
tree() {
|
|
238
|
+
const mark = Factory.createPlotMark(PlotMakType.tree);
|
|
239
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.tree} before use it`),
|
|
240
|
+
mark;
|
|
241
|
+
}
|
|
242
|
+
treemap() {
|
|
243
|
+
const mark = Factory.createPlotMark(PlotMakType.treemap);
|
|
244
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.treemap} before use it`),
|
|
245
|
+
mark;
|
|
246
|
+
}
|
|
247
|
+
circlePacking() {
|
|
248
|
+
const mark = Factory.createPlotMark(PlotMakType.circlePacking);
|
|
249
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.circlePacking} before use it`),
|
|
250
|
+
mark;
|
|
251
|
+
}
|
|
252
|
+
wordcloud() {
|
|
253
|
+
const mark = Factory.createPlotMark(PlotMakType.wordcloud);
|
|
254
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.wordcloud} before use it`),
|
|
255
|
+
mark;
|
|
256
|
+
}
|
|
257
|
+
wordcloudShape() {
|
|
258
|
+
const mark = Factory.createPlotMark(PlotMakType.wordcloudShape);
|
|
259
|
+
return mark ? this._semanticMarks.push(mark) : this._logger.error(`Please register ${PlotMakType.wordcloudShape} before use it`),
|
|
260
|
+
mark;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=plot.js.map
|