@antv/gpt-vis 0.5.6 → 0.5.8
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.ja-JP.md +11 -11
- package/README.md +11 -11
- package/README.zh-CN.md +11 -11
- package/dist/cjs/Bar/index.d.ts +4 -1
- package/dist/cjs/Bar/index.js +7 -2
- package/dist/cjs/Boxplot/index.d.ts +13 -0
- package/dist/cjs/Boxplot/index.js +88 -0
- package/dist/cjs/ChartCodeRender/VisChart.js +1 -1
- package/dist/cjs/ChartCodeRender/styles.d.ts +5 -1
- package/dist/cjs/ChartCodeRender/styles.js +8 -1
- package/dist/cjs/Column/index.d.ts +4 -1
- package/dist/cjs/Column/index.js +8 -2
- package/dist/cjs/DualAxes/util.js +4 -1
- package/dist/cjs/Funnel/index.d.ts +12 -0
- package/dist/cjs/Funnel/index.js +173 -0
- package/dist/cjs/Liquid/index.d.ts +11 -0
- package/dist/cjs/Liquid/index.js +85 -0
- package/dist/cjs/Pie/index.d.ts +3 -1
- package/dist/cjs/Pie/index.js +3 -1
- package/dist/cjs/Sankey/index.d.ts +12 -0
- package/dist/cjs/Sankey/index.js +103 -0
- package/dist/cjs/Scatter/index.js +7 -4
- package/dist/cjs/Table/index.d.ts +9 -0
- package/dist/cjs/Table/index.js +91 -0
- package/dist/cjs/Treemap/index.js +1 -0
- 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/export.d.ts +10 -3
- package/dist/cjs/export.js +45 -9
- package/dist/cjs/types/chart.d.ts +20 -13
- package/dist/cjs/types/chart.js +19 -12
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Bar/index.d.ts +4 -1
- package/dist/esm/Bar/index.js +12 -2
- package/dist/esm/Boxplot/index.d.ts +13 -0
- package/dist/esm/Boxplot/index.js +83 -0
- package/dist/esm/ChartCodeRender/VisChart.js +2 -1
- package/dist/esm/ChartCodeRender/styles.d.ts +5 -1
- package/dist/esm/ChartCodeRender/styles.js +5 -2
- package/dist/esm/Column/index.d.ts +4 -1
- package/dist/esm/Column/index.js +13 -2
- package/dist/esm/DualAxes/util.js +4 -1
- package/dist/esm/Funnel/index.d.ts +12 -0
- package/dist/esm/Funnel/index.js +171 -0
- package/dist/esm/Liquid/index.d.ts +11 -0
- package/dist/esm/Liquid/index.js +100 -0
- package/dist/esm/Pie/index.d.ts +3 -1
- package/dist/esm/Pie/index.js +5 -1
- package/dist/esm/Sankey/index.d.ts +12 -0
- package/dist/esm/Sankey/index.js +85 -0
- package/dist/esm/Scatter/index.js +12 -7
- package/dist/esm/Table/index.d.ts +9 -0
- package/dist/esm/Table/index.js +30 -0
- package/dist/esm/Treemap/index.js +1 -0
- 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/export.d.ts +10 -3
- package/dist/esm/export.js +11 -4
- package/dist/esm/types/chart.d.ts +20 -13
- package/dist/esm/types/chart.js +19 -12
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/922.async.js +1 -0
- package/dist/umd/index.min.js +1 -1
- package/package.json +32 -30
- package/dist/umd/962.async.js +0 -1
package/README.ja-JP.md
CHANGED
|
@@ -13,7 +13,7 @@ GPTs、生成AI、およびLLMプロジェクトのためのコンポーネン
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://gpt-vis.antv.vision" target="_blank">ドキュメント</a> •
|
|
15
15
|
<a href="/knowledges" target="_blank">知識</a> •
|
|
16
|
-
<a href="https://tbox.
|
|
16
|
+
<a href="https://www.tbox.cn/share/202504APmv6c00373739?platform=WebService" target="_blank">エージェントデモ</a> •
|
|
17
17
|
<a href="https://github.com/antvis/mcp-server-chart" target="_blank">MCP Server</a>
|
|
18
18
|
</p>
|
|
19
19
|
</div>
|
|
@@ -48,16 +48,16 @@ const markdownContent = `
|
|
|
48
48
|
{
|
|
49
49
|
"type": "line",
|
|
50
50
|
"data": [
|
|
51
|
-
{ "time":2013,"value":59.3 },
|
|
52
|
-
{ "time":2014,"value":64.4 },
|
|
53
|
-
{ "time":2015,"value":68.9 },
|
|
54
|
-
{ "time":2016,"value":74.4 },
|
|
55
|
-
{ "time":2017,"value":82.7 },
|
|
56
|
-
{ "time":2018,"value":91.9 },
|
|
57
|
-
{ "time":2019,"value":99.1 },
|
|
58
|
-
{ "time":2020,"value":101.6 },
|
|
59
|
-
{ "time":2021,"value":114.4 },
|
|
60
|
-
{ "time":2022,"value":121 }
|
|
51
|
+
{ "time": "2013", "value": 59.3 },
|
|
52
|
+
{ "time": "2014", "value": 64.4 },
|
|
53
|
+
{ "time": "2015", "value": 68.9 },
|
|
54
|
+
{ "time": "2016", "value": 74.4 },
|
|
55
|
+
{ "time": "2017", "value": 82.7 },
|
|
56
|
+
{ "time": "2018", "value": 91.9 },
|
|
57
|
+
{ "time": "2019", "value": 99.1 },
|
|
58
|
+
{ "time": "2020", "value": 101.6 },
|
|
59
|
+
{ "time": "2021", "value": 114.4 },
|
|
60
|
+
{ "time": "2022", "value": 121 }
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
63
|
\`\`\`
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Components for GPTs, generative AI, and LLM projects. **Not only UI Components**
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://gpt-vis.antv.vision" target="_blank">Document</a> •
|
|
15
15
|
<a href="/knowledges" target="_blank">Knowledge</a> •
|
|
16
|
-
<a href="https://tbox.
|
|
16
|
+
<a href="https://www.tbox.cn/share/202504APmv6c00373739?platform=WebService" target="_blank">Agent Demo</a> •
|
|
17
17
|
<a href="https://github.com/antvis/mcp-server-chart" target="_blank">MCP Server</a>
|
|
18
18
|
</p>
|
|
19
19
|
</div>
|
|
@@ -50,16 +50,16 @@ Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022.
|
|
|
50
50
|
{
|
|
51
51
|
"type": "line",
|
|
52
52
|
"data": [
|
|
53
|
-
{ "time":2013,"value":59.3 },
|
|
54
|
-
{ "time":2014,"value":64.4 },
|
|
55
|
-
{ "time":2015,"value":68.9 },
|
|
56
|
-
{ "time":2016,"value":74.4 },
|
|
57
|
-
{ "time":2017,"value":82.7 },
|
|
58
|
-
{ "time":2018,"value":91.9 },
|
|
59
|
-
{ "time":2019,"value":99.1 },
|
|
60
|
-
{ "time":2020,"value":101.6 },
|
|
61
|
-
{ "time":2021,"value":114.4 },
|
|
62
|
-
{ "time":2022,"value":121 }
|
|
53
|
+
{ "time": "2013", "value": 59.3 },
|
|
54
|
+
{ "time": "2014", "value": 64.4 },
|
|
55
|
+
{ "time": "2015", "value": 68.9 },
|
|
56
|
+
{ "time": "2016", "value": 74.4 },
|
|
57
|
+
{ "time": "2017", "value": 82.7 },
|
|
58
|
+
{ "time": "2018", "value": 91.9 },
|
|
59
|
+
{ "time": "2019", "value": 99.1 },
|
|
60
|
+
{ "time": "2020", "value": 101.6 },
|
|
61
|
+
{ "time": "2021", "value": 114.4 },
|
|
62
|
+
{ "time": "2022", "value": 121 }
|
|
63
63
|
]
|
|
64
64
|
}
|
|
65
65
|
\`\`\`
|
package/README.zh-CN.md
CHANGED
|
@@ -13,7 +13,7 @@ Components for GPTs, generative AI, and LLM projects. **Not only UI Components**
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://gpt-vis.antv.vision" target="_blank">文档</a> •
|
|
15
15
|
<a href="/knowledges" target="_blank">知识库</a> •
|
|
16
|
-
<a href="https://tbox.
|
|
16
|
+
<a href="https://www.tbox.cn/share/202504APmv6c00373739?platform=WebService" target="_blank">体验 Agent</a> •
|
|
17
17
|
<a href="https://github.com/antvis/mcp-server-chart" target="_blank">MCP Server</a>
|
|
18
18
|
</p>
|
|
19
19
|
</div>
|
|
@@ -48,16 +48,16 @@ Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022.
|
|
|
48
48
|
{
|
|
49
49
|
"type": "line",
|
|
50
50
|
"data": [
|
|
51
|
-
{ "time":2013,"value":59.3 },
|
|
52
|
-
{ "time":2014,"value":64.4 },
|
|
53
|
-
{ "time":2015,"value":68.9 },
|
|
54
|
-
{ "time":2016,"value":74.4 },
|
|
55
|
-
{ "time":2017,"value":82.7 },
|
|
56
|
-
{ "time":2018,"value":91.9 },
|
|
57
|
-
{ "time":2019,"value":99.1 },
|
|
58
|
-
{ "time":2020,"value":101.6 },
|
|
59
|
-
{ "time":2021,"value":114.4 },
|
|
60
|
-
{ "time":2022,"value":121 }
|
|
51
|
+
{ "time": "2013", "value": 59.3 },
|
|
52
|
+
{ "time": "2014", "value": 64.4 },
|
|
53
|
+
{ "time": "2015", "value": 68.9 },
|
|
54
|
+
{ "time": "2016", "value": 74.4 },
|
|
55
|
+
{ "time": "2017", "value": 82.7 },
|
|
56
|
+
{ "time": "2018", "value": 91.9 },
|
|
57
|
+
{ "time": "2019", "value": 99.1 },
|
|
58
|
+
{ "time": "2020", "value": 101.6 },
|
|
59
|
+
{ "time": "2021", "value": 114.4 },
|
|
60
|
+
{ "time": "2022", "value": 121 }
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
63
|
\`\`\`
|
package/dist/cjs/Bar/index.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ type BarDataItem = {
|
|
|
6
6
|
value: number;
|
|
7
7
|
[key: string]: string | number;
|
|
8
8
|
};
|
|
9
|
-
export type BarProps = BasePlotProps<BarDataItem> & Partial<BarConfig> & Theme & Style
|
|
9
|
+
export type BarProps = BasePlotProps<BarDataItem> & Partial<BarConfig> & Theme & Style & {
|
|
10
|
+
group?: boolean;
|
|
11
|
+
stack?: boolean;
|
|
12
|
+
};
|
|
10
13
|
declare const Bar: (props: BarProps) => React.JSX.Element;
|
|
11
14
|
export default Bar;
|
package/dist/cjs/Bar/index.js
CHANGED
|
@@ -82,14 +82,19 @@ var defaultConfig = (props) => {
|
|
|
82
82
|
},
|
|
83
83
|
...paletteConfig
|
|
84
84
|
},
|
|
85
|
-
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : { viewStyle: void 0 }
|
|
85
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : { viewStyle: void 0 },
|
|
86
|
+
legend: hasGroupField ? {} : false
|
|
86
87
|
};
|
|
87
88
|
};
|
|
88
89
|
var Bar = (props) => {
|
|
89
90
|
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
91
|
+
const { data, group = false, stack = false } = props;
|
|
92
|
+
const hasGroupField = (0, import_lodash.get)(data, "[0].group") !== void 0;
|
|
90
93
|
const config = (0, import_hooks.usePlotConfig)("Bar", defaultConfig, {
|
|
91
94
|
...props,
|
|
92
|
-
theme: themeConfig
|
|
95
|
+
theme: themeConfig,
|
|
96
|
+
group: hasGroupField && group,
|
|
97
|
+
stack: hasGroupField && stack
|
|
93
98
|
});
|
|
94
99
|
return /* @__PURE__ */ import_react.default.createElement(import_plots.Bar, { ...config });
|
|
95
100
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BasePlotProps, Style, Theme } from '../types';
|
|
3
|
+
type BoxplotDatum = {
|
|
4
|
+
category: string;
|
|
5
|
+
value: number;
|
|
6
|
+
group?: string;
|
|
7
|
+
};
|
|
8
|
+
export type BoxplotProps = BasePlotProps<BoxplotDatum> & Theme & Style & {
|
|
9
|
+
xField?: string;
|
|
10
|
+
yField?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const Boxplot: (props: BoxplotProps) => React.JSX.Element;
|
|
13
|
+
export default Boxplot;
|
|
@@ -0,0 +1,88 @@
|
|
|
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/Boxplot/index.tsx
|
|
30
|
+
var Boxplot_exports = {};
|
|
31
|
+
__export(Boxplot_exports, {
|
|
32
|
+
default: () => Boxplot_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Boxplot_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
|
+
var _a;
|
|
41
|
+
const { data, style = {}, axisYTitle, axisXTitle, xField = "category", yField = "value" } = props;
|
|
42
|
+
const { backgroundColor, palette } = style;
|
|
43
|
+
const hasGroupField = ((_a = (data || [])[0]) == null ? void 0 : _a.group) !== void 0;
|
|
44
|
+
let paletteConfig = { color: void 0 };
|
|
45
|
+
const hasPalette = !!(palette == null ? void 0 : palette[0]);
|
|
46
|
+
const colorField = hasGroupField ? "group" : "category";
|
|
47
|
+
const seriesField = hasGroupField ? "group" : "category";
|
|
48
|
+
if (hasPalette) {
|
|
49
|
+
paletteConfig = {
|
|
50
|
+
color: {
|
|
51
|
+
range: palette
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
data,
|
|
57
|
+
boxType: "boxplot",
|
|
58
|
+
xField,
|
|
59
|
+
yField,
|
|
60
|
+
colorField,
|
|
61
|
+
seriesField,
|
|
62
|
+
axis: {
|
|
63
|
+
y: {
|
|
64
|
+
title: axisYTitle || false
|
|
65
|
+
},
|
|
66
|
+
x: {
|
|
67
|
+
title: axisXTitle || false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
scale: {
|
|
71
|
+
x: { paddingInner: 0.6, paddingOuter: 0.3 },
|
|
72
|
+
series: { paddingInner: 0.3, paddingOuter: 0.1 },
|
|
73
|
+
y: { nice: true },
|
|
74
|
+
...paletteConfig
|
|
75
|
+
},
|
|
76
|
+
style: { stroke: "black" },
|
|
77
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {}
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
var Boxplot = (props) => {
|
|
81
|
+
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
82
|
+
const config = (0, import_hooks.usePlotConfig)("Boxplot", defaultConfig, {
|
|
83
|
+
...props,
|
|
84
|
+
theme: themeConfig
|
|
85
|
+
});
|
|
86
|
+
return /* @__PURE__ */ import_react.default.createElement(import_plots.Box, { ...config });
|
|
87
|
+
};
|
|
88
|
+
var Boxplot_default = Boxplot;
|
|
@@ -274,7 +274,7 @@ var RenderVisChart = (0, import_react.memo)(
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
},
|
|
277
|
-
/* @__PURE__ */ import_react.default.createElement(import_styles.StyledGPTVis, { className: "gpt-vis" }, /* @__PURE__ */ import_react.default.createElement(import_styles.GlobalStyles, null), /* @__PURE__ */ import_react.default.createElement(import_styles.ChartWrapper, { ref: chartContainerRef }, /* @__PURE__ */ import_react.default.createElement(
|
|
277
|
+
/* @__PURE__ */ import_react.default.createElement(import_styles.StyledGPTVis, { className: "gpt-vis", type }, /* @__PURE__ */ import_react.default.createElement(import_styles.GlobalStyles, null), /* @__PURE__ */ import_react.default.createElement(import_styles.ChartWrapper, { ref: chartContainerRef }, /* @__PURE__ */ import_react.default.createElement(
|
|
278
278
|
ChartComponent,
|
|
279
279
|
{
|
|
280
280
|
...chartProps,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
interface StyledGPTVisProps {
|
|
3
|
+
type?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const StyledGPTVis: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledGPTVisProps>> & string;
|
|
3
6
|
export declare const TextButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
4
7
|
export declare const ChartWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
8
|
export declare const TabContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -13,3 +16,4 @@ export declare const StyledTabButton: import("styled-components/dist/types").ISt
|
|
|
13
16
|
active?: boolean | undefined;
|
|
14
17
|
}>> & string;
|
|
15
18
|
export declare const Divider: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
19
|
+
export {};
|
|
@@ -47,7 +47,8 @@ var import_styled_components = __toESM(require("styled-components"));
|
|
|
47
47
|
var StyledGPTVis = import_styled_components.default.div`
|
|
48
48
|
min-width: 300px;
|
|
49
49
|
max-width: 100%;
|
|
50
|
-
height: 300px;
|
|
50
|
+
height: ${({ type }) => type === "table" ? "auto" : "300px"};
|
|
51
|
+
/* height: 300px; */
|
|
51
52
|
overflow: hidden;
|
|
52
53
|
position: relative;
|
|
53
54
|
padding: 16px;
|
|
@@ -103,6 +104,12 @@ var TextButton = import_styled_components.default.button`
|
|
|
103
104
|
var ChartWrapper = import_styled_components.default.div`
|
|
104
105
|
width: 100%;
|
|
105
106
|
height: 100%;
|
|
107
|
+
overflow: scroll;
|
|
108
|
+
scrollbar-width: none;
|
|
109
|
+
-ms-overflow-style: none;
|
|
110
|
+
&::-webkit-scrollbar {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
106
113
|
|
|
107
114
|
h5 {
|
|
108
115
|
font-size: 12px;
|
|
@@ -5,6 +5,9 @@ export type ColumnDataItem = {
|
|
|
5
5
|
value: number;
|
|
6
6
|
[key: string]: string | number;
|
|
7
7
|
};
|
|
8
|
-
export type ColumnProps = BasePlotProps<ColumnDataItem> & Theme & Style
|
|
8
|
+
export type ColumnProps = BasePlotProps<ColumnDataItem> & Theme & Style & {
|
|
9
|
+
group?: boolean;
|
|
10
|
+
stack?: boolean;
|
|
11
|
+
};
|
|
9
12
|
declare const Column: (props: ColumnProps) => React.JSX.Element;
|
|
10
13
|
export default Column;
|
package/dist/cjs/Column/index.js
CHANGED
|
@@ -82,14 +82,20 @@ var defaultConfig = (props) => {
|
|
|
82
82
|
},
|
|
83
83
|
...paletteConfig
|
|
84
84
|
},
|
|
85
|
-
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : { viewStyle: void 0 }
|
|
85
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : { viewStyle: void 0 },
|
|
86
|
+
legend: hasGroupField ? {} : false,
|
|
87
|
+
group: hasGroupField
|
|
86
88
|
};
|
|
87
89
|
};
|
|
88
90
|
var Column = (props) => {
|
|
89
91
|
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
92
|
+
const { data, group = false, stack = false } = props;
|
|
93
|
+
const hasGroupField = (0, import_lodash.get)(data, "[0].group") !== void 0;
|
|
90
94
|
const config = (0, import_hooks.usePlotConfig)("Column", defaultConfig, {
|
|
91
95
|
...props,
|
|
92
|
-
theme: themeConfig
|
|
96
|
+
theme: themeConfig,
|
|
97
|
+
group: hasGroupField && group,
|
|
98
|
+
stack: hasGroupField && stack
|
|
93
99
|
});
|
|
94
100
|
return /* @__PURE__ */ import_react.default.createElement(import_plots.Column, { ...config });
|
|
95
101
|
};
|
|
@@ -24,7 +24,10 @@ __export(util_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(util_exports);
|
|
25
25
|
var import_types = require("../types");
|
|
26
26
|
function transform(series, categories) {
|
|
27
|
-
const newChildren = series.
|
|
27
|
+
const newChildren = series.sort((a, b) => {
|
|
28
|
+
const ORDER = ["column", "line"];
|
|
29
|
+
return ORDER.indexOf(a.type) - ORDER.indexOf(b.type);
|
|
30
|
+
}).map((item, index) => {
|
|
28
31
|
const { type, axisYTitle, ...others } = item;
|
|
29
32
|
const defaultYField = axisYTitle || `value_${index + 1}`;
|
|
30
33
|
const baseConfig = {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BasePlotProps, Style, Theme } from '../types';
|
|
3
|
+
type FunnelDatum = {
|
|
4
|
+
category: string;
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
export type FunnelProps = BasePlotProps<FunnelDatum> & Theme & Style & {
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
};
|
|
11
|
+
declare const Funnel: (props: FunnelProps) => React.JSX.Element;
|
|
12
|
+
export default Funnel;
|
|
@@ -0,0 +1,173 @@
|
|
|
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/Funnel/index.tsx
|
|
30
|
+
var Funnel_exports = {};
|
|
31
|
+
__export(Funnel_exports, {
|
|
32
|
+
default: () => Funnel_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Funnel_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
|
+
const { data, title, theme = "default", style = {} } = props;
|
|
40
|
+
const { backgroundColor, palette = [] } = style;
|
|
41
|
+
const r = (start, end) => `${(end / start * 100).toFixed(2)} %`;
|
|
42
|
+
return {
|
|
43
|
+
type: "view",
|
|
44
|
+
data,
|
|
45
|
+
theme: import_theme.THEME_MAP[theme],
|
|
46
|
+
title,
|
|
47
|
+
padding: 40,
|
|
48
|
+
insetRight: 28,
|
|
49
|
+
children: [
|
|
50
|
+
{
|
|
51
|
+
type: "interval",
|
|
52
|
+
data,
|
|
53
|
+
encode: { x: "category", y: "value", color: "category", shape: "funnel" },
|
|
54
|
+
transform: [{ type: "symmetryY" }],
|
|
55
|
+
scale: {
|
|
56
|
+
x: { padding: 0 },
|
|
57
|
+
...(palette == null ? void 0 : palette[0]) ? {
|
|
58
|
+
color: {
|
|
59
|
+
range: palette
|
|
60
|
+
}
|
|
61
|
+
} : {}
|
|
62
|
+
},
|
|
63
|
+
coordinate: { transform: [{ type: "transpose" }] },
|
|
64
|
+
legend: {
|
|
65
|
+
color: {
|
|
66
|
+
position: "top",
|
|
67
|
+
layout: {
|
|
68
|
+
justifyContent: "center"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
labels: [
|
|
73
|
+
{
|
|
74
|
+
text: (d) => `${d.category}
|
|
75
|
+
${d.value}`,
|
|
76
|
+
position: "inside",
|
|
77
|
+
transform: [{ type: "contrastReverse" }]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
text: (d, i) => i !== 0 ? "———" : "",
|
|
81
|
+
style: {
|
|
82
|
+
"font-size": "1px",
|
|
83
|
+
color: "#666",
|
|
84
|
+
"letter-spacing": "0px"
|
|
85
|
+
},
|
|
86
|
+
position: "top-right",
|
|
87
|
+
fill: "#666",
|
|
88
|
+
dx: 35,
|
|
89
|
+
dy: -8
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
text: (d, i) => i !== 0 ? "转化率" : "",
|
|
93
|
+
position: "top-right",
|
|
94
|
+
textAlign: "left",
|
|
95
|
+
textBaseline: "middle",
|
|
96
|
+
fill: "#666",
|
|
97
|
+
dx: 40
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
text: (d, i, data2) => i !== 0 ? r(data2[i - 1].value, data2[i].value) : "",
|
|
101
|
+
position: "top-right",
|
|
102
|
+
textAlign: "left",
|
|
103
|
+
textBaseline: "middle",
|
|
104
|
+
dx: 80
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: "connector",
|
|
111
|
+
data: [
|
|
112
|
+
{
|
|
113
|
+
startX: data[0].category,
|
|
114
|
+
startY: data[data.length - 1].category,
|
|
115
|
+
endX: 0,
|
|
116
|
+
endY: (data[0].value - data[data.length - 1].value) / 2
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
encode: { x: "startX", x1: "startY", y: "endX", y1: "endY" },
|
|
120
|
+
style: {
|
|
121
|
+
stroke: "#666",
|
|
122
|
+
markerEnd: false,
|
|
123
|
+
connectLength1: -12,
|
|
124
|
+
offset2: -20,
|
|
125
|
+
connectorStroke: "#0649f2",
|
|
126
|
+
lineDash: [12, 2]
|
|
127
|
+
},
|
|
128
|
+
labels: [
|
|
129
|
+
{
|
|
130
|
+
text: "转化率",
|
|
131
|
+
position: "left",
|
|
132
|
+
textAlign: "start",
|
|
133
|
+
textBaseline: "middle",
|
|
134
|
+
fill: "#666",
|
|
135
|
+
dx: 10
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
text: r(data[0].value, data[data.length - 1].value),
|
|
139
|
+
position: "left",
|
|
140
|
+
textAlign: "start",
|
|
141
|
+
dx: 50,
|
|
142
|
+
fill: "#000"
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
axis: false,
|
|
148
|
+
animate: false
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
var Funnel = (props) => {
|
|
152
|
+
const containerRef = (0, import_react.useRef)(null);
|
|
153
|
+
const chartRef = (0, import_react.useRef)(null);
|
|
154
|
+
(0, import_react.useEffect)(() => {
|
|
155
|
+
if (!containerRef.current)
|
|
156
|
+
return;
|
|
157
|
+
const chart = new import_g2.Chart({
|
|
158
|
+
container: containerRef.current,
|
|
159
|
+
autoFit: true,
|
|
160
|
+
padding: "auto"
|
|
161
|
+
});
|
|
162
|
+
const config = defaultConfig(props);
|
|
163
|
+
chart.options(config);
|
|
164
|
+
chart.render();
|
|
165
|
+
chartRef.current = chart;
|
|
166
|
+
return () => {
|
|
167
|
+
chart.destroy();
|
|
168
|
+
chartRef.current = null;
|
|
169
|
+
};
|
|
170
|
+
}, [props]);
|
|
171
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { ref: containerRef });
|
|
172
|
+
};
|
|
173
|
+
var Funnel_default = Funnel;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Style, Theme } from '../types';
|
|
3
|
+
export type LiquidProps = Theme & Style & {
|
|
4
|
+
percent: number;
|
|
5
|
+
shape?: 'rect' | 'circle' | 'pin' | 'triangle';
|
|
6
|
+
title?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
};
|
|
10
|
+
declare const Liquid: (props: LiquidProps) => React.JSX.Element;
|
|
11
|
+
export default Liquid;
|
|
@@ -0,0 +1,85 @@
|
|
|
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/Liquid/index.tsx
|
|
30
|
+
var Liquid_exports = {};
|
|
31
|
+
__export(Liquid_exports, {
|
|
32
|
+
default: () => Liquid_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Liquid_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 { percent, shape = "circle", style = {}, width = 600, height = 400 } = props;
|
|
41
|
+
const { backgroundColor, palette } = style;
|
|
42
|
+
const inferFontSize = Math.min(width, height) / 10;
|
|
43
|
+
const fontSize = Math.min(Math.max(inferFontSize, 24), 64);
|
|
44
|
+
const hasPalette = !!(palette == null ? void 0 : palette[0]);
|
|
45
|
+
let paletteConfig = { fill: void 0, outlineStroke: void 0 };
|
|
46
|
+
if (hasPalette) {
|
|
47
|
+
paletteConfig = { fill: palette[0], outlineStroke: palette[0] };
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
percent,
|
|
51
|
+
style: {
|
|
52
|
+
shape,
|
|
53
|
+
contentFontSize: fontSize,
|
|
54
|
+
contentFill: "#000",
|
|
55
|
+
contentStroke: "#fff",
|
|
56
|
+
contentLineWidth: 2,
|
|
57
|
+
outlineBorder: 4,
|
|
58
|
+
outlineDistance: 4,
|
|
59
|
+
waveLength: 128,
|
|
60
|
+
...paletteConfig
|
|
61
|
+
},
|
|
62
|
+
...backgroundColor ? { viewStyle: { viewFill: backgroundColor } } : {},
|
|
63
|
+
interaction: { tooltip: false },
|
|
64
|
+
animate: false
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
var Liquid = (props) => {
|
|
68
|
+
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
69
|
+
const containerRef = (0, import_react.useRef)(null);
|
|
70
|
+
const [size, setSize] = (0, import_react.useState)({ width: 0, height: 0 });
|
|
71
|
+
const config = (0, import_hooks.usePlotConfig)("Liquid", defaultConfig, {
|
|
72
|
+
...props,
|
|
73
|
+
theme: themeConfig,
|
|
74
|
+
width: size.width,
|
|
75
|
+
height: size.height
|
|
76
|
+
});
|
|
77
|
+
(0, import_react.useEffect)(() => {
|
|
78
|
+
if (containerRef.current) {
|
|
79
|
+
const { offsetWidth, offsetHeight } = containerRef.current;
|
|
80
|
+
setSize({ width: offsetWidth, height: offsetHeight });
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
83
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { ref: containerRef, style: { width: "100%", height: "100%" } }, /* @__PURE__ */ import_react.default.createElement(import_plots.Liquid, { ...config }));
|
|
84
|
+
};
|
|
85
|
+
var Liquid_default = Liquid;
|
package/dist/cjs/Pie/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ type PieDataItem = {
|
|
|
16
16
|
* the props for the Pie
|
|
17
17
|
* @param data pie data
|
|
18
18
|
*/
|
|
19
|
-
export type PieProps = BasePlotProps<PieDataItem> & Partial<PieConfig> & Theme
|
|
19
|
+
export type PieProps = BasePlotProps<PieDataItem> & Partial<PieConfig> & Theme & {
|
|
20
|
+
innerRadius?: number;
|
|
21
|
+
};
|
|
20
22
|
declare const Pie: (props: PieProps) => React.JSX.Element;
|
|
21
23
|
export default Pie;
|
package/dist/cjs/Pie/index.js
CHANGED
|
@@ -62,6 +62,7 @@ var defaultConfig = (props) => {
|
|
|
62
62
|
label: {
|
|
63
63
|
position: "outside",
|
|
64
64
|
// text: angleField,
|
|
65
|
+
transform: [{ type: "overlapHide" }],
|
|
65
66
|
text: (d) => `${d[colorField]}: ${(0, import_lodash.round)(d[angleField] / sumValue * 100, 1)}%`
|
|
66
67
|
},
|
|
67
68
|
legend: {
|
|
@@ -85,7 +86,8 @@ var Pie = (props) => {
|
|
|
85
86
|
const themeConfig = import_theme.THEME_MAP[props.theme ?? "default"];
|
|
86
87
|
const config = (0, import_hooks.usePlotConfig)("Pie", defaultConfig, {
|
|
87
88
|
...props,
|
|
88
|
-
theme: themeConfig
|
|
89
|
+
theme: themeConfig,
|
|
90
|
+
innerRadius: Math.max(0, Math.min(1, props.innerRadius || 0))
|
|
89
91
|
});
|
|
90
92
|
return /* @__PURE__ */ import_react.default.createElement(import_plots.Pie, { ...config });
|
|
91
93
|
};
|