@antv/gpt-vis 0.5.5 → 0.5.7
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/dist/cjs/Area/index.d.ts +2 -3
- package/dist/cjs/Area/index.js +48 -5
- package/dist/cjs/Bar/index.d.ts +5 -2
- package/dist/cjs/Bar/index.js +43 -7
- package/dist/cjs/Boxplot/index.d.ts +13 -0
- package/dist/cjs/Boxplot/index.js +88 -0
- package/dist/cjs/ChartCodeRender/VisChart.d.ts +7 -1
- package/dist/cjs/ChartCodeRender/VisChart.js +100 -12
- package/dist/cjs/ChartCodeRender/index.js +16 -2
- package/dist/cjs/ChartCodeRender/type.d.ts +104 -5
- package/dist/cjs/Column/index.d.ts +5 -3
- package/dist/cjs/Column/index.js +44 -7
- package/dist/cjs/ConfigProvider/hooks/useConfig.js +2 -1
- package/dist/cjs/DualAxes/index.d.ts +1 -1
- package/dist/cjs/DualAxes/index.js +20 -8
- package/dist/cjs/FishboneDiagram/index.d.ts +1 -0
- package/dist/cjs/FishboneDiagram/index.js +21 -7
- package/dist/cjs/Funnel/index.d.ts +12 -0
- package/dist/cjs/Funnel/index.js +173 -0
- package/dist/cjs/Histogram/index.d.ts +4 -3
- package/dist/cjs/Histogram/index.js +32 -3
- package/dist/cjs/IndentedTree/index.d.ts +1 -0
- package/dist/cjs/IndentedTree/index.js +32 -20
- package/dist/cjs/Line/index.d.ts +2 -3
- package/dist/cjs/Line/index.js +36 -3
- package/dist/cjs/Liquid/index.d.ts +11 -0
- package/dist/cjs/Liquid/index.js +85 -0
- package/dist/cjs/MindMap/index.d.ts +1 -0
- package/dist/cjs/MindMap/index.js +29 -21
- package/dist/cjs/Pie/index.d.ts +2 -2
- package/dist/cjs/Pie/index.js +22 -3
- package/dist/cjs/Radar/index.d.ts +5 -3
- package/dist/cjs/Radar/index.js +106 -37
- package/dist/cjs/Sankey/index.d.ts +12 -0
- package/dist/cjs/Sankey/index.js +106 -0
- package/dist/cjs/Scatter/index.d.ts +2 -3
- package/dist/cjs/Scatter/index.js +52 -6
- package/dist/cjs/Treemap/index.d.ts +2 -3
- package/dist/cjs/Treemap/index.js +23 -3
- package/dist/cjs/Venn/index.d.ts +32 -0
- package/dist/cjs/Venn/index.js +87 -0
- package/dist/cjs/Violin/index.d.ts +10 -0
- package/dist/cjs/Violin/index.js +185 -0
- package/dist/cjs/WordCloud/index.d.ts +2 -3
- package/dist/cjs/WordCloud/index.js +34 -7
- package/dist/cjs/export.d.ts +7 -1
- package/dist/cjs/export.js +38 -8
- package/dist/cjs/theme.d.ts +2 -0
- package/dist/cjs/theme.js +133 -0
- package/dist/cjs/types/chart.d.ts +17 -0
- package/dist/cjs/types/chart.js +6 -0
- package/dist/cjs/utils/palette.d.ts +2 -0
- package/dist/cjs/utils/palette.js +54 -0
- package/dist/cjs/utils/plot.d.ts +1 -0
- package/dist/cjs/utils/plot.js +15 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Area/index.d.ts +2 -3
- package/dist/esm/Area/index.js +80 -6
- package/dist/esm/Bar/index.d.ts +5 -2
- package/dist/esm/Bar/index.js +66 -9
- package/dist/esm/Boxplot/index.d.ts +13 -0
- package/dist/esm/Boxplot/index.js +83 -0
- package/dist/esm/ChartCodeRender/VisChart.d.ts +7 -1
- package/dist/esm/ChartCodeRender/VisChart.js +144 -34
- package/dist/esm/ChartCodeRender/index.js +15 -1
- package/dist/esm/ChartCodeRender/type.d.ts +104 -5
- package/dist/esm/Column/index.d.ts +5 -3
- package/dist/esm/Column/index.js +67 -9
- package/dist/esm/ConfigProvider/hooks/useConfig.js +9 -1
- package/dist/esm/DualAxes/index.d.ts +1 -1
- package/dist/esm/DualAxes/index.js +35 -12
- package/dist/esm/FishboneDiagram/index.d.ts +1 -0
- package/dist/esm/FishboneDiagram/index.js +23 -7
- package/dist/esm/Funnel/index.d.ts +12 -0
- package/dist/esm/Funnel/index.js +171 -0
- package/dist/esm/Histogram/index.d.ts +4 -3
- package/dist/esm/Histogram/index.js +55 -5
- package/dist/esm/IndentedTree/index.d.ts +1 -0
- package/dist/esm/IndentedTree/index.js +36 -29
- package/dist/esm/Line/index.d.ts +2 -3
- package/dist/esm/Line/index.js +63 -4
- package/dist/esm/Liquid/index.d.ts +11 -0
- package/dist/esm/Liquid/index.js +100 -0
- package/dist/esm/MindMap/index.d.ts +1 -0
- package/dist/esm/MindMap/index.js +37 -30
- package/dist/esm/Pie/index.d.ts +2 -2
- package/dist/esm/Pie/index.js +37 -4
- package/dist/esm/Radar/index.d.ts +5 -3
- package/dist/esm/Radar/index.js +138 -42
- package/dist/esm/Sankey/index.d.ts +12 -0
- package/dist/esm/Sankey/index.js +88 -0
- package/dist/esm/Scatter/index.d.ts +2 -3
- package/dist/esm/Scatter/index.js +76 -11
- package/dist/esm/Treemap/index.d.ts +2 -3
- package/dist/esm/Treemap/index.js +39 -4
- package/dist/esm/Venn/index.d.ts +32 -0
- package/dist/esm/Venn/index.js +69 -0
- package/dist/esm/Violin/index.d.ts +10 -0
- package/dist/esm/Violin/index.js +192 -0
- package/dist/esm/WordCloud/index.d.ts +2 -3
- package/dist/esm/WordCloud/index.js +51 -9
- package/dist/esm/export.d.ts +7 -1
- package/dist/esm/export.js +8 -2
- package/dist/esm/theme.d.ts +2 -0
- package/dist/esm/theme.js +103 -0
- package/dist/esm/types/chart.d.ts +17 -0
- package/dist/esm/types/chart.js +6 -0
- package/dist/esm/utils/palette.d.ts +2 -0
- package/dist/esm/utils/palette.js +2 -0
- package/dist/esm/utils/plot.d.ts +1 -0
- package/dist/esm/utils/plot.js +10 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/373.async.js +1 -0
- package/dist/umd/index.min.js +1 -1
- package/package.json +2 -1
- package/dist/umd/962.async.js +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ScatterConfig } from '@ant-design/plots';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import type { BasePlotProps } from '../types';
|
|
2
|
+
import type { BasePlotProps, Style, Theme } from '../types';
|
|
4
3
|
type ScatterDataItem = {
|
|
5
4
|
x: number;
|
|
6
5
|
y: number;
|
|
7
6
|
[key: string]: string | number;
|
|
8
7
|
};
|
|
9
|
-
export type ScatterProps = BasePlotProps<ScatterDataItem> &
|
|
8
|
+
export type ScatterProps = BasePlotProps<ScatterDataItem> & Theme & Style;
|
|
10
9
|
declare const Scatter: (props: ScatterProps) => React.JSX.Element;
|
|
11
10
|
export default Scatter;
|
|
@@ -36,22 +36,68 @@ var import_plots = require("@ant-design/plots");
|
|
|
36
36
|
var import_lodash = require("lodash");
|
|
37
37
|
var import_react = __toESM(require("react"));
|
|
38
38
|
var import_hooks = require("../ConfigProvider/hooks");
|
|
39
|
+
var import_theme = require("../theme");
|
|
39
40
|
var defaultConfig = (props) => {
|
|
40
|
-
|
|
41
|
+
var _a;
|
|
42
|
+
const { data, xField = "x", yField = "y", style = {} } = props;
|
|
43
|
+
const { backgroundColor, palette } = style;
|
|
41
44
|
const axisXTitle = (0, import_lodash.get)(props, "axis.x.title");
|
|
42
45
|
const axisYTitle = (0, import_lodash.get)(props, "axis.y.title");
|
|
46
|
+
const hasGroupField = ((_a = (data || [])[0]) == null ? void 0 : _a.group) !== void 0;
|
|
47
|
+
const hasPalette = !!(palette == null ? void 0 : palette[0]);
|
|
48
|
+
let paletteConfig = { color: void 0 };
|
|
49
|
+
let encode = {};
|
|
50
|
+
if (hasPalette) {
|
|
51
|
+
paletteConfig = {
|
|
52
|
+
color: {
|
|
53
|
+
range: palette
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (hasGroupField) {
|
|
58
|
+
encode = {
|
|
59
|
+
x: xField,
|
|
60
|
+
y: yField,
|
|
61
|
+
color: "group"
|
|
62
|
+
};
|
|
63
|
+
} else {
|
|
64
|
+
encode = {
|
|
65
|
+
x: xField,
|
|
66
|
+
y: yField,
|
|
67
|
+
color: () => "all"
|
|
68
|
+
};
|
|
69
|
+
}
|
|
43
70
|
return {
|
|
44
71
|
data,
|
|
45
72
|
xField,
|
|
46
73
|
yField,
|
|
47
|
-
tooltip:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
74
|
+
tooltip: {
|
|
75
|
+
title: (d) => (d == null ? void 0 : d.group) ? d.group : false,
|
|
76
|
+
items: [
|
|
77
|
+
{ channel: "x", name: axisXTitle || "x" },
|
|
78
|
+
{ channel: "y", name: axisYTitle || "y" }
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
legend: hasGroupField ? {} : false,
|
|
82
|
+
encode,
|
|
83
|
+
scale: {
|
|
84
|
+
y: {
|
|
85
|
+
nice: true
|
|
86
|
+
},
|
|
87
|
+
...paletteConfig
|
|
88
|
+
},
|
|
89
|
+
style: {
|
|
90
|
+
lineWidth: 1
|
|
91
|
+
},
|
|
92
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : { viewStyle: void 0 }
|
|
51
93
|
};
|
|
52
94
|
};
|
|
53
95
|
var Scatter = (props) => {
|
|
54
|
-
const
|
|
96
|
+
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
97
|
+
const config = (0, import_hooks.usePlotConfig)("Scatter", defaultConfig, {
|
|
98
|
+
...props,
|
|
99
|
+
theme: themeConfig
|
|
100
|
+
});
|
|
55
101
|
return /* @__PURE__ */ import_react.default.createElement(import_plots.Scatter, { ...config });
|
|
56
102
|
};
|
|
57
103
|
var Scatter_default = Scatter;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { TreemapConfig } from '@ant-design/plots';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import type { BasePlotProps } from '../types';
|
|
2
|
+
import type { BasePlotProps, Style, Theme } from '../types';
|
|
4
3
|
type TreeNode = {
|
|
5
4
|
name: string;
|
|
6
5
|
value: number;
|
|
7
6
|
children?: TreeNode[];
|
|
8
7
|
};
|
|
9
|
-
export type TreemapProps = BasePlotProps<TreeNode> &
|
|
8
|
+
export type TreemapProps = BasePlotProps<TreeNode> & Theme & Style;
|
|
10
9
|
declare const Treemap: (props: TreemapProps) => React.JSX.Element;
|
|
11
10
|
export default Treemap;
|
|
@@ -35,8 +35,19 @@ module.exports = __toCommonJS(Treemap_exports);
|
|
|
35
35
|
var import_plots = require("@ant-design/plots");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_hooks = require("../ConfigProvider/hooks");
|
|
38
|
+
var import_theme = require("../theme");
|
|
38
39
|
var defaultConfig = (props) => {
|
|
39
|
-
const { valueField = "value" } = props;
|
|
40
|
+
const { valueField = "value", style = {} } = props;
|
|
41
|
+
const { backgroundColor, palette } = style;
|
|
42
|
+
const hasPalette = !!(palette == null ? void 0 : palette[0]);
|
|
43
|
+
let paletteConfig = { color: void 0 };
|
|
44
|
+
if (hasPalette) {
|
|
45
|
+
paletteConfig = {
|
|
46
|
+
color: {
|
|
47
|
+
range: palette
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
40
51
|
return {
|
|
41
52
|
legend: false,
|
|
42
53
|
layout: {
|
|
@@ -55,7 +66,11 @@ var defaultConfig = (props) => {
|
|
|
55
66
|
}
|
|
56
67
|
]
|
|
57
68
|
},
|
|
58
|
-
style: { fillOpacity: 0.8, labelFontSize: 12 }
|
|
69
|
+
style: { fillOpacity: 0.8, labelFontSize: 12 },
|
|
70
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : { viewStyle: void 0 },
|
|
71
|
+
scale: {
|
|
72
|
+
...paletteConfig
|
|
73
|
+
}
|
|
59
74
|
};
|
|
60
75
|
};
|
|
61
76
|
var transform = (data) => {
|
|
@@ -65,9 +80,14 @@ var transform = (data) => {
|
|
|
65
80
|
};
|
|
66
81
|
};
|
|
67
82
|
var Treemap = (props) => {
|
|
68
|
-
const
|
|
83
|
+
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
84
|
+
const config = (0, import_hooks.usePlotConfig)("Treemap", defaultConfig, {
|
|
85
|
+
...props,
|
|
86
|
+
theme: themeConfig
|
|
87
|
+
});
|
|
69
88
|
const { data, ...others } = config;
|
|
70
89
|
const transformData = (0, import_react.useMemo)(() => transform(data), [data]);
|
|
90
|
+
console.log("treemap config:", config, props);
|
|
71
91
|
return /* @__PURE__ */ import_react.default.createElement(import_plots.Treemap, { ...others, data: transformData });
|
|
72
92
|
};
|
|
73
93
|
var Treemap_default = Treemap;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BasePlotProps, Style, Theme } from '../types';
|
|
3
|
+
type VennDatum = {
|
|
4
|
+
/**
|
|
5
|
+
* Label for the venn chart segment.
|
|
6
|
+
* This should be a string that describes the segment.
|
|
7
|
+
* For example, "A", "B", or "A ∩ B" for intersections.
|
|
8
|
+
* It is used to identify the segment in the chart.
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Value for the venn chart segment.
|
|
13
|
+
* This should be a number that represents the size or count of the segment.
|
|
14
|
+
* For example, if the segment represents a set of items, this could be the number of items in that set.
|
|
15
|
+
* It is used to determine the size of the segment in the chart.
|
|
16
|
+
* For intersections, this value should represent the count of items that belong to the intersection of sets.
|
|
17
|
+
* For example, if "A ∩ B" represents the intersection of sets A and B, this value should be the count of items that are in both sets.
|
|
18
|
+
*/
|
|
19
|
+
value: number;
|
|
20
|
+
/**
|
|
21
|
+
* Sets that the segment belongs to.
|
|
22
|
+
* This should be an array of strings representing the sets that the segment is part of.
|
|
23
|
+
* For example, if the segment represents items that belong to both set A and set B, this could be ['A', 'B'].
|
|
24
|
+
* It is used to determine how the segment is displayed in the venn chart.
|
|
25
|
+
* For intersections, this array should include the sets that contribute to the intersection.
|
|
26
|
+
* For example, if "A ∩ B" represents the intersection of sets A and B, this array should be ['A', 'B'].
|
|
27
|
+
*/
|
|
28
|
+
sets: string[] | number[];
|
|
29
|
+
};
|
|
30
|
+
export type VennProps = BasePlotProps<VennDatum> & Theme & Style;
|
|
31
|
+
declare const Venn: (props: VennProps) => React.JSX.Element;
|
|
32
|
+
export default Venn;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/Venn/index.tsx
|
|
30
|
+
var Venn_exports = {};
|
|
31
|
+
__export(Venn_exports, {
|
|
32
|
+
default: () => Venn_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Venn_exports);
|
|
35
|
+
var import_plots = require("@ant-design/plots");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_hooks = require("../ConfigProvider/hooks");
|
|
38
|
+
var import_theme = require("../theme");
|
|
39
|
+
var defaultConfig = (props) => {
|
|
40
|
+
const { data, style = {} } = props;
|
|
41
|
+
const { backgroundColor, palette } = style;
|
|
42
|
+
let paletteConfig = { color: void 0 };
|
|
43
|
+
const hasPalette = !!(palette == null ? void 0 : palette[0]);
|
|
44
|
+
if (hasPalette) {
|
|
45
|
+
paletteConfig = {
|
|
46
|
+
color: {
|
|
47
|
+
range: palette
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
data,
|
|
53
|
+
sizeField: "value",
|
|
54
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {},
|
|
55
|
+
labels: [
|
|
56
|
+
{
|
|
57
|
+
position: "inside",
|
|
58
|
+
text: (d) => d.label || "",
|
|
59
|
+
transform: [{ type: "contrastReverse" }],
|
|
60
|
+
fill: "#000",
|
|
61
|
+
fillOpacity: 0.85,
|
|
62
|
+
fontSize: 10
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
scale: {
|
|
66
|
+
...paletteConfig
|
|
67
|
+
},
|
|
68
|
+
tooltip: {
|
|
69
|
+
title: false,
|
|
70
|
+
items: [
|
|
71
|
+
(d) => {
|
|
72
|
+
return { name: d.key, value: d.size };
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
legend: false
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
var Venn = (props) => {
|
|
80
|
+
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
81
|
+
const config = (0, import_hooks.usePlotConfig)("Venn", defaultConfig, {
|
|
82
|
+
...props,
|
|
83
|
+
theme: themeConfig
|
|
84
|
+
});
|
|
85
|
+
return /* @__PURE__ */ import_react.default.createElement(import_plots.Venn, { ...config });
|
|
86
|
+
};
|
|
87
|
+
var Venn_default = Venn;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BasePlotProps, Style, Theme } from '../types';
|
|
3
|
+
type ViolinDatum = {
|
|
4
|
+
category: string;
|
|
5
|
+
value: number;
|
|
6
|
+
group?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ViolinProps = BasePlotProps<ViolinDatum> & Theme & Style;
|
|
9
|
+
declare const Violin: (props: ViolinProps) => React.JSX.Element;
|
|
10
|
+
export default Violin;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/Violin/index.tsx
|
|
30
|
+
var Violin_exports = {};
|
|
31
|
+
__export(Violin_exports, {
|
|
32
|
+
default: () => Violin_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Violin_exports);
|
|
35
|
+
var import_g2 = require("@antv/g2");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_theme = require("../theme");
|
|
38
|
+
var defaultConfig = (props) => {
|
|
39
|
+
var _a;
|
|
40
|
+
const { data, title, axisYTitle, axisXTitle, theme = "default", style = {} } = props;
|
|
41
|
+
const { backgroundColor, palette } = style;
|
|
42
|
+
const hasGroupField = ((_a = (data || [])[0]) == null ? void 0 : _a.group) !== void 0;
|
|
43
|
+
let encode = {};
|
|
44
|
+
let children = [];
|
|
45
|
+
if (hasGroupField) {
|
|
46
|
+
encode = {
|
|
47
|
+
x: "category",
|
|
48
|
+
y: "y",
|
|
49
|
+
color: "group",
|
|
50
|
+
series: "group",
|
|
51
|
+
size: "size"
|
|
52
|
+
};
|
|
53
|
+
children = [
|
|
54
|
+
{
|
|
55
|
+
type: "density",
|
|
56
|
+
data: {
|
|
57
|
+
transform: [{ type: "kde", field: "value", groupBy: ["category", "group"] }]
|
|
58
|
+
},
|
|
59
|
+
encode,
|
|
60
|
+
scale: {
|
|
61
|
+
y: {
|
|
62
|
+
nice: true
|
|
63
|
+
},
|
|
64
|
+
...(palette == null ? void 0 : palette[0]) ? {
|
|
65
|
+
color: {
|
|
66
|
+
range: palette
|
|
67
|
+
}
|
|
68
|
+
} : {}
|
|
69
|
+
},
|
|
70
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: "boxplot",
|
|
74
|
+
encode: {
|
|
75
|
+
x: "category",
|
|
76
|
+
y: "value",
|
|
77
|
+
series: "group",
|
|
78
|
+
color: "group",
|
|
79
|
+
shape: "violin"
|
|
80
|
+
},
|
|
81
|
+
style: { opacity: 0.5, strokeOpacity: 0.5, point: false },
|
|
82
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {},
|
|
83
|
+
scale: {
|
|
84
|
+
y: {
|
|
85
|
+
nice: true
|
|
86
|
+
},
|
|
87
|
+
...(palette == null ? void 0 : palette[0]) ? {
|
|
88
|
+
color: {
|
|
89
|
+
range: palette
|
|
90
|
+
}
|
|
91
|
+
} : {}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
} else {
|
|
96
|
+
encode = {
|
|
97
|
+
x: "category",
|
|
98
|
+
y: "y",
|
|
99
|
+
color: "category",
|
|
100
|
+
size: "size"
|
|
101
|
+
};
|
|
102
|
+
children = [
|
|
103
|
+
{
|
|
104
|
+
type: "density",
|
|
105
|
+
data: {
|
|
106
|
+
transform: [{ type: "kde", field: "value", groupBy: ["category"], size: 20 }]
|
|
107
|
+
},
|
|
108
|
+
encode,
|
|
109
|
+
scale: {
|
|
110
|
+
y: {
|
|
111
|
+
nice: true
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {},
|
|
115
|
+
tooltip: false
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: "boxplot",
|
|
119
|
+
encode: {
|
|
120
|
+
x: "category",
|
|
121
|
+
y: "value",
|
|
122
|
+
color: "category",
|
|
123
|
+
shape: "violin"
|
|
124
|
+
},
|
|
125
|
+
style: { opacity: 0.5, strokeOpacity: 0.5, point: false },
|
|
126
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {},
|
|
127
|
+
scale: {
|
|
128
|
+
y: {
|
|
129
|
+
nice: true
|
|
130
|
+
},
|
|
131
|
+
...(palette == null ? void 0 : palette[0]) ? {
|
|
132
|
+
color: {
|
|
133
|
+
range: palette
|
|
134
|
+
}
|
|
135
|
+
} : {}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
type: "view",
|
|
142
|
+
theme: import_theme.THEME_MAP[theme],
|
|
143
|
+
title,
|
|
144
|
+
autoFit: true,
|
|
145
|
+
data,
|
|
146
|
+
axis: {
|
|
147
|
+
y: {
|
|
148
|
+
title: axisYTitle || false
|
|
149
|
+
},
|
|
150
|
+
x: {
|
|
151
|
+
title: axisXTitle || false
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
children,
|
|
155
|
+
scale: {
|
|
156
|
+
y: {
|
|
157
|
+
nice: true
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {}
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
var Violin = (props) => {
|
|
164
|
+
const containerRef = (0, import_react.useRef)(null);
|
|
165
|
+
const chartRef = (0, import_react.useRef)(null);
|
|
166
|
+
(0, import_react.useEffect)(() => {
|
|
167
|
+
if (!containerRef.current)
|
|
168
|
+
return;
|
|
169
|
+
const chart = new import_g2.Chart({
|
|
170
|
+
container: containerRef.current,
|
|
171
|
+
autoFit: true,
|
|
172
|
+
padding: "auto"
|
|
173
|
+
});
|
|
174
|
+
const config = defaultConfig(props);
|
|
175
|
+
chart.options(config);
|
|
176
|
+
chart.render();
|
|
177
|
+
chartRef.current = chart;
|
|
178
|
+
return () => {
|
|
179
|
+
chart.destroy();
|
|
180
|
+
chartRef.current = null;
|
|
181
|
+
};
|
|
182
|
+
}, [props]);
|
|
183
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { ref: containerRef });
|
|
184
|
+
};
|
|
185
|
+
var Violin_default = Violin;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { WordCloudConfig } from '@ant-design/plots';
|
|
2
1
|
import { type FC } from 'react';
|
|
3
|
-
import type { BasePlotProps } from '../types';
|
|
2
|
+
import type { BasePlotProps, Style, Theme } from '../types';
|
|
4
3
|
type WordCloudDataItem = {
|
|
5
4
|
text: string;
|
|
6
5
|
value: number;
|
|
7
6
|
};
|
|
8
|
-
export type WordCloudProps = BasePlotProps<WordCloudDataItem> &
|
|
7
|
+
export type WordCloudProps = BasePlotProps<WordCloudDataItem> & Theme & Style;
|
|
9
8
|
declare const WordCloud: FC<WordCloudProps>;
|
|
10
9
|
export default WordCloud;
|
|
@@ -35,15 +35,42 @@ module.exports = __toCommonJS(WordCloud_exports);
|
|
|
35
35
|
var import_plots = require("@ant-design/plots");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_hooks = require("../ConfigProvider/hooks");
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
var import_theme = require("../theme");
|
|
39
|
+
var defaultConfig = (props) => {
|
|
40
|
+
const { data, style = {} } = props;
|
|
41
|
+
const { backgroundColor, palette } = style;
|
|
42
|
+
const hasPalette = !!(palette == null ? void 0 : palette[0]);
|
|
43
|
+
let paletteConfig = { color: void 0 };
|
|
44
|
+
if (hasPalette) {
|
|
45
|
+
paletteConfig = {
|
|
46
|
+
color: {
|
|
47
|
+
range: palette
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
data,
|
|
53
|
+
layout: { fontSize: [20, 100] },
|
|
54
|
+
colorField: "text",
|
|
55
|
+
legend: false,
|
|
56
|
+
tooltip: false,
|
|
57
|
+
encode: {
|
|
58
|
+
text: "text",
|
|
59
|
+
color: "text",
|
|
60
|
+
value: "value"
|
|
61
|
+
},
|
|
62
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : { viewStyle: void 0 },
|
|
63
|
+
scale: {
|
|
64
|
+
...paletteConfig
|
|
65
|
+
}
|
|
66
|
+
};
|
|
44
67
|
};
|
|
45
68
|
var WordCloud = (props) => {
|
|
46
|
-
const
|
|
69
|
+
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
70
|
+
const config = (0, import_hooks.usePlotConfig)("WordCloud", defaultConfig, {
|
|
71
|
+
...props,
|
|
72
|
+
theme: themeConfig
|
|
73
|
+
});
|
|
47
74
|
return /* @__PURE__ */ import_react.default.createElement(import_plots.WordCloud, { ...config });
|
|
48
75
|
};
|
|
49
76
|
var WordCloud_default = WordCloud;
|
package/dist/cjs/export.d.ts
CHANGED
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
/********** plot chart **********/
|
|
3
3
|
import { default as Area, type AreaProps } from './Area';
|
|
4
4
|
import { default as Bar, type BarProps } from './Bar';
|
|
5
|
+
import { default as Boxplot, type BoxplotProps } from './Boxplot';
|
|
5
6
|
import { default as Column, type ColumnProps } from './Column';
|
|
6
7
|
import { default as DualAxes, type DualAxesProps } from './DualAxes';
|
|
8
|
+
import { default as Funnel, type FunnelProps } from './Funnel';
|
|
7
9
|
import { default as Histogram, type HistogramProps } from './Histogram';
|
|
8
10
|
import { default as Line, type LineProps } from './Line';
|
|
11
|
+
import { default as Liquid, type LiquidProps } from './Liquid';
|
|
9
12
|
import { default as Pie, type PieProps } from './Pie';
|
|
10
13
|
import { default as Radar, type RadarProps } from './Radar';
|
|
14
|
+
import { default as Sankey, type SankeyProps } from './Sankey';
|
|
11
15
|
import { default as Scatter, type ScatterProps } from './Scatter';
|
|
12
16
|
import { default as Treemap, type TreemapProps } from './Treemap';
|
|
17
|
+
import { default as Venn, type VennProps } from './Venn';
|
|
18
|
+
import { default as Violin, type ViolinProps } from './Violin';
|
|
13
19
|
import { default as WordCloud, type WordCloudProps } from './WordCloud';
|
|
14
20
|
/********** graph chart **********/
|
|
15
21
|
import { default as FishboneDiagram, type FishboneDiagramProps } from './FishboneDiagram';
|
|
@@ -23,5 +29,5 @@ export { Map, type MapProps } from './export-map';
|
|
|
23
29
|
import { PinMap, type PinMapProps, HeatMap, type HeatMapProps, PathMap, type PathMapProps } from './export-map';
|
|
24
30
|
/********** NTV **********/
|
|
25
31
|
export { VisText, type VisTextProps } from './Text';
|
|
26
|
-
export { Area, Bar, Column, DualAxes, FishboneDiagram, FlowDiagram, HeatMap, Histogram, Line, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Scatter, Treemap, WordCloud, type AreaProps, type BarProps, type ColumnProps, type DualAxesProps, type FishboneDiagramProps, type FlowDiagramProps, type HeatMapProps, type HistogramProps, type LineProps, type MindMapProps, type NetworkGraphProps, type PathMapProps, type PieProps, type PinMapProps, type RadarProps, type ScatterProps, type TreemapProps, type WordCloudProps, };
|
|
32
|
+
export { Area, Bar, Boxplot, Column, DualAxes, FishboneDiagram, FlowDiagram, Funnel, HeatMap, Histogram, Line, Liquid, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Sankey, Scatter, Treemap, Venn, Violin, WordCloud, type AreaProps, type BarProps, type BoxplotProps, type ColumnProps, type DualAxesProps, type FishboneDiagramProps, type FlowDiagramProps, type FunnelProps, type HeatMapProps, type HistogramProps, type LineProps, type LiquidProps, type MindMapProps, type NetworkGraphProps, type PathMapProps, type PieProps, type PinMapProps, type RadarProps, type SankeyProps, type ScatterProps, type TreemapProps, type VennProps, type ViolinProps, type WordCloudProps, };
|
|
27
33
|
export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
|