@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/rule.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SemanticMark } from "./semantic-mark";
|
|
2
|
+
|
|
3
|
+
import { getPalette, GrammarMarkType } from "@visactor/vgrammar";
|
|
4
|
+
|
|
5
|
+
import { isArray } from "@visactor/vutils";
|
|
6
|
+
|
|
7
|
+
import { PlotMakType } from "./enums";
|
|
8
|
+
|
|
9
|
+
export class Rule extends SemanticMark {
|
|
10
|
+
constructor(id) {
|
|
11
|
+
super(PlotMakType.rule, id);
|
|
12
|
+
}
|
|
13
|
+
setMarkType() {
|
|
14
|
+
return GrammarMarkType.rule;
|
|
15
|
+
}
|
|
16
|
+
parseScaleOfEncodeX(option) {
|
|
17
|
+
const res = super.parseScaleOfEncodeX(option);
|
|
18
|
+
return res.type = "point", res;
|
|
19
|
+
}
|
|
20
|
+
parseScaleByEncode(channel, option) {
|
|
21
|
+
return this.parseScaleOfCommonEncode(channel, option);
|
|
22
|
+
}
|
|
23
|
+
convertMarkEncode(encode) {
|
|
24
|
+
var _a, _b, _c, _d, _e;
|
|
25
|
+
const markEncoder = this.convertSimpleMarkEncode(encode);
|
|
26
|
+
let res;
|
|
27
|
+
return isArray(null === (_a = markEncoder.x) || void 0 === _a ? void 0 : _a.field) ? (res.x = {
|
|
28
|
+
field: markEncoder.x.field[0],
|
|
29
|
+
scale: markEncoder.x.scale
|
|
30
|
+
}, res.x1 = {
|
|
31
|
+
field: markEncoder.x.field[1],
|
|
32
|
+
scale: markEncoder.x.scale
|
|
33
|
+
}) : res.x = res.x1 = markEncoder.x, isArray(null === (_b = markEncoder.y) || void 0 === _b ? void 0 : _b.field) ? (res.y = {
|
|
34
|
+
field: markEncoder.y.field[0],
|
|
35
|
+
scale: markEncoder.y.scale
|
|
36
|
+
}, res.y1 = {
|
|
37
|
+
field: markEncoder.y.field[1],
|
|
38
|
+
scale: markEncoder.y.scale
|
|
39
|
+
}) : res.y = res.y1 = markEncoder.y, markEncoder.color || markEncoder.group ? res.stroke = null !== (_c = markEncoder.color) && void 0 !== _c ? _c : markEncoder.group : res.stroke = null !== (_e = null === (_d = this.spec.style) || void 0 === _d ? void 0 : _d.stroke) && void 0 !== _e ? _e : getPalette()[0],
|
|
40
|
+
res;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Rule.type = PlotMakType.rule;
|
|
45
|
+
//# sourceMappingURL=rule.js.map
|
package/es/rule.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rule.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,OAAO,IAAK,SAAQ,YAAqD;IAE7E,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,MAA+F;QAE/F,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,MAA+F;QAE/F,OAA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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;;AArDe,SAAI,GAAG,WAAW,CAAC,IAAI,CAAC","file":"rule.js","sourcesContent":["import type {\n RuleEncodeChannels,\n WithDefaultEncode,\n PlotRuleEncoderSpec,\n GenerateBaseEncodeSpec,\n GenerateEncoderSpec,\n Nil,\n ScaleSpec,\n ValueOf\n} from '@visactor/vgrammar';\nimport { SemanticMark } from './semantic-mark';\nimport { getPalette, GrammarMarkType } from '@visactor/vgrammar';\nimport { isArray } from '@visactor/vutils';\nimport { PlotMakType } from './enums';\n\nexport class Rule extends SemanticMark<PlotRuleEncoderSpec, RuleEncodeChannels> {\n static readonly type = PlotMakType.rule;\n constructor(id?: string | number) {\n super(PlotMakType.rule, id);\n }\n\n setMarkType() {\n return GrammarMarkType.rule;\n }\n\n protected parseScaleOfEncodeX(\n option: ValueOf<WithDefaultEncode<PlotRuleEncoderSpec, RuleEncodeChannels>, RuleEncodeChannels>\n ): ScaleSpec | Nil {\n const res = super.parseScaleOfEncodeX(option);\n\n res.type = 'point';\n return res;\n }\n\n parseScaleByEncode(\n channel: RuleEncodeChannels,\n option: ValueOf<WithDefaultEncode<PlotRuleEncoderSpec, RuleEncodeChannels>, RuleEncodeChannels>\n ): ScaleSpec | Nil {\n return this.parseScaleOfCommonEncode(channel, option);\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<PlotRuleEncoderSpec, RuleEncodeChannels>\n ): GenerateBaseEncodeSpec<PlotRuleEncoderSpec> {\n const markEncoder = this.convertSimpleMarkEncode(encode);\n\n let res: GenerateEncoderSpec<PlotRuleEncoderSpec>;\n\n if (isArray(markEncoder.x?.field)) {\n res.x = { field: markEncoder.x.field[0], scale: markEncoder.x.scale };\n res.x1 = { field: markEncoder.x.field[1], scale: markEncoder.x.scale };\n } else {\n res.x = res.x1 = markEncoder.x;\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 res.y = res.y1 = markEncoder.y;\n }\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/sankey.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { SankeyEncodeChannels, WithDefaultEncode, PlotSankeyEncoderSpec, SemanticLabelOption, ChannelEncodeType, DataSpec, GenerateBaseEncodeSpec, Nil, ScaleSpec, ValueOf, TransformSpec, IElement } from '@visactor/vgrammar';
|
|
2
|
+
import { SemanticMark } from './semantic-mark';
|
|
3
|
+
import { GrammarMarkType } from '@visactor/vgrammar';
|
|
4
|
+
import { PlotMakType } from './enums';
|
|
5
|
+
import type { ITextAttribute } from '@visactor/vrender';
|
|
6
|
+
export declare class SankeySemanticMark extends SemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels> {
|
|
7
|
+
static readonly type = PlotMakType.sankey;
|
|
8
|
+
constructor(id?: string | number);
|
|
9
|
+
setMarkType(): GrammarMarkType;
|
|
10
|
+
setDefaultDataTransform(): TransformSpec[];
|
|
11
|
+
getDataIdOfLink(): string;
|
|
12
|
+
setMultipleData(): DataSpec[];
|
|
13
|
+
parseScaleByEncode(channel: SankeyEncodeChannels, option: ValueOf<WithDefaultEncode<PlotSankeyEncoderSpec, SankeyEncodeChannels>, SankeyEncodeChannels>): ScaleSpec | Nil;
|
|
14
|
+
convertMarkEncode(encode: WithDefaultEncode<PlotSankeyEncoderSpec, SankeyEncodeChannels>): GenerateBaseEncodeSpec<PlotSankeyEncoderSpec>;
|
|
15
|
+
setMainMarkSpec(): {
|
|
16
|
+
key: string;
|
|
17
|
+
};
|
|
18
|
+
protected setLabelTextGetter(channel: string, option: SemanticLabelOption | boolean): ChannelEncodeType<ITextAttribute['text']>;
|
|
19
|
+
setMultiMarksSpec(): {
|
|
20
|
+
id: string;
|
|
21
|
+
type: string;
|
|
22
|
+
glyphType: string;
|
|
23
|
+
from: {
|
|
24
|
+
data: string;
|
|
25
|
+
};
|
|
26
|
+
layout: {
|
|
27
|
+
position: string;
|
|
28
|
+
skipBeforeLayouted: boolean;
|
|
29
|
+
};
|
|
30
|
+
key: string;
|
|
31
|
+
dependency: string[];
|
|
32
|
+
animation: import("@visactor/vgrammar").MarkAnimationSpec;
|
|
33
|
+
encode: Record<string, Partial<Partial<import("@visactor/vgrammar").LinkPathEncoderSpec>>> & {
|
|
34
|
+
enter: any;
|
|
35
|
+
update: (datum: any, el: IElement, params: any) => {
|
|
36
|
+
direction: string;
|
|
37
|
+
x0: any;
|
|
38
|
+
x1: any;
|
|
39
|
+
y0: any;
|
|
40
|
+
y1: any;
|
|
41
|
+
thickness: any;
|
|
42
|
+
fill: any;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}[];
|
|
46
|
+
}
|
package/es/sankey.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { SemanticMark } from "./semantic-mark";
|
|
2
|
+
|
|
3
|
+
import { getPalette, GrammarMarkType, SIGNAL_VIEW_BOX, getTransform, getGlyph } from "@visactor/vgrammar";
|
|
4
|
+
|
|
5
|
+
import { PlotMakType } from "./enums";
|
|
6
|
+
|
|
7
|
+
import { field as getFieldAccessor } from "@visactor/vgrammar-util";
|
|
8
|
+
|
|
9
|
+
export class SankeySemanticMark extends SemanticMark {
|
|
10
|
+
constructor(id) {
|
|
11
|
+
super(PlotMakType.sankey, id), getTransform(PlotMakType.sankey) || this._logger.error("Please add this line of code: import { registerSankeyTransforms } from '@visactor/vgrammar-sankey'; \n and run registerSankeyTransforms() before use sankey"),
|
|
12
|
+
getGlyph("linkPath") || this._logger.error("\n Please add this line of code: import { registerLinkPathGlyph } from '@visactor/vgrammar';\n add run registerLinkPathGlyph() before use sankey\n ");
|
|
13
|
+
}
|
|
14
|
+
setMarkType() {
|
|
15
|
+
return GrammarMarkType.rect;
|
|
16
|
+
}
|
|
17
|
+
setDefaultDataTransform() {
|
|
18
|
+
var _a;
|
|
19
|
+
return [ {
|
|
20
|
+
type: "sankey",
|
|
21
|
+
width: {
|
|
22
|
+
signal: "viewWidth"
|
|
23
|
+
},
|
|
24
|
+
height: {
|
|
25
|
+
signal: "viewHeight"
|
|
26
|
+
},
|
|
27
|
+
nodeKey: null === (_a = this.spec.encode) || void 0 === _a ? void 0 : _a.node
|
|
28
|
+
} ];
|
|
29
|
+
}
|
|
30
|
+
getDataIdOfLink() {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
return `${null !== (_b = null === (_a = this.spec.data) || void 0 === _a ? void 0 : _a.id) && void 0 !== _b ? _b : this.spec.id}-data-link`;
|
|
33
|
+
}
|
|
34
|
+
setMultipleData() {
|
|
35
|
+
return [ {
|
|
36
|
+
id: this.getDataIdOfFiltered(),
|
|
37
|
+
transform: [ {
|
|
38
|
+
type: "map",
|
|
39
|
+
all: !0,
|
|
40
|
+
callback: datum => datum[0].nodes
|
|
41
|
+
} ]
|
|
42
|
+
}, {
|
|
43
|
+
source: this.getDataIdOfMain(),
|
|
44
|
+
id: this.getDataIdOfLink(),
|
|
45
|
+
transform: [ {
|
|
46
|
+
type: "map",
|
|
47
|
+
all: !0,
|
|
48
|
+
callback: datum => datum[0].links
|
|
49
|
+
} ]
|
|
50
|
+
} ];
|
|
51
|
+
}
|
|
52
|
+
parseScaleByEncode(channel, option) {
|
|
53
|
+
return "color" === channel ? {
|
|
54
|
+
type: "ordinal",
|
|
55
|
+
id: this.getScaleId("color"),
|
|
56
|
+
domain: {
|
|
57
|
+
data: this.getDataIdOfFiltered(),
|
|
58
|
+
field: option
|
|
59
|
+
},
|
|
60
|
+
range: getPalette()
|
|
61
|
+
} : null;
|
|
62
|
+
}
|
|
63
|
+
convertMarkEncode(encode) {
|
|
64
|
+
var _a, _b, _c;
|
|
65
|
+
const markEncoder = this.convertSimpleMarkEncode(encode), res = {
|
|
66
|
+
x: {
|
|
67
|
+
field: "x0"
|
|
68
|
+
},
|
|
69
|
+
x1: {
|
|
70
|
+
field: "x1"
|
|
71
|
+
},
|
|
72
|
+
y: {
|
|
73
|
+
field: "y0"
|
|
74
|
+
},
|
|
75
|
+
y1: {
|
|
76
|
+
field: "y1"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
if (markEncoder.color) {
|
|
80
|
+
const scaleColorId = this.getScaleId("color"), colorAccessor = getFieldAccessor(markEncoder.color.field);
|
|
81
|
+
res.fill = (datum, el, params) => params[scaleColorId].scale(colorAccessor(null == datum ? void 0 : datum.datum));
|
|
82
|
+
} else res.fill = null !== (_c = null === (_b = null === (_a = this.spec.style) || void 0 === _a ? void 0 : _a.nodeStyle) || void 0 === _b ? void 0 : _b.fill) && void 0 !== _c ? _c : getPalette()[0];
|
|
83
|
+
return res;
|
|
84
|
+
}
|
|
85
|
+
setMainMarkSpec() {
|
|
86
|
+
return {
|
|
87
|
+
key: "key"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
setLabelTextGetter(channel, option) {
|
|
91
|
+
const textGetter = getFieldAccessor(channel);
|
|
92
|
+
return (datum, el, params) => textGetter(datum.datum);
|
|
93
|
+
}
|
|
94
|
+
setMultiMarksSpec() {
|
|
95
|
+
var _a;
|
|
96
|
+
return [ {
|
|
97
|
+
id: `${this.getMarkId()}-link`,
|
|
98
|
+
type: "glyph",
|
|
99
|
+
glyphType: "linkPath",
|
|
100
|
+
from: {
|
|
101
|
+
data: this.getDataIdOfLink()
|
|
102
|
+
},
|
|
103
|
+
layout: {
|
|
104
|
+
position: "content",
|
|
105
|
+
skipBeforeLayouted: !0
|
|
106
|
+
},
|
|
107
|
+
key: "index",
|
|
108
|
+
dependency: this.viewSpec.scales.map((scale => scale.id)).concat(SIGNAL_VIEW_BOX),
|
|
109
|
+
animation: this.convertMarkAnimation(),
|
|
110
|
+
encode: Object.assign({}, this.spec.state, {
|
|
111
|
+
enter: Object.assign({
|
|
112
|
+
backgroundStyle: {
|
|
113
|
+
fillColor: "#ccc",
|
|
114
|
+
fillOpacity: .2
|
|
115
|
+
},
|
|
116
|
+
fillOpacity: .8,
|
|
117
|
+
round: !0
|
|
118
|
+
}, null === (_a = this.spec.style) || void 0 === _a ? void 0 : _a.linkStyle),
|
|
119
|
+
update: (datum, el, params) => {
|
|
120
|
+
var _a, _b, _c;
|
|
121
|
+
return {
|
|
122
|
+
direction: datum.vertical ? "vertical" : "horizontal",
|
|
123
|
+
x0: datum.x0,
|
|
124
|
+
x1: datum.x1,
|
|
125
|
+
y0: datum.y0,
|
|
126
|
+
y1: datum.y1,
|
|
127
|
+
thickness: datum.thickness,
|
|
128
|
+
fill: null !== (_c = null === (_b = null === (_a = this.spec.style) || void 0 === _a ? void 0 : _a.linkStyle) || void 0 === _b ? void 0 : _b.fill) && void 0 !== _c ? _c : getPalette()[0]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
} ];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
SankeySemanticMark.type = PlotMakType.sankey;
|
|
137
|
+
//# sourceMappingURL=sankey.js.map
|
package/es/sankey.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sankey.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1G,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,KA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AAE;oBACzC,KAAK,EAAE,MAAM,CAAC,MAAM,CAClB;wBACE,eAAe,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE;wBACxD,WAAW,EAAE,GAAG;wBAChB,KAAK,EAAE,IAAI;qBACZ,EACD,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,0CAAE,SAAS,CAC3B;oBACD,MAAM,EAAE,CAAC,KAAU,EAAE,EAAY,EAAE,MAAW,EAAE,EAAE;;wBAChD,OAAO;4BACL,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;4BACrD,EAAE,EAAE,KAAK,CAAC,EAAE;4BACZ,EAAE,EAAE,KAAK,CAAC,EAAE;4BACZ,EAAE,EAAE,KAAK,CAAC,EAAE;4BACZ,EAAE,EAAE,KAAK,CAAC,EAAE;4BACZ,SAAS,EAAE,KAAK,CAAC,SAAS;4BAC1B,IAAI,EAAE,MAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,0CAAE,SAAS,0CAAE,IAAI,mCAAI,UAAU,EAAE,CAAC,CAAC,CAAC;yBAC1D,CAAC;oBACJ,CAAC;iBACF,CAAC;aACH;SACF,CAAC;IACJ,CAAC;;AAzKe,uBAAI,GAAG,WAAW,CAAC,MAAM,CAAC","file":"sankey.js","sourcesContent":["import type {\n SankeyEncodeChannels,\n WithDefaultEncode,\n PlotSankeyEncoderSpec,\n SemanticLabelOption,\n ChannelEncodeType,\n DataSpec,\n GenerateBaseEncodeSpec,\n GenerateEncoderSpec,\n Nil,\n ScaleSpec,\n ValueOf,\n TransformSpec,\n IElement\n} from '@visactor/vgrammar';\nimport { SemanticMark } from './semantic-mark';\nimport { getPalette, GrammarMarkType, SIGNAL_VIEW_BOX, getTransform, getGlyph } from '@visactor/vgrammar';\nimport { PlotMakType } from './enums';\nimport { field as getFieldAccessor } from '@visactor/vgrammar-util';\nimport type { ITextAttribute } from '@visactor/vrender';\n\nexport class SankeySemanticMark extends SemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels> {\n static readonly type = PlotMakType.sankey;\n constructor(id?: string | number) {\n super(PlotMakType.sankey, id);\n\n if (!getTransform(PlotMakType.sankey)) {\n this._logger.error(\n `Please add this line of code: import { registerSankeyTransforms } from '@visactor/vgrammar-sankey'; \n and run registerSankeyTransforms() before use sankey`\n );\n }\n\n if (!getGlyph('linkPath')) {\n this._logger.error(`\n Please add this line of code: import { registerLinkPathGlyph } from '@visactor/vgrammar';\n add run registerLinkPathGlyph() before use sankey\n `);\n }\n }\n\n setMarkType() {\n return GrammarMarkType.rect;\n }\n\n setDefaultDataTransform(): TransformSpec[] {\n return [\n {\n type: 'sankey',\n width: { signal: 'viewWidth' },\n height: { signal: 'viewHeight' },\n nodeKey: this.spec.encode?.node\n }\n ];\n }\n\n getDataIdOfLink() {\n return `${this.spec.data?.id ?? this.spec.id}-data-link`;\n }\n\n setMultipleData(): DataSpec[] {\n return [\n {\n id: this.getDataIdOfFiltered(),\n transform: [\n {\n type: 'map',\n all: true,\n callback: (datum: any) => {\n return datum[0].nodes;\n }\n }\n ]\n },\n {\n source: this.getDataIdOfMain(),\n id: this.getDataIdOfLink(),\n transform: [\n {\n type: 'map',\n all: true,\n callback: (datum: any) => {\n // return formatLinkPath(datum[0].links);\n return datum[0].links;\n }\n }\n ]\n }\n ];\n }\n\n parseScaleByEncode(\n channel: SankeyEncodeChannels,\n option: ValueOf<WithDefaultEncode<PlotSankeyEncoderSpec, SankeyEncodeChannels>, SankeyEncodeChannels>\n ): ScaleSpec | Nil {\n if (channel === 'color') {\n return {\n type: 'ordinal',\n id: this.getScaleId('color'),\n domain: {\n data: this.getDataIdOfFiltered(),\n field: option as string\n },\n range: getPalette()\n };\n }\n\n return null;\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<PlotSankeyEncoderSpec, SankeyEncodeChannels>\n ): GenerateBaseEncodeSpec<PlotSankeyEncoderSpec> {\n const markEncoder = this.convertSimpleMarkEncode(encode);\n\n const res: GenerateEncoderSpec<PlotSankeyEncoderSpec> = {\n x: { field: 'x0' },\n x1: { field: 'x1' },\n y: { field: 'y0' },\n y1: { field: 'y1' }\n };\n\n if (markEncoder.color) {\n const scaleColorId = this.getScaleId('color');\n const colorAccessor = getFieldAccessor(markEncoder.color.field);\n\n res.fill = (datum: any, el: IElement, params: any) => {\n const scale = params[scaleColorId];\n return scale.scale(colorAccessor(datum?.datum));\n };\n } else {\n res.fill = this.spec.style?.nodeStyle?.fill ?? getPalette()[0];\n }\n\n return res;\n }\n\n setMainMarkSpec() {\n return { key: 'key' };\n }\n\n protected setLabelTextGetter(\n channel: string,\n option: SemanticLabelOption | boolean\n ): ChannelEncodeType<ITextAttribute['text']> {\n const textGetter = getFieldAccessor(channel);\n return (datum: any, el: IElement, params: any) => {\n return textGetter(datum.datum);\n };\n }\n\n setMultiMarksSpec() {\n // TODO: optimize the default style\n return [\n {\n id: `${this.getMarkId()}-link`,\n type: 'glyph',\n glyphType: 'linkPath',\n from: {\n data: this.getDataIdOfLink()\n },\n layout: {\n position: 'content',\n skipBeforeLayouted: true\n },\n key: 'index',\n dependency: this.viewSpec.scales.map(scale => scale.id).concat(SIGNAL_VIEW_BOX),\n animation: this.convertMarkAnimation(),\n encode: Object.assign({}, this.spec.state, {\n enter: Object.assign(\n {\n backgroundStyle: { fillColor: '#ccc', fillOpacity: 0.2 },\n fillOpacity: 0.8,\n round: true\n },\n this.spec.style?.linkStyle\n ),\n update: (datum: any, el: IElement, params: any) => {\n return {\n direction: datum.vertical ? 'vertical' : 'horizontal',\n x0: datum.x0,\n x1: datum.x1,\n y0: datum.y0,\n y1: datum.y1,\n thickness: datum.thickness,\n fill: this.spec.style?.linkStyle?.fill ?? getPalette()[0]\n };\n }\n })\n }\n ];\n }\n}\n"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ILogger } from '@visactor/vutils';
|
|
2
|
+
import type { ISemanticMark, ISemanticMarkSpec, ParsedSimpleEncode, WithDefaultEncode, SemanticTooltipOption, SemanticAxisOption, SemanticPlayerOption, SemanticLabelOption, SemanticDataZoomOption, SemanticSliderOption, SemanticLegendOption, SemanticCrosshairOption, CoordinateOption, AxisSpec, CrosshairSpec, DatazoomSpec, DimensionTooltipSpec, LabelSpec, LegendSpec, PlayerSpec, SliderSpec, TooltipSpec, CoordinateSpec, DataSpec, ChannelEncodeType, ScaleSpec, TransformSpec, MarkAnimationSpec, ViewSpec, MarkType, Nil, ValueOf, GenerateBaseEncodeSpec, IAnimationConfig, MarkSpec, MarkRelativeItemSpec } from '@visactor/vgrammar';
|
|
3
|
+
import type { ITextAttribute } from '@visactor/vrender';
|
|
4
|
+
export declare abstract class SemanticMark<EncodeSpec, K extends string> implements ISemanticMark<EncodeSpec, K> {
|
|
5
|
+
spec: ISemanticMarkSpec<EncodeSpec, K>;
|
|
6
|
+
viewSpec?: ViewSpec;
|
|
7
|
+
readonly uid: number;
|
|
8
|
+
protected _logger: ILogger;
|
|
9
|
+
protected _coordinate: CoordinateOption;
|
|
10
|
+
readonly type: string;
|
|
11
|
+
constructor(type: string, id?: string | number);
|
|
12
|
+
parseSpec(spec: Partial<ISemanticMarkSpec<EncodeSpec, K>>): this;
|
|
13
|
+
coordinate(option: CoordinateOption): this;
|
|
14
|
+
data(values: any, transform?: TransformSpec[], id?: string): this;
|
|
15
|
+
encode(channel: K, option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>): this;
|
|
16
|
+
scale(channel: string, option: Partial<ScaleSpec>): this;
|
|
17
|
+
style(style: Partial<EncodeSpec & any>): this;
|
|
18
|
+
transform(option: TransformSpec | TransformSpec[]): this;
|
|
19
|
+
state(state: string, option: Partial<EncodeSpec>): this;
|
|
20
|
+
animate(state: string, option: IAnimationConfig | IAnimationConfig[]): this;
|
|
21
|
+
axis(channel: string, option?: SemanticAxisOption | boolean, layout?: MarkRelativeItemSpec): this;
|
|
22
|
+
legend(channel: string, option?: SemanticLegendOption | boolean, layout?: MarkRelativeItemSpec): this;
|
|
23
|
+
crosshair(channel: string, option?: SemanticCrosshairOption | boolean): this;
|
|
24
|
+
tooltip(option: SemanticTooltipOption | boolean): this;
|
|
25
|
+
slider(channel: string, option?: SemanticSliderOption | boolean, layout?: MarkRelativeItemSpec): this;
|
|
26
|
+
datazoom(channel: string, option?: SemanticDataZoomOption | boolean, layout?: MarkRelativeItemSpec): this;
|
|
27
|
+
label(channel: string, option?: SemanticLabelOption | boolean): this;
|
|
28
|
+
player(data?: any[], option?: SemanticPlayerOption | boolean, layout?: MarkRelativeItemSpec): this;
|
|
29
|
+
abstract setMarkType(): MarkType;
|
|
30
|
+
abstract parseScaleByEncode(channel: K, option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>): ScaleSpec | Nil;
|
|
31
|
+
abstract convertMarkEncode(encode: WithDefaultEncode<EncodeSpec, K>): GenerateBaseEncodeSpec<EncodeSpec>;
|
|
32
|
+
protected setDefaultDataTransform(): TransformSpec[];
|
|
33
|
+
protected setMultipleData(): DataSpec[];
|
|
34
|
+
protected setDefaultMarkTransform(): TransformSpec[];
|
|
35
|
+
protected convertMarkTransform(userTransform: TransformSpec[], defaultTransform?: TransformSpec[]): TransformSpec[];
|
|
36
|
+
protected convertMarkAnimation(): MarkAnimationSpec;
|
|
37
|
+
protected convertSimpleMarkEncode(encode: WithDefaultEncode<EncodeSpec, K>): ParsedSimpleEncode<EncodeSpec, K>;
|
|
38
|
+
protected getDataIdOfFiltered(): string;
|
|
39
|
+
protected getDataIdOfMain(): string;
|
|
40
|
+
protected getDataIdOfPlayer(): string;
|
|
41
|
+
protected getDataZoomScaleId(channel: string): {
|
|
42
|
+
x: string;
|
|
43
|
+
y: string;
|
|
44
|
+
};
|
|
45
|
+
protected getScaleId(channel: string): any;
|
|
46
|
+
protected getMarkId(): string;
|
|
47
|
+
protected getScaleSpec(scaleId: string): ScaleSpec;
|
|
48
|
+
protected parseScaleOfEncodeX(option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>): ScaleSpec | Nil;
|
|
49
|
+
protected parseScaleOfEncodeY(option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>): ScaleSpec | Nil;
|
|
50
|
+
protected parseScaleOfEncodeColor(option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>): ScaleSpec | Nil;
|
|
51
|
+
protected parseScaleOfEncodeGroup(option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>): ScaleSpec | Nil;
|
|
52
|
+
protected parseScaleOfCommonEncode(channel: K, option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>): ScaleSpec | Nil;
|
|
53
|
+
protected setDefaultAxis(): Record<string, Partial<AxisSpec>>;
|
|
54
|
+
protected parseAxisSpec(): AxisSpec[];
|
|
55
|
+
protected parseOption<T>(spec: {
|
|
56
|
+
option: T | boolean;
|
|
57
|
+
layout?: MarkRelativeItemSpec;
|
|
58
|
+
} | T | boolean): {
|
|
59
|
+
option: boolean | T;
|
|
60
|
+
layout: MarkRelativeItemSpec;
|
|
61
|
+
};
|
|
62
|
+
protected setDefaultLegend(): Record<string, Partial<LegendSpec>>;
|
|
63
|
+
protected parseLegendSpec(): LegendSpec[];
|
|
64
|
+
protected setDefaultCrosshair(): Record<string, Pick<CrosshairSpec, 'crosshairShape' | 'crosshairType'>>;
|
|
65
|
+
protected getVisualChannel(channel: 'x' | 'y'): 'x' | 'y' | 'angle' | 'radius';
|
|
66
|
+
protected parseCrosshairSpec(): CrosshairSpec[];
|
|
67
|
+
protected setDefaultTooltip(): SemanticTooltipOption | Nil;
|
|
68
|
+
protected parseTooltipSpec(): Array<TooltipSpec | DimensionTooltipSpec> | Nil;
|
|
69
|
+
protected setDefaultSlider(): Record<string, Partial<SliderSpec>>;
|
|
70
|
+
protected parseSliderSpec(): SliderSpec[];
|
|
71
|
+
protected setDefaultDataZoom(): Record<string, Partial<DatazoomSpec>>;
|
|
72
|
+
protected getVisiualPositionByDimension(channel: string): "left" | "bottom";
|
|
73
|
+
protected parseDataZoomSpec(): DatazoomSpec[];
|
|
74
|
+
protected setDefaultLabel(): Record<string, Partial<LabelSpec>>;
|
|
75
|
+
protected getLabelPosition(): string;
|
|
76
|
+
protected setLabelTextGetter(channel: string, option: SemanticLabelOption | boolean): ChannelEncodeType<ITextAttribute['text']>;
|
|
77
|
+
protected parseLabelSpec(): LabelSpec[];
|
|
78
|
+
protected setDefaultPlayer(): Record<string, Partial<PlayerSpec>>;
|
|
79
|
+
protected parsePlayerSpec(): PlayerSpec[];
|
|
80
|
+
protected parseDataSpec(): DataSpec[];
|
|
81
|
+
protected parseScaleSpec(): ScaleSpec[];
|
|
82
|
+
protected parseCoordinateSpec(): CoordinateSpec[];
|
|
83
|
+
protected setMainMarkEnterEncode(): Partial<any>;
|
|
84
|
+
protected setMainMarkSpec(): {};
|
|
85
|
+
protected setMultiMarksSpec(): MarkSpec[];
|
|
86
|
+
toViewSpec(): ViewSpec;
|
|
87
|
+
clear(): void;
|
|
88
|
+
}
|