@antv/gpt-vis 0.4.7 → 0.5.0-beta.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.
Files changed (76) hide show
  1. package/dist/cjs/ssr/area.d.ts +6 -0
  2. package/dist/cjs/ssr/area.js +64 -0
  3. package/dist/cjs/ssr/bar.d.ts +6 -0
  4. package/dist/cjs/ssr/bar.js +79 -0
  5. package/dist/cjs/ssr/column.d.ts +6 -0
  6. package/dist/cjs/ssr/column.js +77 -0
  7. package/dist/cjs/ssr/dual-axes.d.ts +6 -0
  8. package/dist/cjs/ssr/dual-axes.js +98 -0
  9. package/dist/cjs/ssr/fishbone-diagram.d.ts +6 -0
  10. package/dist/cjs/ssr/fishbone-diagram.js +189 -0
  11. package/dist/cjs/ssr/flow-diagram.d.ts +6 -0
  12. package/dist/cjs/ssr/flow-diagram.js +82 -0
  13. package/dist/cjs/ssr/histogram.d.ts +6 -0
  14. package/dist/cjs/ssr/histogram.js +50 -0
  15. package/dist/cjs/ssr/index.d.ts +2 -0
  16. package/dist/cjs/ssr/index.js +79 -0
  17. package/dist/cjs/ssr/line.d.ts +6 -0
  18. package/dist/cjs/ssr/line.js +62 -0
  19. package/dist/cjs/ssr/mind-map.d.ts +6 -0
  20. package/dist/cjs/ssr/mind-map.js +326 -0
  21. package/dist/cjs/ssr/network-graph.d.ts +6 -0
  22. package/dist/cjs/ssr/network-graph.js +72 -0
  23. package/dist/cjs/ssr/pie.d.ts +6 -0
  24. package/dist/cjs/ssr/pie.js +64 -0
  25. package/dist/cjs/ssr/radar.d.ts +6 -0
  26. package/dist/cjs/ssr/radar.js +92 -0
  27. package/dist/cjs/ssr/scatter.d.ts +6 -0
  28. package/dist/cjs/ssr/scatter.js +56 -0
  29. package/dist/cjs/ssr/treemap.d.ts +6 -0
  30. package/dist/cjs/ssr/treemap.js +57 -0
  31. package/dist/cjs/ssr/type.d.ts +30 -0
  32. package/dist/cjs/ssr/type.js +17 -0
  33. package/dist/cjs/ssr/word-cloud.d.ts +6 -0
  34. package/dist/cjs/ssr/word-cloud.js +48 -0
  35. package/dist/cjs/version.d.ts +1 -1
  36. package/dist/cjs/version.js +1 -1
  37. package/dist/esm/ssr/area.d.ts +6 -0
  38. package/dist/esm/ssr/area.js +67 -0
  39. package/dist/esm/ssr/bar.d.ts +6 -0
  40. package/dist/esm/ssr/bar.js +71 -0
  41. package/dist/esm/ssr/column.d.ts +6 -0
  42. package/dist/esm/ssr/column.js +65 -0
  43. package/dist/esm/ssr/dual-axes.d.ts +6 -0
  44. package/dist/esm/ssr/dual-axes.js +122 -0
  45. package/dist/esm/ssr/fishbone-diagram.d.ts +6 -0
  46. package/dist/esm/ssr/fishbone-diagram.js +195 -0
  47. package/dist/esm/ssr/flow-diagram.d.ts +6 -0
  48. package/dist/esm/ssr/flow-diagram.js +89 -0
  49. package/dist/esm/ssr/histogram.d.ts +6 -0
  50. package/dist/esm/ssr/histogram.js +56 -0
  51. package/dist/esm/ssr/index.d.ts +2 -0
  52. package/dist/esm/ssr/index.js +68 -0
  53. package/dist/esm/ssr/line.d.ts +6 -0
  54. package/dist/esm/ssr/line.js +61 -0
  55. package/dist/esm/ssr/mind-map.d.ts +6 -0
  56. package/dist/esm/ssr/mind-map.js +416 -0
  57. package/dist/esm/ssr/network-graph.d.ts +6 -0
  58. package/dist/esm/ssr/network-graph.js +79 -0
  59. package/dist/esm/ssr/pie.d.ts +6 -0
  60. package/dist/esm/ssr/pie.js +66 -0
  61. package/dist/esm/ssr/radar.d.ts +6 -0
  62. package/dist/esm/ssr/radar.js +88 -0
  63. package/dist/esm/ssr/scatter.d.ts +6 -0
  64. package/dist/esm/ssr/scatter.js +52 -0
  65. package/dist/esm/ssr/treemap.d.ts +6 -0
  66. package/dist/esm/ssr/treemap.js +51 -0
  67. package/dist/esm/ssr/type.d.ts +30 -0
  68. package/dist/esm/ssr/type.js +1 -0
  69. package/dist/esm/ssr/word-cloud.d.ts +6 -0
  70. package/dist/esm/ssr/word-cloud.js +40 -0
  71. package/dist/esm/version.d.ts +1 -1
  72. package/dist/esm/version.js +1 -1
  73. package/dist/umd/424.async.js +1 -0
  74. package/dist/umd/index.min.js +1 -1
  75. package/package.json +58 -31
  76. package/dist/umd/100.async.js +0 -1
@@ -0,0 +1,2 @@
1
+ import type { Options } from './type';
2
+ export declare function render(options: Options): Promise<import("@antv/g2-ssr").Chart>;
@@ -0,0 +1,79 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/ssr/index.ts
20
+ var ssr_exports = {};
21
+ __export(ssr_exports, {
22
+ render: () => render
23
+ });
24
+ module.exports = __toCommonJS(ssr_exports);
25
+ var import_area = require("./area");
26
+ var import_bar = require("./bar");
27
+ var import_column = require("./column");
28
+ var import_dual_axes = require("./dual-axes");
29
+ var import_fishbone_diagram = require("./fishbone-diagram");
30
+ var import_flow_diagram = require("./flow-diagram");
31
+ var import_histogram = require("./histogram");
32
+ var import_line = require("./line");
33
+ var import_mind_map = require("./mind-map");
34
+ var import_network_graph = require("./network-graph");
35
+ var import_pie = require("./pie");
36
+ var import_radar = require("./radar");
37
+ var import_scatter = require("./scatter");
38
+ var import_treemap = require("./treemap");
39
+ var import_word_cloud = require("./word-cloud");
40
+ async function render(options) {
41
+ switch (options.type) {
42
+ case "line":
43
+ return (0, import_line.Line)(options);
44
+ case "column":
45
+ return (0, import_column.Column)(options);
46
+ case "pie":
47
+ return (0, import_pie.Pie)(options);
48
+ case "area":
49
+ return (0, import_area.Area)(options);
50
+ case "bar":
51
+ return (0, import_bar.Bar)(options);
52
+ case "histogram":
53
+ return (0, import_histogram.Histogram)(options);
54
+ case "scatter":
55
+ return (0, import_scatter.Scatter)(options);
56
+ case "word-cloud":
57
+ return (0, import_word_cloud.WordCloud)(options);
58
+ case "treemap":
59
+ return (0, import_treemap.Treemap)(options);
60
+ case "dual-axes":
61
+ return (0, import_dual_axes.DualAxes)(options);
62
+ case "radar":
63
+ return (0, import_radar.Radar)(options);
64
+ case "mind-map":
65
+ return (0, import_mind_map.MindMap)(options);
66
+ case "network-graph":
67
+ return (0, import_network_graph.NetworkGraph)(options);
68
+ case "flow-diagram":
69
+ return (0, import_flow_diagram.FlowDiagram)(options);
70
+ case "fishbone-diagram":
71
+ return (0, import_fishbone_diagram.FishboneDiagram)(options);
72
+ default:
73
+ throw new Error(`Unknown chart type: ${options.type}`);
74
+ }
75
+ }
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ render
79
+ });
@@ -0,0 +1,6 @@
1
+ import { type LineProps } from '../export';
2
+ import { type BaseChartConfig } from './type';
3
+ export type LineOptions = BaseChartConfig & {
4
+ type: 'line';
5
+ } & LineProps;
6
+ export declare function Line(options: LineOptions): Promise<import("@antv/g2-ssr").Chart>;
@@ -0,0 +1,62 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/ssr/line.ts
20
+ var line_exports = {};
21
+ __export(line_exports, {
22
+ Line: () => Line
23
+ });
24
+ module.exports = __toCommonJS(line_exports);
25
+ var import_g2_ssr = require("@antv/g2-ssr");
26
+ async function Line(options) {
27
+ var _a;
28
+ const { data, title, width = 600, height = 400, axisYTitle, axisXTitle } = options;
29
+ const hasGroupField = ((_a = (data || [])[0]) == null ? void 0 : _a.group) !== void 0;
30
+ let encode = {};
31
+ if (hasGroupField) {
32
+ encode = { x: "time", y: "value", color: "group" };
33
+ } else {
34
+ encode = { x: "time", y: "value" };
35
+ }
36
+ return await (0, import_g2_ssr.createChart)({
37
+ type: "view",
38
+ title,
39
+ data,
40
+ width,
41
+ height,
42
+ encode,
43
+ style: { minHeight: 1 },
44
+ axis: {
45
+ y: {
46
+ title: axisYTitle || false
47
+ },
48
+ x: {
49
+ title: axisXTitle || false
50
+ }
51
+ },
52
+ children: [
53
+ {
54
+ type: "line"
55
+ }
56
+ ]
57
+ });
58
+ }
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ Line
62
+ });
@@ -0,0 +1,6 @@
1
+ import { type MindMapProps } from '../export';
2
+ import { type BaseChartConfig } from './type';
3
+ export type MindMapOptions = BaseChartConfig & {
4
+ type: 'mind-map';
5
+ } & MindMapProps;
6
+ export declare function MindMap(options: MindMapOptions): Promise<import("@antv/g6-ssr").Graph>;
@@ -0,0 +1,326 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/ssr/mind-map.ts
20
+ var mind_map_exports = {};
21
+ __export(mind_map_exports, {
22
+ MindMap: () => MindMap
23
+ });
24
+ module.exports = __toCommonJS(mind_map_exports);
25
+ var import_g = require("@antv/g");
26
+ var import_g6_ssr = require("@antv/g6-ssr");
27
+ var import_canvas = require("canvas");
28
+ var { register, BaseNode, BaseTransform, ExtensionCategory, idOf, positionOf, treeToGraphData } = import_g6_ssr.G6;
29
+ var canvas = null;
30
+ var ctx = null;
31
+ var measureText = (style) => {
32
+ if (!canvas) {
33
+ canvas = (0, import_canvas.createCanvas)(0, 0);
34
+ ctx = canvas.getContext("2d");
35
+ }
36
+ const font = [
37
+ style.fontStyle || "normal",
38
+ style.fontWeight || "normal",
39
+ `${style.fontSize || 12}px`,
40
+ style.fontFamily || "sans-serif"
41
+ ].join(" ");
42
+ ctx.font = font;
43
+ return ctx.measureText(style.text).width;
44
+ };
45
+ var RootNodeStyle = {
46
+ fill: "#EFF0F0",
47
+ labelFill: "#262626",
48
+ labelFontSize: 24,
49
+ labelFontWeight: 600,
50
+ labelOffsetY: 8,
51
+ labelPlacement: "center",
52
+ ports: [{ placement: "right" }, { placement: "left" }],
53
+ radius: 8
54
+ };
55
+ var NodeStyle = {
56
+ fill: "transparent",
57
+ labelPlacement: "center",
58
+ labelFontSize: 16,
59
+ ports: [{ placement: "right-bottom" }, { placement: "left-bottom" }]
60
+ };
61
+ var getNodeWidth = (nodeId, isRoot) => {
62
+ const padding = isRoot ? 40 : 30;
63
+ const nodeStyle = isRoot ? RootNodeStyle : NodeStyle;
64
+ return measureText({ text: nodeId, fontSize: nodeStyle.labelFontSize, fontFamily: "Gill Sans" }) + padding;
65
+ };
66
+ var getNodeSize = (nodeId, isRoot) => {
67
+ const width = getNodeWidth(nodeId, isRoot);
68
+ const height = isRoot ? 36 : 32;
69
+ return [width, height];
70
+ };
71
+ var MindmapNode = class extends BaseNode {
72
+ get childrenData() {
73
+ return this.context.model.getChildrenData(this.id);
74
+ }
75
+ get rootId() {
76
+ return idOf(this.context.model.getRootsData()[0]);
77
+ }
78
+ isShowCollapse(attributes) {
79
+ const { collapsed, showIcon } = attributes;
80
+ return !collapsed && showIcon && this.childrenData.length > 0;
81
+ }
82
+ getCollapseStyle(attributes) {
83
+ const { showIcon, color, direction } = attributes;
84
+ if (!this.isShowCollapse(attributes))
85
+ return false;
86
+ const [width, height] = this.getSize(attributes);
87
+ return {
88
+ backgroundFill: color,
89
+ backgroundHeight: 12,
90
+ backgroundWidth: 12,
91
+ cursor: "pointer",
92
+ fill: "#fff",
93
+ fontFamily: "iconfont",
94
+ fontSize: 8,
95
+ text: "",
96
+ textAlign: "center",
97
+ transform: direction === "left" ? [["rotate", 90]] : [["rotate", -90]],
98
+ visibility: showIcon ? "visible" : "hidden",
99
+ x: direction === "left" ? -6 : width + 6,
100
+ y: height
101
+ };
102
+ }
103
+ drawCollapseShape() {
104
+ }
105
+ getCountStyle(attributes) {
106
+ const { collapsed, color, direction } = attributes;
107
+ const count = this.context.model.getDescendantsData(this.id).length;
108
+ if (!collapsed || count === 0)
109
+ return false;
110
+ const [width, height] = this.getSize(attributes);
111
+ return {
112
+ backgroundFill: color,
113
+ backgroundHeight: 12,
114
+ backgroundWidth: 12,
115
+ cursor: "pointer",
116
+ fill: "#fff",
117
+ fontSize: 8,
118
+ text: count.toString(),
119
+ textAlign: "center",
120
+ x: direction === "left" ? -6 : width + 6,
121
+ y: height
122
+ };
123
+ }
124
+ drawCountShape() {
125
+ }
126
+ getAddStyle(attributes) {
127
+ const { collapsed, showIcon, direction } = attributes;
128
+ if (collapsed || !showIcon)
129
+ return false;
130
+ const [width, height] = this.getSize(attributes);
131
+ const color = "#ddd";
132
+ const offsetX = this.isShowCollapse(attributes) ? 24 : 12;
133
+ const isRoot = this.id === this.rootId;
134
+ return {
135
+ backgroundFill: "#fff",
136
+ backgroundHeight: 12,
137
+ backgroundLineWidth: 1,
138
+ backgroundStroke: color,
139
+ backgroundWidth: 12,
140
+ cursor: "pointer",
141
+ fill: color,
142
+ fontFamily: "iconfont",
143
+ fontSize: 8,
144
+ text: "",
145
+ textAlign: "center",
146
+ x: isRoot ? width + 12 : direction === "left" ? -offsetX : width + offsetX,
147
+ y: isRoot ? height / 2 : height
148
+ };
149
+ }
150
+ getAddBarStyle(attributes) {
151
+ const { collapsed, showIcon, direction, color = "#1783FF" } = attributes;
152
+ if (collapsed || !showIcon)
153
+ return false;
154
+ const [width, height] = this.getSize(attributes);
155
+ const offsetX = this.isShowCollapse(attributes) ? 12 : 0;
156
+ const isRoot = this.id === this.rootId;
157
+ const HEIGHT = 2;
158
+ const WIDTH = 6;
159
+ return {
160
+ cursor: "pointer",
161
+ fill: direction === "left" ? `linear-gradient(180deg, #fff 20%, ${color})` : `linear-gradient(0deg, #fff 20%, ${color})`,
162
+ height: HEIGHT,
163
+ width: WIDTH,
164
+ x: isRoot ? width : direction === "left" ? -offsetX - WIDTH : width + offsetX,
165
+ y: isRoot ? height / 2 - HEIGHT / 2 : height - HEIGHT / 2,
166
+ zIndex: -1
167
+ };
168
+ }
169
+ drawAddShape() {
170
+ }
171
+ forwardEvent() {
172
+ }
173
+ getKeyStyle(attributes) {
174
+ const [width, height] = this.getSize(attributes);
175
+ const keyShape = super.getKeyStyle(attributes);
176
+ return { width, height, ...keyShape };
177
+ }
178
+ drawKeyShape(attributes, container) {
179
+ const keyStyle = this.getKeyStyle(attributes);
180
+ return this.upsert("key", import_g.Rect, keyStyle, container);
181
+ }
182
+ render(attributes = this.parsedAttributes, container = this) {
183
+ super.render(attributes, container);
184
+ }
185
+ };
186
+ MindmapNode.defaultStyleProps = {
187
+ ...BaseNode.defaultStyleProps,
188
+ showIcon: false
189
+ };
190
+ var _AssignColorByBranch = class extends BaseTransform {
191
+ constructor(context, options) {
192
+ super(context, Object.assign({}, _AssignColorByBranch.defaultOptions, options));
193
+ }
194
+ beforeDraw(input) {
195
+ const nodes = this.context.model.getNodeData();
196
+ if (nodes.length === 0)
197
+ return input;
198
+ let colorIndex = 0;
199
+ const dfs = (nodeId, color) => {
200
+ var _a;
201
+ const node = nodes.find((datum) => datum.id == nodeId);
202
+ if (!node)
203
+ return;
204
+ node.style || (node.style = {});
205
+ node.style.color = color || this.options.colors[colorIndex++ % this.options.colors.length];
206
+ (_a = node.children) == null ? void 0 : _a.forEach((childId) => {
207
+ var _a2;
208
+ return dfs(childId, (_a2 = node.style) == null ? void 0 : _a2.color);
209
+ });
210
+ };
211
+ nodes.filter((node) => node.depth === 1).forEach((rootNode) => dfs(rootNode.id));
212
+ return input;
213
+ }
214
+ };
215
+ var AssignColorByBranch = _AssignColorByBranch;
216
+ AssignColorByBranch.defaultOptions = {
217
+ colors: [
218
+ "#1783FF",
219
+ "#F08F56",
220
+ "#D580FF",
221
+ "#00C9C9",
222
+ "#7863FF",
223
+ "#DB9D0D",
224
+ "#60C42D",
225
+ "#FF80CA",
226
+ "#2491B3",
227
+ "#17C76F"
228
+ ]
229
+ };
230
+ register(ExtensionCategory.NODE, "mindmap", MindmapNode);
231
+ register(ExtensionCategory.TRANSFORM, "assign-color-by-branch", AssignColorByBranch);
232
+ var getNodeSide = (nodeData, parentData) => {
233
+ if (!parentData)
234
+ return "center";
235
+ const nodePositionX = positionOf(nodeData)[0];
236
+ const parentPositionX = positionOf(parentData)[0];
237
+ return parentPositionX > nodePositionX ? "left" : "right";
238
+ };
239
+ function visTreeData2GraphData(data) {
240
+ return treeToGraphData(data, {
241
+ getNodeData: (datum, depth) => {
242
+ datum.id = datum.name;
243
+ datum.depth = depth;
244
+ if (!datum.children)
245
+ return datum;
246
+ const { children, ...restDatum } = datum;
247
+ return {
248
+ ...restDatum,
249
+ children: children.map((child) => child.name)
250
+ };
251
+ },
252
+ getEdgeData: (source, target) => ({
253
+ source: source.name,
254
+ target: target.name
255
+ })
256
+ });
257
+ }
258
+ async function MindMap(options) {
259
+ const { data, width, height } = options;
260
+ const dataParse = visTreeData2GraphData(data);
261
+ const rootId = data.name;
262
+ return await (0, import_g6_ssr.createGraph)({
263
+ waitForRender: 300,
264
+ width,
265
+ height,
266
+ data: dataParse,
267
+ padding: 24,
268
+ autoFit: {
269
+ type: "view"
270
+ },
271
+ node: {
272
+ type: "mindmap",
273
+ // @ts-ignore
274
+ style: function(d) {
275
+ var _a, _b, _c;
276
+ const direction = getNodeSide(d, this.getParentData(idOf(d), "tree"));
277
+ const isRoot = idOf(d) === rootId;
278
+ const depth = d.depth;
279
+ return {
280
+ direction,
281
+ labelText: idOf(d),
282
+ size: getNodeSize(idOf(d), isRoot),
283
+ labelFontFamily: "Gill Sans",
284
+ lineWidth: 2,
285
+ radius: 8,
286
+ stroke: depth === 0 ? "#f1f4f5" : (_a = d.style) == null ? void 0 : _a.color,
287
+ labelBackground: true,
288
+ labelBackgroundFill: "transparent",
289
+ labelPadding: direction === "left" ? [2, 0, 10, 40] : [2, 40, 10, 0],
290
+ ...isRoot ? RootNodeStyle : NodeStyle,
291
+ fill: depth === 0 ? "#f1f4f5" : depth === 1 ? (_b = d.style) == null ? void 0 : _b.color : "transparent",
292
+ labelFill: depth === 0 ? "#262626" : depth === 1 ? "#FFF" : (_c = d.style) == null ? void 0 : _c.color,
293
+ ports: [{ placement: "left" }, { placement: "right" }]
294
+ };
295
+ }
296
+ },
297
+ edge: {
298
+ type: "cubic-horizontal",
299
+ style: {
300
+ lineWidth: 1.5,
301
+ // @ts-ignore
302
+ stroke: function(data2) {
303
+ return this.getNodeData(data2.target).depth > 1 ? (
304
+ // @ts-ignore
305
+ this.getNodeData(data2.target).style.color
306
+ ) : "#99ADD1";
307
+ }
308
+ }
309
+ },
310
+ layout: {
311
+ type: "mindmap",
312
+ direction: "H",
313
+ getHeight: () => 30,
314
+ getWidth: (node) => getNodeWidth(node.id, node.id === rootId),
315
+ getVGap: () => 14,
316
+ getHGap: () => 64,
317
+ animation: false
318
+ },
319
+ transforms: ["assign-color-by-branch"],
320
+ animation: false
321
+ });
322
+ }
323
+ // Annotate the CommonJS export names for ESM import in node:
324
+ 0 && (module.exports = {
325
+ MindMap
326
+ });
@@ -0,0 +1,6 @@
1
+ import { type NetworkGraphProps } from '../export';
2
+ import { type BaseChartConfig } from './type';
3
+ export type NetworkGraphOptions = BaseChartConfig & {
4
+ type: 'network-graph';
5
+ } & NetworkGraphProps;
6
+ export declare function NetworkGraph(options: NetworkGraphOptions): Promise<import("@antv/g6-ssr").Graph>;
@@ -0,0 +1,72 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/ssr/network-graph.ts
20
+ var network_graph_exports = {};
21
+ __export(network_graph_exports, {
22
+ NetworkGraph: () => NetworkGraph
23
+ });
24
+ module.exports = __toCommonJS(network_graph_exports);
25
+ var import_g6_ssr = require("@antv/g6-ssr");
26
+ async function NetworkGraph(options) {
27
+ const { data, width = 600, height = 400 } = options;
28
+ const graphData = {
29
+ nodes: data.nodes.map((node) => ({ ...node, id: node.name })),
30
+ edges: data.edges.map((edge) => ({ ...edge, id: `${edge.source}-${edge.target}` }))
31
+ };
32
+ return await (0, import_g6_ssr.createGraph)({
33
+ data: graphData,
34
+ width,
35
+ height,
36
+ devicePixelRatio: 3,
37
+ autoFit: "view",
38
+ padding: 20,
39
+ animation: false,
40
+ node: {
41
+ type: "circle",
42
+ style: {
43
+ size: 20,
44
+ // @ts-ignore
45
+ labelText: (d) => d.name,
46
+ labelSize: 10,
47
+ labelFontSize: 10,
48
+ labelBackground: true
49
+ }
50
+ },
51
+ edge: {
52
+ style: {
53
+ // @ts-ignore
54
+ labelText: (d) => d.name,
55
+ labelFontSize: 10,
56
+ labelBackground: true,
57
+ endArrow: true
58
+ },
59
+ animation: { enter: false }
60
+ },
61
+ layout: {
62
+ type: "force-atlas2",
63
+ preventOverlap: true,
64
+ kr: 600
65
+ },
66
+ transforms: ["process-parallel-edges"]
67
+ });
68
+ }
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ NetworkGraph
72
+ });
@@ -0,0 +1,6 @@
1
+ import { type PieProps } from '../export';
2
+ import { type BaseChartConfig } from './type';
3
+ export type PieOptions = BaseChartConfig & {
4
+ type: 'pie';
5
+ } & PieProps;
6
+ export declare function Pie(options: PieOptions): Promise<import("@antv/g2-ssr").Chart>;
@@ -0,0 +1,64 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/ssr/pie.ts
20
+ var pie_exports = {};
21
+ __export(pie_exports, {
22
+ Pie: () => Pie
23
+ });
24
+ module.exports = __toCommonJS(pie_exports);
25
+ var import_g2_ssr = require("@antv/g2-ssr");
26
+ async function Pie(options) {
27
+ const { data, title, width, height, innerRadius } = options;
28
+ return await (0, import_g2_ssr.createChart)({
29
+ type: "interval",
30
+ title,
31
+ width,
32
+ height,
33
+ data,
34
+ encode: { y: "value", color: "category" },
35
+ transform: [{ type: "stackY" }],
36
+ coordinate: {
37
+ type: "theta",
38
+ outerRadius: 0.95,
39
+ innerRadius
40
+ },
41
+ style: {
42
+ radius: 4,
43
+ stroke: "#fff",
44
+ lineWidth: 1
45
+ },
46
+ labels: [
47
+ {
48
+ text: (data2) => `${data2.category}: ${data2.value}`,
49
+ position: "outside",
50
+ radius: 0.85,
51
+ fontSize: 12
52
+ }
53
+ ],
54
+ legend: {
55
+ color: { position: "bottom", layout: { justifyContent: "center" } }
56
+ },
57
+ animate: false,
58
+ axis: false
59
+ });
60
+ }
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ Pie
64
+ });
@@ -0,0 +1,6 @@
1
+ import { type RadarProps } from '../export';
2
+ import { type BaseChartConfig } from './type';
3
+ export type RadarOptions = BaseChartConfig & {
4
+ type: 'radar';
5
+ } & RadarProps;
6
+ export declare function Radar(options: RadarOptions): Promise<import("@antv/g2-ssr").Chart>;