@antv/g2plot 2.4.7 → 2.4.10
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/CHANGELOG.md +52 -0
- package/README.md +1 -1
- package/dist/g2plot.min.js +4 -4
- package/dist/g2plot.min.js.map +1 -1
- package/esm/core/plot.d.ts +2 -2
- package/esm/core/plot.js +4 -3
- package/esm/core/plot.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/plots/area/types.d.ts +35 -10
- package/esm/plots/area/types.js.map +1 -1
- package/esm/plots/bar/types.d.ts +16 -3
- package/esm/plots/bar/types.js.map +1 -1
- package/esm/plots/bidirectional-bar/types.d.ts +21 -6
- package/esm/plots/bidirectional-bar/types.js.map +1 -1
- package/esm/plots/box/types.d.ts +20 -6
- package/esm/plots/box/types.js.map +1 -1
- package/esm/plots/bullet/types.d.ts +36 -9
- package/esm/plots/bullet/types.js.map +1 -1
- package/esm/plots/chord/types.d.ts +14 -10
- package/esm/plots/chord/types.js.map +1 -1
- package/esm/plots/circle-packing/types.d.ts +25 -8
- package/esm/plots/circle-packing/types.js.map +1 -1
- package/esm/plots/column/types.d.ts +57 -16
- package/esm/plots/column/types.js.map +1 -1
- package/esm/plots/dual-axes/types.d.ts +31 -6
- package/esm/plots/dual-axes/types.js.map +1 -1
- package/esm/plots/dual-axes/util/render-sider.js +1 -1
- package/esm/plots/dual-axes/util/render-sider.js.map +1 -1
- package/esm/plots/facet/types.d.ts +54 -34
- package/esm/plots/facet/types.js.map +1 -1
- package/esm/plots/funnel/geometries/compare.js +2 -1
- package/esm/plots/funnel/geometries/compare.js.map +1 -1
- package/esm/plots/funnel/geometries/facet.js +2 -1
- package/esm/plots/funnel/geometries/facet.js.map +1 -1
- package/esm/plots/funnel/types.d.ts +45 -11
- package/esm/plots/funnel/types.js.map +1 -1
- package/esm/plots/gauge/types.d.ts +83 -21
- package/esm/plots/gauge/types.js.map +1 -1
- package/esm/plots/heatmap/types.d.ts +47 -12
- package/esm/plots/heatmap/types.js.map +1 -1
- package/esm/plots/histogram/types.d.ts +17 -6
- package/esm/plots/histogram/types.js.map +1 -1
- package/esm/plots/line/types.d.ts +42 -12
- package/esm/plots/line/types.js.map +1 -1
- package/esm/plots/liquid/index.d.ts +1 -0
- package/esm/plots/liquid/index.js +1 -0
- package/esm/plots/liquid/index.js.map +1 -1
- package/esm/plots/liquid/shapes/liquid.d.ts +16 -1
- package/esm/plots/liquid/shapes/liquid.js +13 -8
- package/esm/plots/liquid/shapes/liquid.js.map +1 -1
- package/esm/plots/liquid/types.d.ts +56 -16
- package/esm/plots/liquid/types.js.map +1 -1
- package/esm/plots/mix/types.d.ts +31 -22
- package/esm/plots/mix/types.js.map +1 -1
- package/esm/plots/pie/types.d.ts +27 -10
- package/esm/plots/pie/types.js.map +1 -1
- package/esm/plots/progress/types.d.ts +13 -4
- package/esm/plots/progress/types.js.map +1 -1
- package/esm/plots/radar/types.d.ts +39 -12
- package/esm/plots/radar/types.js.map +1 -1
- package/esm/plots/radial-bar/types.d.ts +39 -12
- package/esm/plots/radial-bar/types.js.map +1 -1
- package/esm/plots/ring-progress/types.d.ts +18 -6
- package/esm/plots/ring-progress/types.js.map +1 -1
- package/esm/plots/rose/types.d.ts +32 -12
- package/esm/plots/rose/types.js.map +1 -1
- package/esm/plots/sankey/adaptor.js +31 -2
- package/esm/plots/sankey/adaptor.js.map +1 -1
- package/esm/plots/sankey/types.d.ts +57 -30
- package/esm/plots/sankey/types.js.map +1 -1
- package/esm/plots/scatter/types.d.ts +76 -22
- package/esm/plots/scatter/types.js.map +1 -1
- package/esm/plots/stock/types.d.ts +20 -7
- package/esm/plots/stock/types.js.map +1 -1
- package/esm/plots/sunburst/types.d.ts +40 -12
- package/esm/plots/sunburst/types.js.map +1 -1
- package/esm/plots/tiny-area/types.d.ts +16 -5
- package/esm/plots/tiny-area/types.js.map +1 -1
- package/esm/plots/tiny-column/types.d.ts +10 -3
- package/esm/plots/tiny-column/types.js.map +1 -1
- package/esm/plots/tiny-line/types.d.ts +17 -5
- package/esm/plots/tiny-line/types.js.map +1 -1
- package/esm/plots/treemap/types.d.ts +17 -6
- package/esm/plots/treemap/types.js.map +1 -1
- package/esm/plots/venn/types.d.ts +20 -6
- package/esm/plots/venn/types.js.map +1 -1
- package/esm/plots/violin/types.d.ts +52 -17
- package/esm/plots/violin/types.js.map +1 -1
- package/esm/plots/waterfall/types.d.ts +42 -10
- package/esm/plots/waterfall/types.js.map +1 -1
- package/esm/plots/word-cloud/types.d.ts +91 -44
- package/esm/plots/word-cloud/types.js.map +1 -1
- package/esm/types/button.d.ts +8 -4
- package/esm/types/button.js.map +1 -1
- package/esm/types/common.d.ts +145 -33
- package/esm/types/common.js.map +1 -1
- package/esm/types/drill-down.d.ts +28 -7
- package/esm/types/drill-down.js.map +1 -1
- package/esm/types/interaction.d.ts +26 -6
- package/esm/types/interaction.js.map +1 -1
- package/esm/types/label.d.ts +11 -3
- package/esm/types/label.js.map +1 -1
- package/esm/types/meta.d.ts +4 -7
- package/esm/types/meta.js.map +1 -1
- package/esm/types/pattern.d.ts +58 -18
- package/esm/types/pattern.js.map +1 -1
- package/esm/types/state.d.ts +11 -3
- package/esm/types/state.js.map +1 -1
- package/esm/types/statistic.d.ts +38 -6
- package/esm/types/statistic.js.map +1 -1
- package/esm/types/tooltip.d.ts +7 -2
- package/esm/types/tooltip.js.map +1 -1
- package/esm/utils/transform/percent.js +2 -2
- package/esm/utils/transform/percent.js.map +1 -1
- package/lib/core/plot.d.ts +2 -2
- package/lib/core/plot.js +4 -3
- package/lib/core/plot.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/area/types.d.ts +35 -10
- package/lib/plots/area/types.js.map +1 -1
- package/lib/plots/bar/types.d.ts +16 -3
- package/lib/plots/bar/types.js.map +1 -1
- package/lib/plots/bidirectional-bar/types.d.ts +21 -6
- package/lib/plots/bidirectional-bar/types.js.map +1 -1
- package/lib/plots/box/types.d.ts +20 -6
- package/lib/plots/box/types.js.map +1 -1
- package/lib/plots/bullet/types.d.ts +36 -9
- package/lib/plots/bullet/types.js.map +1 -1
- package/lib/plots/chord/types.d.ts +14 -10
- package/lib/plots/chord/types.js.map +1 -1
- package/lib/plots/circle-packing/types.d.ts +25 -8
- package/lib/plots/circle-packing/types.js.map +1 -1
- package/lib/plots/column/types.d.ts +57 -16
- package/lib/plots/column/types.js.map +1 -1
- package/lib/plots/dual-axes/types.d.ts +31 -6
- package/lib/plots/dual-axes/types.js.map +1 -1
- package/lib/plots/dual-axes/util/render-sider.js +1 -1
- package/lib/plots/dual-axes/util/render-sider.js.map +1 -1
- package/lib/plots/facet/types.d.ts +54 -34
- package/lib/plots/facet/types.js.map +1 -1
- package/lib/plots/funnel/geometries/compare.js +2 -1
- package/lib/plots/funnel/geometries/compare.js.map +1 -1
- package/lib/plots/funnel/geometries/facet.js +2 -1
- package/lib/plots/funnel/geometries/facet.js.map +1 -1
- package/lib/plots/funnel/types.d.ts +45 -11
- package/lib/plots/funnel/types.js.map +1 -1
- package/lib/plots/gauge/types.d.ts +83 -21
- package/lib/plots/gauge/types.js.map +1 -1
- package/lib/plots/heatmap/types.d.ts +47 -12
- package/lib/plots/heatmap/types.js.map +1 -1
- package/lib/plots/histogram/types.d.ts +17 -6
- package/lib/plots/histogram/types.js.map +1 -1
- package/lib/plots/line/types.d.ts +42 -12
- package/lib/plots/line/types.js.map +1 -1
- package/lib/plots/liquid/index.d.ts +1 -0
- package/lib/plots/liquid/index.js +2 -0
- package/lib/plots/liquid/index.js.map +1 -1
- package/lib/plots/liquid/shapes/liquid.d.ts +16 -1
- package/lib/plots/liquid/shapes/liquid.js +14 -7
- package/lib/plots/liquid/shapes/liquid.js.map +1 -1
- package/lib/plots/liquid/types.d.ts +56 -16
- package/lib/plots/liquid/types.js.map +1 -1
- package/lib/plots/mix/types.d.ts +31 -22
- package/lib/plots/mix/types.js.map +1 -1
- package/lib/plots/pie/types.d.ts +27 -10
- package/lib/plots/pie/types.js.map +1 -1
- package/lib/plots/progress/types.d.ts +13 -4
- package/lib/plots/progress/types.js.map +1 -1
- package/lib/plots/radar/types.d.ts +39 -12
- package/lib/plots/radar/types.js.map +1 -1
- package/lib/plots/radial-bar/types.d.ts +39 -12
- package/lib/plots/radial-bar/types.js.map +1 -1
- package/lib/plots/ring-progress/types.d.ts +18 -6
- package/lib/plots/ring-progress/types.js.map +1 -1
- package/lib/plots/rose/types.d.ts +32 -12
- package/lib/plots/rose/types.js.map +1 -1
- package/lib/plots/sankey/adaptor.js +30 -1
- package/lib/plots/sankey/adaptor.js.map +1 -1
- package/lib/plots/sankey/types.d.ts +57 -30
- package/lib/plots/sankey/types.js.map +1 -1
- package/lib/plots/scatter/types.d.ts +76 -22
- package/lib/plots/scatter/types.js.map +1 -1
- package/lib/plots/stock/types.d.ts +20 -7
- package/lib/plots/stock/types.js.map +1 -1
- package/lib/plots/sunburst/types.d.ts +40 -12
- package/lib/plots/sunburst/types.js.map +1 -1
- package/lib/plots/tiny-area/types.d.ts +16 -5
- package/lib/plots/tiny-area/types.js.map +1 -1
- package/lib/plots/tiny-column/types.d.ts +10 -3
- package/lib/plots/tiny-column/types.js.map +1 -1
- package/lib/plots/tiny-line/types.d.ts +17 -5
- package/lib/plots/tiny-line/types.js.map +1 -1
- package/lib/plots/treemap/types.d.ts +17 -6
- package/lib/plots/treemap/types.js.map +1 -1
- package/lib/plots/venn/types.d.ts +20 -6
- package/lib/plots/venn/types.js.map +1 -1
- package/lib/plots/violin/types.d.ts +52 -17
- package/lib/plots/violin/types.js.map +1 -1
- package/lib/plots/waterfall/types.d.ts +42 -10
- package/lib/plots/waterfall/types.js.map +1 -1
- package/lib/plots/word-cloud/types.d.ts +91 -44
- package/lib/plots/word-cloud/types.js.map +1 -1
- package/lib/types/button.d.ts +8 -4
- package/lib/types/button.js.map +1 -1
- package/lib/types/common.d.ts +145 -33
- package/lib/types/common.js.map +1 -1
- package/lib/types/drill-down.d.ts +28 -7
- package/lib/types/drill-down.js.map +1 -1
- package/lib/types/interaction.d.ts +26 -6
- package/lib/types/interaction.js.map +1 -1
- package/lib/types/label.d.ts +11 -3
- package/lib/types/label.js.map +1 -1
- package/lib/types/meta.d.ts +4 -7
- package/lib/types/meta.js.map +1 -1
- package/lib/types/pattern.d.ts +58 -18
- package/lib/types/pattern.js.map +1 -1
- package/lib/types/state.d.ts +11 -3
- package/lib/types/state.js.map +1 -1
- package/lib/types/statistic.d.ts +38 -6
- package/lib/types/statistic.js.map +1 -1
- package/lib/types/tooltip.d.ts +7 -2
- package/lib/types/tooltip.js.map +1 -1
- package/lib/utils/transform/percent.js +2 -2
- package/lib/utils/transform/percent.js.map +1 -1
- package/package.json +1 -1
- package/src/core/plot.ts +5 -4
- package/src/index.ts +2 -2
- package/src/plots/area/types.ts +35 -10
- package/src/plots/bar/types.ts +16 -3
- package/src/plots/bidirectional-bar/types.ts +21 -6
- package/src/plots/box/types.ts +20 -6
- package/src/plots/bullet/types.ts +36 -17
- package/src/plots/chord/types.ts +14 -11
- package/src/plots/circle-packing/types.ts +25 -14
- package/src/plots/column/types.ts +57 -20
- package/src/plots/dual-axes/types.ts +31 -16
- package/src/plots/dual-axes/util/render-sider.ts +1 -1
- package/src/plots/facet/types.ts +54 -49
- package/src/plots/funnel/geometries/compare.ts +2 -0
- package/src/plots/funnel/geometries/facet.ts +2 -1
- package/src/plots/funnel/types.ts +45 -14
- package/src/plots/gauge/types.ts +86 -27
- package/src/plots/heatmap/types.ts +49 -14
- package/src/plots/histogram/types.ts +17 -9
- package/src/plots/line/types.ts +42 -14
- package/src/plots/liquid/index.ts +2 -0
- package/src/plots/liquid/shapes/liquid.ts +16 -8
- package/src/plots/liquid/types.ts +56 -16
- package/src/plots/mix/types.ts +31 -35
- package/src/plots/pie/types.ts +27 -10
- package/src/plots/progress/types.ts +13 -4
- package/src/plots/radar/types.ts +39 -12
- package/src/plots/radial-bar/types.ts +39 -12
- package/src/plots/ring-progress/types.ts +18 -6
- package/src/plots/rose/types.ts +32 -12
- package/src/plots/sankey/adaptor.ts +35 -2
- package/src/plots/sankey/types.ts +58 -30
- package/src/plots/scatter/types.ts +77 -24
- package/src/plots/stock/types.ts +21 -8
- package/src/plots/sunburst/types.ts +42 -12
- package/src/plots/tiny-area/types.ts +16 -5
- package/src/plots/tiny-column/types.ts +10 -3
- package/src/plots/tiny-line/types.ts +17 -5
- package/src/plots/treemap/types.ts +17 -7
- package/src/plots/venn/types.ts +21 -6
- package/src/plots/violin/types.ts +52 -17
- package/src/plots/waterfall/types.ts +42 -10
- package/src/plots/word-cloud/types.ts +91 -44
- package/src/types/button.ts +8 -4
- package/src/types/common.ts +145 -37
- package/src/types/drill-down.ts +28 -7
- package/src/types/interaction.ts +26 -6
- package/src/types/label.ts +11 -3
- package/src/types/meta.ts +4 -7
- package/src/types/pattern.ts +58 -18
- package/src/types/state.ts +11 -3
- package/src/types/statistic.ts +38 -6
- package/src/types/tooltip.ts +7 -2
- package/src/utils/transform/percent.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/circle-packing/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorAttr, Options, StyleAttr } from '../../types';\nimport { DrillDownCfg } from '../../types/drill-down';\nimport { HierarchyOption } from '../../utils/hierarchy/types';\n\nexport interface CirclePackingOptions extends Omit<Options, 'data'> {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/circle-packing/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorAttr, Options, StyleAttr } from '../../types';\nimport { DrillDownCfg } from '../../types/drill-down';\nimport { HierarchyOption } from '../../utils/hierarchy/types';\n\nexport interface CirclePackingOptions extends Omit<Options, 'data'> {\n /**\n * @title 数据字段\n */\n readonly data?: Record<string, any>;\n /**\n * @title 层级布局配置\n */\n readonly hierarchyConfig?: Omit<HierarchyOption, 'as' | 'type' | 'field'>;\n /**\n * @title 颜色字段\n */\n readonly colorField?: string;\n /**\n * @title 颜色\n */\n readonly color?: ColorAttr;\n /**\n * @title 大小字段\n */\n readonly sizeField?: string;\n /**\n * @title 源字段\n */\n readonly rawFields?: string[];\n\n // 暂不提供自定义 size,内部计算\n // readonly size?: SizeAttr;\n\n // 暂不提供 shape 配置,默认:circle.\n // readonly shape?: string;\n\n /**\n * @title 图形样式\n */\n readonly pointStyle?: StyleAttr;\n /**\n * @title 交互\n * @description 下钻交互\n */\n readonly drilldown?: DrillDownCfg;\n}\n"]}
|
|
@@ -5,39 +5,80 @@ import { OptionWithConnectedArea } from '../../adaptor/connected-area';
|
|
|
5
5
|
import { IntervalGeometryOptions } from '../../adaptor/geometries/interval';
|
|
6
6
|
declare type PartialIntervalGeometryOptions = Pick<IntervalGeometryOptions, 'dodgePadding' | 'intervalPadding'>;
|
|
7
7
|
export interface ColumnOptions extends Options, OptionWithConversionTag, OptionWithConnectedArea, PartialIntervalGeometryOptions {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @title x轴字段
|
|
10
|
+
*/
|
|
9
11
|
readonly xField: string;
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @title y轴字段
|
|
14
|
+
*/
|
|
11
15
|
readonly yField: string;
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @title 拆分字段
|
|
18
|
+
*/
|
|
13
19
|
readonly seriesField?: string;
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* @title 是否分组柱形图
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
15
24
|
readonly isGroup?: boolean;
|
|
16
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* @title 是否是区间柱状图
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
17
29
|
readonly isRange?: boolean;
|
|
18
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* @title 是否是百分比柱状图
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
19
34
|
readonly isPercent?: boolean;
|
|
20
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* @title 是否堆积柱状图
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
21
39
|
readonly isStack?: boolean;
|
|
22
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @title 柱状图宽度占比
|
|
42
|
+
* @description 范围[0-1]
|
|
43
|
+
*/
|
|
23
44
|
readonly columnWidthRatio?: number;
|
|
24
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @title 分组中柱子之间的间距
|
|
47
|
+
* @description 范围[0-1],仅对分组柱状图适用
|
|
48
|
+
*/
|
|
25
49
|
readonly marginRatio?: number;
|
|
26
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* @title 柱状图最小宽度(像素)
|
|
52
|
+
*/
|
|
27
53
|
readonly minColumnWidth?: number;
|
|
28
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* @title 柱状图最大宽度(像素)
|
|
56
|
+
*/
|
|
29
57
|
readonly maxColumnWidth?: number;
|
|
30
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* @title 柱状图柱子的背景
|
|
60
|
+
*/
|
|
31
61
|
readonly columnBackground?: {
|
|
32
62
|
style?: ShapeAttrs;
|
|
33
63
|
};
|
|
34
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* @title 柱子样式
|
|
66
|
+
*/
|
|
35
67
|
readonly columnStyle?: StyleAttr;
|
|
36
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* @title 分组字段
|
|
70
|
+
* @description 优先级高于 seriesField , isGroup: true 时会根据 groupField 进行分组
|
|
71
|
+
*/
|
|
37
72
|
readonly groupField?: string;
|
|
38
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* @title 自定义柱状图
|
|
75
|
+
* @description interval 图形元素展示形状
|
|
76
|
+
*/
|
|
39
77
|
readonly shape?: string;
|
|
40
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* @title 图表交互
|
|
80
|
+
* @description 开启下钻交互,以及进行下钻交互的配置
|
|
81
|
+
*/
|
|
41
82
|
readonly brush?: BrushCfg;
|
|
42
83
|
}
|
|
43
84
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/column/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeAttrs } from '@antv/g2';\nimport { BrushCfg, Options, StyleAttr } from '../../types';\nimport { OptionWithConversionTag } from '../../adaptor/conversion-tag';\nimport { OptionWithConnectedArea } from '../../adaptor/connected-area';\nimport { IntervalGeometryOptions } from '../../adaptor/geometries/interval';\n\ntype PartialIntervalGeometryOptions = Pick<IntervalGeometryOptions, 'dodgePadding' | 'intervalPadding'>;\n\nexport interface ColumnOptions\n extends Options,\n OptionWithConversionTag,\n OptionWithConnectedArea,\n PartialIntervalGeometryOptions {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/column/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeAttrs } from '@antv/g2';\nimport { BrushCfg, Options, StyleAttr } from '../../types';\nimport { OptionWithConversionTag } from '../../adaptor/conversion-tag';\nimport { OptionWithConnectedArea } from '../../adaptor/connected-area';\nimport { IntervalGeometryOptions } from '../../adaptor/geometries/interval';\n\ntype PartialIntervalGeometryOptions = Pick<IntervalGeometryOptions, 'dodgePadding' | 'intervalPadding'>;\n\nexport interface ColumnOptions\n extends Options,\n OptionWithConversionTag,\n OptionWithConnectedArea,\n PartialIntervalGeometryOptions {\n /**\n * @title x轴字段\n */\n readonly xField: string;\n /**\n * @title y轴字段\n */\n readonly yField: string;\n /**\n * @title 拆分字段\n */\n readonly seriesField?: string;\n /**\n * @title 是否分组柱形图\n * @default false\n */\n readonly isGroup?: boolean;\n /**\n * @title 是否是区间柱状图\n * @default false\n */\n readonly isRange?: boolean;\n /**\n * @title 是否是百分比柱状图\n * @default false\n */\n readonly isPercent?: boolean;\n /**\n * @title 是否堆积柱状图\n * @default false\n */\n readonly isStack?: boolean;\n /**\n * @title 柱状图宽度占比\n * @description 范围[0-1]\n */\n readonly columnWidthRatio?: number;\n /**\n * @title 分组中柱子之间的间距\n * @description 范围[0-1],仅对分组柱状图适用\n */\n readonly marginRatio?: number;\n /**\n * @title 柱状图最小宽度(像素)\n */\n readonly minColumnWidth?: number;\n /**\n * @title 柱状图最大宽度(像素)\n */\n readonly maxColumnWidth?: number;\n /**\n * @title 柱状图柱子的背景\n */\n readonly columnBackground?: { style?: ShapeAttrs };\n /**\n * @title 柱子样式\n */\n readonly columnStyle?: StyleAttr;\n /**\n * @title 分组字段\n * @description 优先级高于 seriesField , isGroup: true 时会根据 groupField 进行分组\n */\n readonly groupField?: string;\n /**\n * @title 自定义柱状图\n * @description interval 图形元素展示形状\n */\n readonly shape?: string;\n /**\n * @title 图表交互\n * @description 开启下钻交互,以及进行下钻交互的配置\n */\n readonly brush?: BrushCfg;\n}\n"]}
|
|
@@ -15,11 +15,31 @@ export interface PointConfig {
|
|
|
15
15
|
readonly style?: StyleAttr;
|
|
16
16
|
}
|
|
17
17
|
declare type CommonGeometryOption = {
|
|
18
|
+
/**
|
|
19
|
+
* @title 图形类型
|
|
20
|
+
*/
|
|
18
21
|
readonly geometry?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @title 数据标签的配置
|
|
24
|
+
*/
|
|
19
25
|
readonly label?: Options['label'];
|
|
26
|
+
/**
|
|
27
|
+
* @title 图例legend的配置项
|
|
28
|
+
*/
|
|
20
29
|
readonly legend?: Options['legend'];
|
|
30
|
+
/**
|
|
31
|
+
* @title 颜色色板
|
|
32
|
+
*/
|
|
21
33
|
readonly color?: Options['color'];
|
|
34
|
+
/**
|
|
35
|
+
* @title 是否分组
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
22
38
|
readonly isGroup?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @title 分组字段
|
|
41
|
+
* @description 优先级高于 seriesField
|
|
42
|
+
*/
|
|
23
43
|
readonly groupField?: string;
|
|
24
44
|
};
|
|
25
45
|
export declare type GeometryLineOption = Pick<LineOptions, 'seriesField' | 'smooth' | 'connectNulls' | 'lineStyle' | 'point' | 'isStack' | 'stepType'> & CommonGeometryOption;
|
|
@@ -27,27 +47,32 @@ export declare type GeometryColumnOption = Pick<ColumnOptions, 'seriesField' | '
|
|
|
27
47
|
export declare type GeometryOption = GeometryColumnOption | GeometryLineOption;
|
|
28
48
|
export declare type DualAxesOptions = Omit<Options, 'data' | 'yAxis' | 'color' | 'annotations'> & {
|
|
29
49
|
/**
|
|
30
|
-
*
|
|
50
|
+
* @title 数据
|
|
51
|
+
* @description 具体的数据,左右两边的数据
|
|
31
52
|
*/
|
|
32
53
|
readonly data: Array<Record<string, any>[]>;
|
|
33
54
|
/**
|
|
34
|
-
* 双轴图的 x
|
|
55
|
+
* @title 双轴图的 x 字段
|
|
56
|
+
* @description x 字段名称需要保持一致
|
|
35
57
|
*/
|
|
36
58
|
readonly xField: string;
|
|
37
59
|
/**
|
|
38
|
-
* 双轴图左右 y
|
|
60
|
+
* @title 双轴图左右 y 字段
|
|
61
|
+
* @description 需要不一致
|
|
39
62
|
*/
|
|
40
63
|
readonly yField: string[];
|
|
41
64
|
/**
|
|
42
|
-
* 左右两边的 yAxis
|
|
65
|
+
* @title 左右两边的 yAxis 配置
|
|
66
|
+
* @description 使用 object 的方式,key 为 y 字段名,或者数组分别表示左右
|
|
43
67
|
*/
|
|
44
68
|
readonly yAxis?: Options['yAxis'][] | Record<string, Options['yAxis']>;
|
|
45
69
|
/**
|
|
46
|
-
* 左右两边的图形配置
|
|
70
|
+
* @title 左右两边的图形配置
|
|
47
71
|
*/
|
|
48
72
|
readonly geometryOptions?: GeometryOption[];
|
|
49
73
|
/**
|
|
50
|
-
* 左右两边的 annotation
|
|
74
|
+
* @title 左右两边的 annotation 配置
|
|
75
|
+
* @description 同时支持数组和object 两种形式,以防出现 field 相同无法设置的情况
|
|
51
76
|
*/
|
|
52
77
|
readonly annotations?: Options['annotations'][] | Record<string, Options['annotations']>;
|
|
53
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/dual-axes/types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAED,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,qCAAiB,CAAA;AACnB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B","sourcesContent":["import { Options, ShapeAttr, SizeAttr, StyleAttr } from '../../types';\nimport { LineOptions } from '../line/types';\nimport { ColumnOptions } from '../column/types';\n\nexport enum AxisType {\n Left = 'Left',\n Right = 'Right',\n}\n\nexport enum DualAxesGeometry {\n Line = 'line',\n Column = 'column',\n}\n\nexport interface PointConfig {\n readonly shape?: ShapeAttr;\n readonly size?: SizeAttr;\n readonly style?: StyleAttr;\n}\n\ntype CommonGeometryOption = {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/dual-axes/types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAED,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,qCAAiB,CAAA;AACnB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B","sourcesContent":["import { Options, ShapeAttr, SizeAttr, StyleAttr } from '../../types';\nimport { LineOptions } from '../line/types';\nimport { ColumnOptions } from '../column/types';\n\nexport enum AxisType {\n Left = 'Left',\n Right = 'Right',\n}\n\nexport enum DualAxesGeometry {\n Line = 'line',\n Column = 'column',\n}\n\nexport interface PointConfig {\n readonly shape?: ShapeAttr;\n readonly size?: SizeAttr;\n readonly style?: StyleAttr;\n}\n\ntype CommonGeometryOption = {\n /**\n * @title 图形类型\n */\n readonly geometry?: string;\n /**\n * @title 数据标签的配置\n */\n readonly label?: Options['label'];\n /**\n * @title 图例legend的配置项\n */\n readonly legend?: Options['legend'];\n /**\n * @title 颜色色板\n */\n readonly color?: Options['color'];\n /**\n * @title 是否分组\n * @default false\n */\n readonly isGroup?: boolean;\n /**\n * @title 分组字段\n * @description 优先级高于 seriesField\n */\n readonly groupField?: string;\n};\n\n// 折线设置接口, 直接用 LineOption 吧\nexport type GeometryLineOption = Pick<\n LineOptions,\n 'seriesField' | 'smooth' | 'connectNulls' | 'lineStyle' | 'point' | 'isStack' | 'stepType'\n> &\n CommonGeometryOption;\n\n// 柱设置接口\nexport type GeometryColumnOption = Pick<\n ColumnOptions,\n | 'seriesField'\n | 'isGroup'\n | 'isStack'\n | 'isRange'\n | 'isPercent'\n | 'columnWidthRatio'\n | 'marginRatio'\n | 'columnStyle'\n | 'pattern'\n> &\n CommonGeometryOption;\n\nexport type GeometryOption = GeometryColumnOption | GeometryLineOption;\n\nexport type DualAxesOptions = Omit<Options, 'data' | 'yAxis' | 'color' | 'annotations'> & {\n /**\n * @title 数据\n * @description 具体的数据,左右两边的数据\n */\n readonly data: Array<Record<string, any>[]>;\n /**\n * @title 双轴图的 x 字段\n * @description x 字段名称需要保持一致\n */\n readonly xField: string;\n /**\n * @title 双轴图左右 y 字段\n * @description 需要不一致\n */\n readonly yField: string[];\n /**\n * @title 左右两边的 yAxis 配置\n * @description 使用 object 的方式,key 为 y 字段名,或者数组分别表示左右\n */\n readonly yAxis?: Options['yAxis'][] | Record<string, Options['yAxis']>;\n /**\n * @title 左右两边的图形配置\n */\n readonly geometryOptions?: GeometryOption[];\n /**\n * @title 左右两边的 annotation 配置\n * @description 同时支持数组和object 两种形式,以防出现 field 相同无法设置的情况\n */\n readonly annotations?: Options['annotations'][] | Record<string, Options['annotations']>;\n};\n"]}
|
|
@@ -26,6 +26,6 @@ export var doSliderFilter = function (view, sliderValue) {
|
|
|
26
26
|
var idx = xValues.indexOf(value);
|
|
27
27
|
return idx > -1 ? isBetween(idx, minIndex, maxIndex) : true;
|
|
28
28
|
});
|
|
29
|
-
view.render(true);
|
|
29
|
+
view.getRootView().render(true);
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=render-sider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-sider.js","sourceRoot":"","sources":["../../../../src/plots/dual-axes/util/render-sider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,IAAU,EAAE,WAA6B;IAC/D,IAAA,GAAG,GAAS,WAAW,GAApB,EAAE,GAAG,GAAI,WAAW,GAAf,CAAgB;IAC/B,IAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC;IACpC,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;QACxB,OAAO;KACR;IACD,IAAM,YAAY,GAAG,IAAI,CAAC;IAC1B,IAAM,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACzD,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,CA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CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACzD,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACpD,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IAEpD,aAAa;IACb,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAC,KAAU;QACnC,IAAM,GAAG,GAAW,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import { View } from '@antv/g2';\nimport { size, valuesOfKey } from '@antv/util';\nimport { isBetween } from '../../../utils';\n\n/**\n * 右侧 View 进行 slider 过滤\n * 由于双轴图是多 View , 需要监听左侧 Slider 的 change 事件来同步右侧 View\n * @param { View } view 右侧视图\n * @param { number[] } sliderValue 滑块当前值\n * @returns void\n */\nexport const doSliderFilter = (view: View, sliderValue: [number, number]) => {\n const [min, max] = sliderValue;\n const data = view.getOptions().data;\n const xScale = view.getXScale();\n const dataSize = size(data);\n if (!xScale || !dataSize) {\n return;\n }\n const isHorizontal = true;\n const values = valuesOfKey(data, xScale.field);\n const xValues = isHorizontal ? values : values.reverse();\n const xTickCount = size(xValues);\n const minIndex = Math.floor(min * (xTickCount - 1));\n const maxIndex = Math.floor(max * (xTickCount - 1));\n\n // 增加 x 轴的过滤器\n view.filter(xScale.field, (value: any) => {\n const idx: number = xValues.indexOf(value);\n return idx > -1 ? isBetween(idx, minIndex, maxIndex) : true;\n });\n view.getRootView().render(true);\n};\n"]}
|
|
@@ -8,121 +8,141 @@ import { Annotation } from '../../types/annotation';
|
|
|
8
8
|
import { Interaction } from '../../types/interaction';
|
|
9
9
|
import { IPlotTypes } from '../mix/utils';
|
|
10
10
|
/**
|
|
11
|
-
* geometry 映射信息
|
|
11
|
+
* @title geometry 映射信息
|
|
12
12
|
*/
|
|
13
13
|
export declare type IGeometry = Geometry & {
|
|
14
14
|
adjust?: Types.AdjustOption;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* 子 view
|
|
18
|
-
* 1. 暂时不开嵌套 view 的情况
|
|
19
|
-
* 2. 暂不开放 分面子 view 的 meta 独立设置
|
|
17
|
+
* @title 子 view 的配置
|
|
18
|
+
* @description 1. 暂时不开嵌套 view 的情况 2. 暂不开放 分面子 view 的 meta 独立设置
|
|
20
19
|
*/
|
|
21
20
|
export declare type IView = {
|
|
22
21
|
/**
|
|
23
|
-
* 图形
|
|
22
|
+
* @title 图形
|
|
23
|
+
* @description geometry 及映射配置
|
|
24
24
|
*/
|
|
25
25
|
readonly geometries: IGeometry[];
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* @title 数据
|
|
28
|
+
* @description optional,view 中的数据
|
|
28
29
|
*/
|
|
29
30
|
readonly data?: Data;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
+
* @title meta
|
|
32
33
|
*/
|
|
33
34
|
readonly meta?: Record<string, Axis>;
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
+
* @title 坐标系的配置
|
|
37
|
+
* @description 每一个 view 具有相同的坐标系
|
|
36
38
|
*/
|
|
37
39
|
readonly coordinate?: Types.CoordinateOption;
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
41
|
+
* @title 坐标轴配置
|
|
40
42
|
*/
|
|
41
43
|
readonly axes?: false | Record<string, Axis>;
|
|
42
44
|
/**
|
|
43
|
-
*
|
|
45
|
+
* @title interactions 配置
|
|
44
46
|
*/
|
|
45
47
|
readonly interactions?: Interaction[];
|
|
46
48
|
/**
|
|
47
|
-
*
|
|
49
|
+
* @title annotation 配置
|
|
48
50
|
*/
|
|
49
51
|
readonly annotations?: Annotation[];
|
|
50
52
|
/**
|
|
51
|
-
*
|
|
53
|
+
* @title animation 配置
|
|
52
54
|
*/
|
|
53
55
|
readonly animation?: Animation;
|
|
54
56
|
/**
|
|
55
|
-
*
|
|
57
|
+
* @title tooltip 配置
|
|
56
58
|
*/
|
|
57
59
|
readonly tooltip?: Tooltip;
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
|
-
* 子 plot 的配置
|
|
62
|
+
* @title 子 plot 的配置
|
|
61
63
|
*/
|
|
62
64
|
export declare type IPlot = IPlotTypes;
|
|
63
65
|
/**
|
|
64
|
-
* facetData map
|
|
66
|
+
* @title facetData map
|
|
65
67
|
*/
|
|
66
68
|
declare type FacetDataMap = {
|
|
67
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* @title rect 类型分面配置
|
|
71
|
+
*/
|
|
68
72
|
readonly rect: Types.RectData;
|
|
69
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* @title mirror 类型分面配置
|
|
75
|
+
*/
|
|
70
76
|
readonly mirror: Types.MirrorData;
|
|
71
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* @title list 类型分面配置
|
|
79
|
+
*/
|
|
72
80
|
readonly list: Types.ListData;
|
|
73
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* @title matrix 类型分面配置
|
|
83
|
+
*/
|
|
74
84
|
readonly matrix: Types.MatrixData;
|
|
75
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* @title circle 类型分面配置
|
|
87
|
+
*/
|
|
76
88
|
readonly circle: Types.CircleData;
|
|
77
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* @title tree 类型分面配置
|
|
91
|
+
*/
|
|
78
92
|
readonly tree: Types.TreeData;
|
|
79
93
|
};
|
|
80
94
|
declare type FacetCfg = Types.MirrorCfg & Types.RectCfg & Types.TreeCfg & Types.ListCfg & Types.CircleCfg & Types.MatrixCfg;
|
|
81
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* @title 分面图的配置类型定义
|
|
97
|
+
*/
|
|
82
98
|
export interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.FacetCfgMap> extends Options, FacetCfg {
|
|
83
99
|
/**
|
|
84
|
-
*
|
|
100
|
+
* @title 分面类型
|
|
101
|
+
* @description G2 内置了六种分面: rect、list、circle、tree、mirror 和 matrix
|
|
85
102
|
*/
|
|
86
103
|
readonly type: T;
|
|
87
104
|
/**
|
|
88
|
-
*
|
|
105
|
+
* @title 数据划分维度
|
|
89
106
|
*/
|
|
90
107
|
readonly fields: string[];
|
|
91
108
|
/**
|
|
92
|
-
* 分面数据
|
|
109
|
+
* @title 分面数据
|
|
93
110
|
*/
|
|
94
111
|
readonly data: Data;
|
|
95
112
|
/**
|
|
96
|
-
*
|
|
97
|
-
* 回调的方式
|
|
113
|
+
* @title 绘图
|
|
114
|
+
* @description 每个分面 view 中的具体绘图表现 回调的方式
|
|
98
115
|
*/
|
|
99
116
|
readonly eachView: (innerView: View, facet?: FacetDataMap[T]) => IView | IPlot;
|
|
100
117
|
/**
|
|
101
|
-
* 是否展示分面标题
|
|
118
|
+
* @title 是否展示分面标题
|
|
119
|
+
* @default false
|
|
102
120
|
*/
|
|
103
121
|
readonly showTitle?: boolean;
|
|
104
122
|
/**
|
|
105
|
-
*
|
|
123
|
+
* @title meta 字段
|
|
124
|
+
* @description facet 中对应的 meta 字段配置
|
|
106
125
|
*/
|
|
107
126
|
readonly meta?: Record<string, Meta>;
|
|
108
127
|
/**
|
|
109
|
-
*
|
|
128
|
+
* @title 坐标系的配置
|
|
129
|
+
* @description 每一个 view 具有相同的坐标系
|
|
110
130
|
*/
|
|
111
131
|
readonly coordinate?: Types.CoordinateOption;
|
|
112
132
|
/**
|
|
113
|
-
*
|
|
133
|
+
* @title 轴配置
|
|
114
134
|
*/
|
|
115
135
|
readonly axes?: false | Record<string, Axis>;
|
|
116
136
|
/**
|
|
117
|
-
*
|
|
137
|
+
* @title tooltip 配置
|
|
118
138
|
*/
|
|
119
139
|
readonly tooltip?: Tooltip;
|
|
120
140
|
/**
|
|
121
|
-
*
|
|
141
|
+
* @title 图例配置
|
|
122
142
|
*/
|
|
123
143
|
readonly legend?: Legend;
|
|
124
144
|
/**
|
|
125
|
-
*
|
|
145
|
+
* @title 图例配置
|
|
126
146
|
*/
|
|
127
147
|
readonly interactions?: Interaction[];
|
|
128
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/facet/types.ts"],"names":[],"mappings":"","sourcesContent":["import { View, Types } from '@antv/g2';\nimport { Data, Meta, Options, Tooltip } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { Legend } from '../../types/legend';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Animation } from '../../types/animation';\nimport { Annotation } from '../../types/annotation';\nimport { Interaction } from '../../types/interaction';\nimport { IPlotTypes } from '../mix/utils';\n\n/**\n * geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n\n/**\n * 子 view
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/facet/types.ts"],"names":[],"mappings":"","sourcesContent":["import { View, Types } from '@antv/g2';\nimport { Data, Meta, Options, Tooltip } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { Legend } from '../../types/legend';\nimport { Geometry } from '../../adaptor/geometries/base';\nimport { Animation } from '../../types/animation';\nimport { Annotation } from '../../types/annotation';\nimport { Interaction } from '../../types/interaction';\nimport { IPlotTypes } from '../mix/utils';\n\n/**\n * @title geometry 映射信息\n */\nexport type IGeometry = Geometry & {\n adjust?: Types.AdjustOption;\n};\n\n/**\n * @title 子 view 的配置\n * @description 1. 暂时不开嵌套 view 的情况 2. 暂不开放 分面子 view 的 meta 独立设置\n */\nexport type IView = {\n /**\n * @title 图形\n * @description geometry 及映射配置\n */\n readonly geometries: IGeometry[];\n /**\n * @title 数据\n * @description optional,view 中的数据\n */\n readonly data?: Data;\n /**\n * @title meta\n */\n readonly meta?: Record<string, Axis>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 坐标轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title interactions 配置\n */\n readonly interactions?: Interaction[];\n /**\n * @title annotation 配置\n */\n readonly annotations?: Annotation[];\n /**\n * @title animation 配置\n */\n readonly animation?: Animation;\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n};\n\n/**\n * @title 子 plot 的配置\n */\nexport type IPlot = IPlotTypes;\n/**\n * @title facetData map\n */\ntype FacetDataMap = {\n /**\n * @title rect 类型分面配置\n */\n readonly rect: Types.RectData;\n /**\n * @title mirror 类型分面配置\n */\n readonly mirror: Types.MirrorData;\n /**\n * @title list 类型分面配置\n */\n readonly list: Types.ListData;\n /**\n * @title matrix 类型分面配置\n */\n readonly matrix: Types.MatrixData;\n /**\n * @title circle 类型分面配置\n */\n readonly circle: Types.CircleData;\n /**\n * @title tree 类型分面配置\n */\n readonly tree: Types.TreeData;\n};\n\ntype FacetCfg = Types.MirrorCfg & Types.RectCfg & Types.TreeCfg & Types.ListCfg & Types.CircleCfg & Types.MatrixCfg;\n\n/**\n * @title 分面图的配置类型定义\n */\nexport interface FacetOptions<T extends keyof Types.FacetCfgMap = keyof Types.FacetCfgMap> extends Options, FacetCfg {\n /**\n * @title 分面类型\n * @description G2 内置了六种分面: rect、list、circle、tree、mirror 和 matrix\n */\n readonly type: T;\n /**\n * @title 数据划分维度\n */\n readonly fields: string[];\n /**\n * @title 分面数据\n */\n readonly data: Data;\n /**\n * @title 绘图\n * @description 每个分面 view 中的具体绘图表现 回调的方式\n */\n readonly eachView: (innerView: View, facet?: FacetDataMap[T]) => IView | IPlot;\n /**\n * @title 是否展示分面标题\n * @default false\n */\n readonly showTitle?: boolean;\n /**\n * @title meta 字段\n * @description facet 中对应的 meta 字段配置\n */\n readonly meta?: Record<string, Meta>;\n /**\n * @title 坐标系的配置\n * @description 每一个 view 具有相同的坐标系\n */\n readonly coordinate?: Types.CoordinateOption;\n /**\n * @title 轴配置\n */\n readonly axes?: false | Record<string, Axis>;\n /**\n * @title tooltip 配置\n */\n readonly tooltip?: Tooltip;\n /**\n * @title 图例配置\n */\n readonly legend?: Legend;\n /**\n * @title 图例配置\n */\n readonly interactions?: Interaction[];\n}\n"]}
|
|
@@ -27,12 +27,13 @@ function field(params) {
|
|
|
27
27
|
*/
|
|
28
28
|
function geometry(params) {
|
|
29
29
|
var chart = params.chart, options = params.options;
|
|
30
|
-
var data = options.data, xField = options.xField, yField = options.yField, color = options.color, compareField = options.compareField, isTransposed = options.isTransposed, tooltip = options.tooltip, maxSize = options.maxSize, minSize = options.minSize, label = options.label, funnelStyle = options.funnelStyle, state = options.state;
|
|
30
|
+
var data = options.data, xField = options.xField, yField = options.yField, color = options.color, compareField = options.compareField, isTransposed = options.isTransposed, tooltip = options.tooltip, maxSize = options.maxSize, minSize = options.minSize, label = options.label, funnelStyle = options.funnelStyle, state = options.state, showFacetTitle = options.showFacetTitle;
|
|
31
31
|
chart.facet('mirror', {
|
|
32
32
|
fields: [compareField],
|
|
33
33
|
// 漏斗图的转置规则与分面相反,默认是垂直布局
|
|
34
34
|
transpose: !isTransposed,
|
|
35
35
|
padding: isTransposed ? 0 : [32, 0, 0, 0],
|
|
36
|
+
showTitle: showFacetTitle,
|
|
36
37
|
eachView: function (view, facet) {
|
|
37
38
|
var index = isTransposed ? facet.rowIndex : facet.columnIndex;
|
|
38
39
|
if (!isTransposed) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../../src/plots/funnel/geometries/compare.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEjE;;;GAGG;AACH,SAAS,KAAK,CAAC,MAA6B;;IAClC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,KAAsB,OAAO,KAApB,EAAT,IAAI,mBAAG,EAAE,KAAA,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IAEtC,QAAQ;IACR,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,CAAC,KAAK;QACT,GAAC,MAAM,IAAG;YACR,IAAI,EAAE,IAAI;SACX;YACD,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA6B;IACrC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAEhC,IAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../../src/plots/funnel/geometries/compare.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,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ACV,cAAmC;gBAEnC,IAAM,KAAK,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACvC,OAAO,UAAU,CAAC,EAAE,EAAE,cAAc,EAAE;oBACpC,KAAK,EAAE,CAAC,UAAU,GAAG,GAAG,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;oBACtD,GAAG,EAAE,CAAC,UAAU,GAAG,GAAG,EAAE,KAAK,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC;oBAC3D,IAAI,EAAE,YAAY;wBAChB,CAAC,CAAC;4BACE,KAAK,EAAE;gCACL,SAAS,EAAE,OAAO;6BACnB;yBACF;wBACH,CAAC,CAAC;4BACE,OAAO,EAAE,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;4BACpE,KAAK,EAAE;gCACL,SAAS,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;6BAC7C;yBACF;iBACN,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,sBAAsB,CAAC,iBAAiB,CAAC,CACvC,UAAU,CACR,EAAE,EACF;gBACE,KAAK,EAAE,IAAI;gBACX,OAAO,SAAA;aACR,CACF,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAA6B;IACzD,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { Types } from '@antv/g2';\nimport { isArray } from '@antv/util';\nimport { flow, deepAssign } from '../../../utils';\nimport { Params } from '../../../core/adaptor';\nimport { Datum, Data } from '../../../types/common';\nimport { getTooltipMapping } from '../../../utils/tooltip';\nimport { geometry as baseGeometry } from '../../../adaptor/geometries/base';\nimport { FunnelOptions } from '../types';\nimport { FUNNEL_PERCENT, FUNNEL_CONVERSATION, FUNNEL_MAPPING_VALUE } from '../constant';\nimport { conversionTagComponent, transformData } from './common';\n\n/**\n * 处理字段数据\n * @param params\n */\nfunction field(params: Params<FunnelOptions>): Params<FunnelOptions> {\n const { chart, options } = params;\n const { data = [], yField } = options;\n\n // 绘制漏斗图\n chart.data(data);\n chart.scale({\n [yField]: {\n sync: true,\n },\n });\n return params;\n}\n\n/**\n * geometry处理\n * @param params\n */\nfunction geometry(params: Params<FunnelOptions>): Params<FunnelOptions> {\n const { chart, options } = params;\n const {\n data,\n xField,\n yField,\n color,\n compareField,\n isTransposed,\n tooltip,\n maxSize,\n minSize,\n label,\n funnelStyle,\n state,\n showFacetTitle,\n } = options;\n\n chart.facet('mirror', {\n fields: [compareField],\n // 漏斗图的转置规则与分面相反,默认是垂直布局\n transpose: !isTransposed,\n padding: isTransposed ? 0 : [32, 0, 0, 0],\n showTitle: showFacetTitle,\n eachView(view, facet) {\n const index = isTransposed ? facet.rowIndex : facet.columnIndex;\n\n if (!isTransposed) {\n view.coordinate({\n type: 'rect',\n actions: [['transpose'], ['scale', index === 0 ? -1 : 1, -1]],\n });\n }\n\n const formatterData = transformData(facet.data, data, {\n yField,\n maxSize,\n minSize,\n });\n\n view.data(formatterData);\n\n // 绘制图形\n const { fields, formatter } = getTooltipMapping(tooltip, [xField, yField, compareField]);\n\n const defaultFacetLabel = isTransposed\n ? {\n offset: index === 0 ? 10 : -23,\n position: (index === 0 ? 'bottom' : 'top') as Types.IntervalGeometryLabelPosition,\n }\n : {\n offset: 10,\n position: 'left' as Types.IntervalGeometryLabelPosition,\n style: {\n textAlign: index === 0 ? 'end' : 'start',\n },\n };\n\n baseGeometry({\n chart: view,\n options: {\n type: 'interval',\n xField: xField,\n yField: FUNNEL_MAPPING_VALUE,\n colorField: xField,\n tooltipFields: isArray(fields) && fields.concat([FUNNEL_PERCENT, FUNNEL_CONVERSATION]),\n mapping: {\n // todo 暂时不提供 金字塔 shape,后续需要自定义下形状\n shape: 'funnel',\n tooltip: formatter,\n color,\n style: funnelStyle,\n },\n label: label === false ? false : deepAssign({}, defaultFacetLabel, label),\n state,\n },\n });\n },\n });\n\n return params;\n}\n\n/**\n * 转化率组件\n * @param params\n */\nfunction conversionTag(params: Params<FunnelOptions>): Params<FunnelOptions> {\n const { chart, options } = params;\n const { conversionTag, isTransposed } = options;\n // @ts-ignore\n chart.once('beforepaint', () => {\n chart.views.forEach((view, viewIndex) => {\n const getLineCoordinate = (\n datum: Datum,\n datumIndex: number,\n data: Data,\n initLineOption: Record<string, any>\n ): Types.LineOption => {\n const ratio = viewIndex === 0 ? -1 : 1;\n return deepAssign({}, initLineOption, {\n start: [datumIndex - 0.5, datum[FUNNEL_MAPPING_VALUE]],\n end: [datumIndex - 0.5, datum[FUNNEL_MAPPING_VALUE] + 0.05],\n text: isTransposed\n ? {\n style: {\n textAlign: 'start',\n },\n }\n : {\n offsetX: conversionTag !== false ? ratio * conversionTag.offsetX : 0,\n style: {\n textAlign: viewIndex === 0 ? 'end' : 'start',\n },\n },\n });\n };\n\n conversionTagComponent(getLineCoordinate)(\n deepAssign(\n {},\n {\n chart: view,\n options,\n }\n )\n );\n });\n });\n return params;\n}\n\n/**\n * 对比漏斗\n * @param chart\n * @param options\n */\nexport function compareFunnel(params: Params<FunnelOptions>) {\n return flow(field, geometry, conversionTag)(params);\n}\n"]}
|
|
@@ -23,10 +23,11 @@ function field(params) {
|
|
|
23
23
|
*/
|
|
24
24
|
function geometry(params) {
|
|
25
25
|
var chart = params.chart, options = params.options;
|
|
26
|
-
var seriesField = options.seriesField, isTransposed = options.isTransposed;
|
|
26
|
+
var seriesField = options.seriesField, isTransposed = options.isTransposed, showFacetTitle = options.showFacetTitle;
|
|
27
27
|
chart.facet('rect', {
|
|
28
28
|
fields: [seriesField],
|
|
29
29
|
padding: [isTransposed ? 0 : 32, 10, 0, 10],
|
|
30
|
+
showTitle: showFacetTitle,
|
|
30
31
|
eachView: function (view, facet) {
|
|
31
32
|
basicFunnel(deepAssign({}, params, {
|
|
32
33
|
chart: view,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet.js","sourceRoot":"","sources":["../../../../src/plots/funnel/geometries/facet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;GAGG;AACH,SAAS,KAAK,CAAC,MAA6B;;IAClC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,KAAsB,OAAO,KAApB,EAAT,IAAI,mBAAG,EAAE,KAAA,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IACtC,QAAQ;IACR,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,CAAC,KAAK;QACT,GAAC,MAAM,IAAG;YACR,IAAI,EAAE,IAAI;SACX;YACD,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA6B;IACrC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,WAAW,
|
|
1
|
+
{"version":3,"file":"facet.js","sourceRoot":"","sources":["../../../../src/plots/funnel/geometries/facet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;GAGG;AACH,SAAS,KAAK,CAAC,MAA6B;;IAClC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,KAAsB,OAAO,KAApB,EAAT,IAAI,mBAAG,EAAE,KAAA,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAa;IACtC,QAAQ;IACR,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,CAAC,KAAK;QACT,GAAC,MAAM,IAAG;YACR,IAAI,EAAE,IAAI;SACX;YACD,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA6B;IACrC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,WAAW,GAAmC,OAAO,YAA1C,EAAE,YAAY,GAAqB,OAAO,aAA5B,EAAE,cAAc,GAAK,OAAO,eAAZ,CAAa;IAE9D,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;QAClB,MAAM,EAAE,CAAC,WAAW,CAAC;QACrB,OAAO,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,SAAS,EAAE,cAAc;QACzB,QAAQ,YAAC,IAAI,EAAE,KAAK;YAClB,WAAW,CACT,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE;gBACrB,KAAK,EAAE,IAAI;gBACX,OAAO,EAAE;oBACP,IAAI,EAAE,KAAK,CAAC,IAAI;iBACjB;aACF,CAAC,CACH,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAA6B;IACvD,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { flow, deepAssign } from '../../../utils';\nimport { Params } from '../../../core/adaptor';\nimport { FunnelOptions } from '../types';\nimport { basicFunnel } from './basic';\n\n/**\n * 处理字段数据\n * @param params\n */\nfunction field(params: Params<FunnelOptions>): Params<FunnelOptions> {\n const { chart, options } = params;\n const { data = [], yField } = options;\n // 绘制漏斗图\n chart.data(data);\n chart.scale({\n [yField]: {\n sync: true,\n },\n });\n return params;\n}\n\n/**\n * geometry处理\n * @param params\n */\nfunction geometry(params: Params<FunnelOptions>): Params<FunnelOptions> {\n const { chart, options } = params;\n const { seriesField, isTransposed, showFacetTitle } = options;\n\n chart.facet('rect', {\n fields: [seriesField],\n padding: [isTransposed ? 0 : 32, 10, 0, 10],\n showTitle: showFacetTitle,\n eachView(view, facet) {\n basicFunnel(\n deepAssign({}, params, {\n chart: view,\n options: {\n data: facet.data,\n },\n })\n );\n },\n });\n\n return params;\n}\n\n/**\n * 分面漏斗\n * @param chart\n * @param options\n */\nexport function facetFunnel(params: Params<FunnelOptions>) {\n return flow(field, geometry)(params);\n}\n"]}
|
|
@@ -5,27 +5,61 @@ export declare type ConversionPosition = {
|
|
|
5
5
|
end: AnnotationPosition;
|
|
6
6
|
};
|
|
7
7
|
export interface FunnelOptions extends Options {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @title x轴字段
|
|
10
|
+
*/
|
|
9
11
|
readonly xField?: string;
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @title y轴字段
|
|
14
|
+
*/
|
|
11
15
|
readonly yField?: string;
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @title 分组字段
|
|
18
|
+
* @description 漏斗图将根据此字段转置为分面漏斗图
|
|
19
|
+
*/
|
|
13
20
|
readonly seriesField?: string;
|
|
14
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @title 对比字段
|
|
23
|
+
* @description 漏斗图将根据此字段转置为对比漏斗图
|
|
24
|
+
*/
|
|
15
25
|
readonly compareField?: string;
|
|
16
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* @title 是否转置
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
17
30
|
readonly isTransposed?: boolean;
|
|
18
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @title 是否是动态高度
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
19
35
|
readonly dynamicHeight?: boolean;
|
|
20
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @title 最大宽度
|
|
38
|
+
* @description 范围0-1
|
|
39
|
+
*/
|
|
21
40
|
readonly maxSize?: number;
|
|
22
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* @title 最小宽度
|
|
43
|
+
* @description 范围0-1
|
|
44
|
+
*/
|
|
23
45
|
readonly minSize?: number;
|
|
24
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* @title shape 形状
|
|
48
|
+
* @description pyramid 金字塔, 只在基础漏斗图中适用. 在对比漏斗图以及设置 dynamicHeight: 'true' 时不适用
|
|
49
|
+
*/
|
|
25
50
|
readonly shape?: string;
|
|
26
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* @title 漏斗图样式
|
|
53
|
+
*/
|
|
27
54
|
readonly funnelStyle?: StyleAttr;
|
|
28
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* @title 漏斗分面标题
|
|
57
|
+
* @description 是否关闭漏斗的标题展示,适用于存在多组漏斗的情形,如:分组漏斗图、对比漏斗图。
|
|
58
|
+
*/
|
|
59
|
+
readonly showFacetTitle?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @title 转化率信息
|
|
62
|
+
*/
|
|
29
63
|
readonly conversionTag?: false | {
|
|
30
64
|
readonly offsetX?: number;
|
|
31
65
|
readonly offsetY?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/funnel/types.ts"],"names":[],"mappings":"","sourcesContent":["import { StyleAttr } from '../../types/attr';\nimport { TextStyle, Datum, Data, AnnotationPosition, Options } from '../../types/common';\n\nexport type ConversionPosition = {\n start: AnnotationPosition;\n end: AnnotationPosition;\n};\n\nexport interface FunnelOptions extends Options {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/funnel/types.ts"],"names":[],"mappings":"","sourcesContent":["import { StyleAttr } from '../../types/attr';\nimport { TextStyle, Datum, Data, AnnotationPosition, Options } from '../../types/common';\n\nexport type ConversionPosition = {\n start: AnnotationPosition;\n end: AnnotationPosition;\n};\n\nexport interface FunnelOptions extends Options {\n /**\n * @title x轴字段\n */\n readonly xField?: string;\n /**\n * @title y轴字段\n */\n readonly yField?: string;\n /**\n * @title 分组字段\n * @description 漏斗图将根据此字段转置为分面漏斗图\n */\n readonly seriesField?: string;\n /**\n * @title 对比字段\n * @description 漏斗图将根据此字段转置为对比漏斗图\n */\n readonly compareField?: string;\n /**\n * @title 是否转置\n * @default false\n */\n readonly isTransposed?: boolean;\n /**\n * @title 是否是动态高度\n * @default false\n */\n readonly dynamicHeight?: boolean;\n /**\n * @title 最大宽度\n * @description 范围0-1\n */\n readonly maxSize?: number;\n /**\n * @title 最小宽度\n * @description 范围0-1\n */\n readonly minSize?: number;\n /**\n * @title shape 形状\n * @description pyramid 金字塔, 只在基础漏斗图中适用. 在对比漏斗图以及设置 dynamicHeight: 'true' 时不适用\n */\n readonly shape?: string;\n /**\n * @title 漏斗图样式\n */\n readonly funnelStyle?: StyleAttr;\n /**\n * @title 漏斗分面标题\n * @description 是否关闭漏斗的标题展示,适用于存在多组漏斗的情形,如:分组漏斗图、对比漏斗图。\n */\n readonly showFacetTitle?: boolean;\n // 组件\n /**\n * @title 转化率信息\n */\n readonly conversionTag?:\n | false\n | {\n readonly offsetX?: number;\n readonly offsetY?: number;\n readonly style?: TextStyle;\n readonly formatter?: string | ((datum?: Datum, data?: Data) => string);\n };\n}\n"]}
|