@antv/g2plot 2.4.5 → 2.4.9
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 +64 -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/constants.js +1 -0
- package/esm/plots/area/constants.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/constants.js +3 -0
- package/esm/plots/bar/constants.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/constants.js +3 -0
- package/esm/plots/column/constants.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/types.d.ts +40 -11
- package/esm/plots/funnel/types.js.map +1 -1
- package/esm/plots/gauge/adaptor.js +1 -0
- package/esm/plots/gauge/adaptor.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/adaptor.js +2 -2
- package/esm/plots/line/adaptor.js.map +1 -1
- package/esm/plots/line/constants.js +1 -0
- package/esm/plots/line/constants.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/adaptor.js +2 -1
- package/esm/plots/liquid/adaptor.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 +17 -10
- package/esm/plots/liquid/shapes/liquid.js.map +1 -1
- package/esm/plots/liquid/types.d.ts +57 -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/adaptor.js +2 -0
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/pie/contants.js +1 -0
- package/esm/plots/pie/contants.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/adaptor.js +1 -0
- package/esm/plots/progress/adaptor.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/constant.js +1 -0
- package/esm/plots/rose/constant.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/adaptor.d.ts +1 -1
- package/esm/plots/scatter/adaptor.js +2 -2
- package/esm/plots/scatter/adaptor.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/constants.js +1 -0
- package/lib/plots/area/constants.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/constants.js +3 -0
- package/lib/plots/bar/constants.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/constants.js +3 -0
- package/lib/plots/column/constants.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/types.d.ts +40 -11
- package/lib/plots/funnel/types.js.map +1 -1
- package/lib/plots/gauge/adaptor.js +1 -0
- package/lib/plots/gauge/adaptor.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/adaptor.js +1 -1
- package/lib/plots/line/adaptor.js.map +1 -1
- package/lib/plots/line/constants.js +1 -0
- package/lib/plots/line/constants.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/adaptor.js +2 -1
- package/lib/plots/liquid/adaptor.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 +19 -10
- package/lib/plots/liquid/shapes/liquid.js.map +1 -1
- package/lib/plots/liquid/types.d.ts +57 -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/adaptor.js +2 -0
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/pie/contants.js +1 -0
- package/lib/plots/pie/contants.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/adaptor.js +1 -0
- package/lib/plots/progress/adaptor.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/constant.js +1 -0
- package/lib/plots/rose/constant.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/adaptor.d.ts +1 -1
- package/lib/plots/scatter/adaptor.js +1 -1
- package/lib/plots/scatter/adaptor.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 +2 -2
- package/src/core/plot.ts +5 -4
- package/src/index.ts +2 -2
- package/src/plots/area/constants.ts +1 -0
- package/src/plots/area/types.ts +35 -10
- package/src/plots/bar/constants.ts +3 -0
- 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/constants.ts +3 -0
- 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/types.ts +40 -13
- package/src/plots/gauge/adaptor.ts +1 -0
- 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/adaptor.ts +12 -1
- package/src/plots/line/constants.ts +1 -0
- package/src/plots/line/types.ts +42 -14
- package/src/plots/liquid/adaptor.ts +2 -1
- package/src/plots/liquid/index.ts +2 -0
- package/src/plots/liquid/shapes/liquid.ts +22 -11
- package/src/plots/liquid/types.ts +57 -16
- package/src/plots/mix/types.ts +31 -35
- package/src/plots/pie/adaptor.ts +2 -0
- package/src/plots/pie/contants.ts +1 -0
- package/src/plots/pie/types.ts +27 -10
- package/src/plots/progress/adaptor.ts +1 -0
- 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/constant.ts +1 -0
- 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/adaptor.ts +3 -1
- 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
|
@@ -5,27 +5,56 @@ 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
|
+
*/
|
|
29
58
|
readonly conversionTag?: false | {
|
|
30
59
|
readonly offsetX?: number;
|
|
31
60
|
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 // 组件\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/gauge/adaptor.ts"],"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CAAC;KACtG;IAED,IAAI,OAAO,EAAE;QACX,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAkBQ,8BAAS;AAhBlB;;;GAGG;AACH,SAAS,KAAK,CAAC,MAA4B;IACjC,IAAA,KAAK,GAAK,MAAM,MAAX,CAAY;IAEzB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAErB,OAAO,MAAM,CAAC;AAChB,CAAC;AAOD;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA4B;IAClD,0BAA0B;IAC1B,OAAO,YAAI,CACT,cAAK;IACL,+CAA+C;IAC/C,kBAAS,EACT,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,oBAAW,EACX,mBAAU,EAAE,EACZ,KAAK;IACL,uBAAuB;KACxB,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAdD,0BAcC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { isString } from '@antv/util';\nimport { interaction, animation, theme, scale, annotation } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { AXIS_META_CONFIG_KEYS } from '../../constant';\nimport { Params } from '../../core/adaptor';\nimport { deepAssign, flow, pick, renderGaugeStatistic } from '../../utils';\nimport { RANGE_TYPE, RANGE_VALUE, PERCENT, DEFAULT_COLOR, INDICATEOR_VIEW_ID, RANGE_VIEW_ID } from './constants';\nimport { GaugeOptions } from './types';\nimport { getIndicatorData, getRangeData } from './utils';\n\n/**\n * geometry 处理\n * @param params\n */\nfunction geometry(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart, options } = params;\n const { percent, range, radius, innerRadius, startAngle, endAngle, axis, indicator, gaugeStyle, type, meter } =\n options;\n const { color, width: rangeWidth } = range;\n\n // 指标 & 指针\n // 如果开启在应用\n if (indicator) {\n const indicatorData = getIndicatorData(percent);\n\n const v1 = chart.createView({ id: INDICATEOR_VIEW_ID });\n v1.data(indicatorData);\n\n v1.point()\n .position(`${PERCENT}*1`)\n .shape(indicator.shape || 'gauge-indicator')\n // 传入指针的样式到自定义 shape 中\n .customInfo({\n defaultColor: chart.getTheme().defaultColor,\n indicator,\n });\n\n v1.coordinate('polar', {\n startAngle,\n endAngle,\n radius: innerRadius * radius, // 外部的 innerRadius * radius = 这里的 radius\n });\n\n v1.axis(PERCENT, axis);\n // 一部分应用到 scale 中\n v1.scale(PERCENT, pick(axis, AXIS_META_CONFIG_KEYS));\n }\n\n // 辅助 range\n // [{ range: 1, type: '0', percent: 原始进度百分比 }]\n const rangeData = getRangeData(percent, options.range);\n const v2 = chart.createView({ id: RANGE_VIEW_ID });\n v2.data(rangeData);\n\n const rangeColor = isString(color) ? [color, DEFAULT_COLOR] : color;\n\n const { ext } = interval({\n chart: v2,\n options: {\n xField: '1',\n yField: RANGE_VALUE,\n seriesField: RANGE_TYPE,\n rawFields: [PERCENT],\n isStack: true,\n interval: {\n color: rangeColor,\n style: gaugeStyle,\n shape: type === 'meter' ? 'meter-gauge' : null,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n minColumnWidth: rangeWidth,\n maxColumnWidth: rangeWidth,\n },\n });\n\n const geometry = ext.geometry as Geometry;\n // 传入到自定义 shape 中\n geometry.customInfo({ meter });\n\n v2.coordinate('polar', {\n innerRadius,\n radius,\n startAngle,\n endAngle,\n }).transpose();\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<GaugeOptions>): Params<GaugeOptions> {\n return flow(\n scale({\n range: {\n min: 0,\n max: 1,\n maxLimit: 1,\n minLimit: 0,\n },\n [PERCENT]: {},\n })\n )(params);\n}\n\n/**\n * 统计指标文档\n * @param params\n */\nfunction statistic(params: Params<GaugeOptions>, updated?: boolean): Params<GaugeOptions> {\n const { chart, options } = params;\n const { statistic, percent } = options;\n\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n if (statistic) {\n const { content: contentOption } = statistic;\n let transformContent;\n // 当设置 content 的时候,设置默认样式\n if (contentOption) {\n transformContent = deepAssign(\n {},\n {\n content: `${(percent * 100).toFixed(2)}%`,\n style: {\n opacity: 0.75,\n fontSize: '30px',\n lineHeight: 1,\n textAlign: 'center',\n color: 'rgba(44,53,66,0.85)',\n },\n },\n contentOption\n );\n }\n renderGaugeStatistic(chart, { statistic: { ...statistic, content: transformContent } }, { percent });\n }\n\n if (updated) {\n chart.render(true);\n }\n\n return params;\n}\n\n/**\n * other 配置\n * @param params\n */\nfunction other(params: Params<GaugeOptions>): Params<GaugeOptions> {\n const { chart } = params;\n\n chart.legend(false);\n chart.tooltip(false);\n\n return params;\n}\n\n/**\n * 对外暴露的 adaptor\n */\nexport { statistic };\n\n/**\n * 图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<GaugeOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n theme,\n // animation 配置必须在 createView 之前,不然无法让子 View 生效\n animation,\n geometry,\n meta,\n statistic,\n interaction,\n annotation(),\n other\n // ... 其他的 adaptor flow\n )(params);\n}\n"]}
|
|
@@ -3,66 +3,128 @@ import { Axis } from '../../types/axis';
|
|
|
3
3
|
import { PERCENT, RANGE_TYPE, RANGE_VALUE } from './constants';
|
|
4
4
|
/** 指标指标的配置 */
|
|
5
5
|
export declare type Indicator = {
|
|
6
|
+
/**
|
|
7
|
+
* @title 指针
|
|
8
|
+
* @description 只允许静态的 object
|
|
9
|
+
*/
|
|
6
10
|
readonly pointer?: {
|
|
7
11
|
readonly style?: ShapeStyle;
|
|
8
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* @title 圆环
|
|
15
|
+
* @description 只允许静态的 object
|
|
16
|
+
*/
|
|
9
17
|
readonly pin?: {
|
|
10
18
|
readonly style?: ShapeStyle;
|
|
11
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* @title 自定义指针 shape
|
|
22
|
+
* @default 'gauge-indicator'
|
|
23
|
+
*/
|
|
12
24
|
readonly shape?: string;
|
|
13
25
|
};
|
|
14
26
|
export declare type Range = {
|
|
15
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* @title 辅助的刻度值
|
|
29
|
+
* @description 0 ~ 1 的数字
|
|
30
|
+
*/
|
|
16
31
|
readonly ticks?: number[];
|
|
17
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @title 辅助刻度的颜色配置
|
|
34
|
+
*/
|
|
18
35
|
readonly color?: string | string[];
|
|
19
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @title 仪表盘辅助背景的宽度
|
|
38
|
+
*/
|
|
20
39
|
readonly width?: number;
|
|
21
40
|
};
|
|
22
41
|
/**
|
|
23
|
-
* 仪表盘辅助生成的 rangeData
|
|
42
|
+
* @title 仪表盘辅助生成的 rangeData
|
|
24
43
|
*/
|
|
25
44
|
export declare type GaugeRangeData = {
|
|
26
45
|
readonly [RANGE_VALUE]?: number;
|
|
27
46
|
readonly [RANGE_TYPE]: string;
|
|
28
47
|
readonly [PERCENT]: number;
|
|
29
48
|
}[];
|
|
30
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* @title 仪表盘配置类型定义
|
|
51
|
+
*/
|
|
31
52
|
export interface GaugeOptions extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {
|
|
32
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* @title 指标的比例
|
|
55
|
+
* @description 范围0 ~ 1
|
|
56
|
+
*/
|
|
33
57
|
readonly percent: number;
|
|
34
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* @title 外弧度
|
|
60
|
+
* @description 范围0 ~ 1
|
|
61
|
+
*/
|
|
35
62
|
readonly radius?: number;
|
|
36
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* @title 内弧度
|
|
65
|
+
* @description 范围0 ~ 1
|
|
66
|
+
*/
|
|
37
67
|
readonly innerRadius?: number;
|
|
38
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* @title 弧度起始
|
|
70
|
+
*/
|
|
39
71
|
readonly startAngle?: number;
|
|
40
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* @title 弧度结束
|
|
74
|
+
*/
|
|
41
75
|
readonly endAngle?: number;
|
|
42
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* @title 辅助的 range 组件
|
|
78
|
+
*/
|
|
43
79
|
readonly range?: Range;
|
|
44
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* @title 坐标轴配置
|
|
82
|
+
*/
|
|
45
83
|
readonly axis?: Axis;
|
|
46
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* @title 指针的配置
|
|
86
|
+
*/
|
|
47
87
|
readonly indicator?: false | Indicator;
|
|
48
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* @title 统计文本
|
|
90
|
+
*/
|
|
49
91
|
readonly statistic?: Statistic;
|
|
50
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* @title 仪表盘样式
|
|
94
|
+
*/
|
|
51
95
|
readonly gaugeStyle?: StyleAttr;
|
|
52
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* @title meter gauge 相关配置
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* @title 仪表盘类型
|
|
101
|
+
* @description 可选项: 'meter', default 为空
|
|
102
|
+
*/
|
|
53
103
|
readonly type?: string;
|
|
54
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* @title 仪表盘配置
|
|
106
|
+
* @description 当仪表盘类型 = 'meter' 生效
|
|
107
|
+
*/
|
|
55
108
|
readonly meter?: {
|
|
56
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* @title 仪表盘总步数
|
|
111
|
+
* @default "50"
|
|
112
|
+
*/
|
|
57
113
|
readonly steps?: number;
|
|
58
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* @title step 与 gap 的宽度占比
|
|
116
|
+
* @default "0.5"
|
|
117
|
+
*/
|
|
59
118
|
readonly stepRatio?: number;
|
|
60
119
|
};
|
|
61
120
|
}
|
|
62
121
|
/**
|
|
63
|
-
* 仪表盘
|
|
122
|
+
* @title 仪表盘
|
|
123
|
+
* @description 自定义 shape 使用的 customInfo
|
|
64
124
|
*/
|
|
65
125
|
export declare type GaugeCustomInfo = {
|
|
66
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* @title 仪表盘 meter 类型的相关配置
|
|
128
|
+
*/
|
|
67
129
|
readonly meter?: GaugeOptions['meter'];
|
|
68
130
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/gauge/types.ts"],"names":[],"mappings":";;AAEA,yCAA+D","sourcesContent":["import { Options, ShapeStyle, Statistic, StyleAttr } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { PERCENT, RANGE_TYPE, RANGE_VALUE } from './constants';\n\n/** 指标指标的配置 */\nexport type Indicator = {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/gauge/types.ts"],"names":[],"mappings":";;AAEA,yCAA+D","sourcesContent":["import { Options, ShapeStyle, Statistic, StyleAttr } from '../../types';\nimport { Axis } from '../../types/axis';\nimport { PERCENT, RANGE_TYPE, RANGE_VALUE } from './constants';\n\n/** 指标指标的配置 */\nexport type Indicator = {\n /**\n * @title 指针\n * @description 只允许静态的 object\n */\n readonly pointer?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 圆环\n * @description 只允许静态的 object\n */\n readonly pin?: {\n readonly style?: ShapeStyle;\n };\n /**\n * @title 自定义指针 shape\n * @default 'gauge-indicator'\n */\n readonly shape?: string;\n};\n\nexport type Range = {\n /**\n * @title 辅助的刻度值\n * @description 0 ~ 1 的数字\n */\n readonly ticks?: number[];\n /**\n * @title 辅助刻度的颜色配置\n */\n readonly color?: string | string[];\n /**\n * @title 仪表盘辅助背景的宽度\n */\n readonly width?: number;\n};\n\n/**\n * @title 仪表盘辅助生成的 rangeData\n */\nexport type GaugeRangeData = {\n readonly [RANGE_VALUE]?: number;\n readonly [RANGE_TYPE]: string;\n readonly [PERCENT]: number;\n}[];\n\n/**\n * @title 仪表盘配置类型定义\n */\nexport interface GaugeOptions\n extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {\n /**\n * @title 指标的比例\n * @description 范围0 ~ 1\n */\n readonly percent: number;\n /**\n * @title 外弧度\n * @description 范围0 ~ 1\n */\n readonly radius?: number;\n /**\n * @title 内弧度\n * @description 范围0 ~ 1\n */\n readonly innerRadius?: number;\n /**\n * @title 弧度起始\n */\n readonly startAngle?: number;\n /**\n * @title 弧度结束\n */\n readonly endAngle?: number;\n /**\n * @title 辅助的 range 组件\n */\n readonly range?: Range;\n /**\n * @title 坐标轴配置\n */\n readonly axis?: Axis;\n /**\n * @title 指针的配置\n */\n readonly indicator?: false | Indicator;\n /**\n * @title 统计文本\n */\n readonly statistic?: Statistic;\n /**\n * @title 仪表盘样式\n */\n readonly gaugeStyle?: StyleAttr;\n\n /**\n * @title meter gauge 相关配置\n */\n\n /**\n * @title 仪表盘类型\n * @description 可选项: 'meter', default 为空\n */\n readonly type?: string;\n /**\n * @title 仪表盘配置\n * @description 当仪表盘类型 = 'meter' 生效\n */\n readonly meter?: {\n /**\n * @title 仪表盘总步数\n * @default \"50\"\n */\n readonly steps?: number;\n /**\n * @title step 与 gap 的宽度占比\n * @default \"0.5\"\n */\n readonly stepRatio?: number;\n };\n}\n\n/**\n * @title 仪表盘\n * @description 自定义 shape 使用的 customInfo\n */\nexport type GaugeCustomInfo = {\n /**\n * @title 仪表盘 meter 类型的相关配置\n */\n readonly meter?: GaugeOptions['meter'];\n};\n"]}
|
|
@@ -1,28 +1,63 @@
|
|
|
1
1
|
import { Types } from '@antv/g2';
|
|
2
2
|
import { Options, StyleAttr } from '../../types';
|
|
3
3
|
export interface HeatmapOptions extends Options {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @title 热力图类型
|
|
6
|
+
* @description 'polygon' | 'density'
|
|
7
|
+
*/
|
|
5
8
|
readonly type?: 'polygon' | 'density';
|
|
6
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* @title x轴字段
|
|
11
|
+
*/
|
|
7
12
|
readonly xField: string;
|
|
8
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @title y轴字段
|
|
15
|
+
*/
|
|
9
16
|
readonly yField: string;
|
|
10
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* @title 颜色字段
|
|
19
|
+
*/
|
|
11
20
|
readonly colorField?: string;
|
|
12
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @title 热力格子中的形状
|
|
23
|
+
*/
|
|
13
24
|
readonly shape?: string;
|
|
14
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* @title 热力格子中图形的尺寸比例
|
|
27
|
+
* @description 只有当 shape 和 sizeField 至少指定一项后才生效
|
|
28
|
+
*/
|
|
15
29
|
readonly sizeRatio?: number;
|
|
16
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* @title 坐标轴映射
|
|
32
|
+
* @description 坐标轴映射 'x' | 'y'
|
|
33
|
+
*/
|
|
17
34
|
readonly reflect?: 'x' | 'y';
|
|
18
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* @title 极坐标属性
|
|
37
|
+
*/
|
|
19
38
|
readonly coordinate?: Types.CoordinateOption;
|
|
20
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* @title 图例相关
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* @title 数据字段名
|
|
44
|
+
* @description 点大小映射对应的数据字段名
|
|
45
|
+
*/
|
|
21
46
|
readonly sizeField?: string;
|
|
22
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* @title size 对应的图例
|
|
49
|
+
*/
|
|
23
50
|
readonly sizeLegend?: Options['legend'];
|
|
24
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* @title 样式相关
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* @title 热力图形样式
|
|
56
|
+
*/
|
|
25
57
|
readonly heatmapStyle?: StyleAttr;
|
|
26
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* @title 贴图图案
|
|
60
|
+
* @description 在 type="density" 时不支持
|
|
61
|
+
*/
|
|
27
62
|
readonly pattern?: Options['pattern'];
|
|
28
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/heatmap/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { Options, StyleAttr } from '../../types';\n\nexport interface HeatmapOptions extends Options {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/heatmap/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { Options, StyleAttr } from '../../types';\n\nexport interface HeatmapOptions extends Options {\n /**\n * @title 热力图类型\n * @description 'polygon' | 'density'\n */\n readonly type?: 'polygon' | 'density';\n /**\n * @title x轴字段\n */\n readonly xField: string;\n /**\n * @title y轴字段\n */\n readonly yField: string;\n /**\n * @title 颜色字段\n */\n readonly colorField?: string;\n /**\n * @title 热力格子中的形状\n */\n readonly shape?: string;\n /**\n * @title 热力格子中图形的尺寸比例\n * @description 只有当 shape 和 sizeField 至少指定一项后才生效\n */\n readonly sizeRatio?: number;\n /**\n * @title 坐标轴映射\n * @description 坐标轴映射 'x' | 'y'\n */\n readonly reflect?: 'x' | 'y';\n /**\n * @title 极坐标属性\n */\n readonly coordinate?: Types.CoordinateOption;\n\n /**\n * @title 图例相关\n */\n\n /**\n * @title 数据字段名\n * @description 点大小映射对应的数据字段名\n */\n readonly sizeField?: string;\n /**\n * @title size 对应的图例\n */\n readonly sizeLegend?: Options['legend'];\n\n /**\n * @title 样式相关\n */\n\n /**\n * @title 热力图形样式\n */\n readonly heatmapStyle?: StyleAttr;\n /**\n * @title 贴图图案\n * @description 在 type=\"density\" 时不支持\n */\n readonly pattern?: Options['pattern'];\n}\n"]}
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { Options, StyleAttr } from '../../types';
|
|
2
2
|
export interface HistogramOptions extends Options {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @title 直方图绘制字段
|
|
5
|
+
* @description 设置直方图绘制 (进行分箱) 的字段
|
|
6
|
+
*/
|
|
4
7
|
readonly binField: string;
|
|
5
8
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
9
|
+
* @title 设置直方图的分箱宽度
|
|
10
|
+
* @description binWidth 影响直方图分成多少箱,不能与binNumber一起使用
|
|
8
11
|
*/
|
|
9
12
|
readonly binWidth?: number;
|
|
10
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @title 设置直方图的分箱数量
|
|
15
|
+
* @description binNumber 影响直方图分箱后每个柱子的宽度
|
|
16
|
+
*/
|
|
11
17
|
readonly binNumber?: number;
|
|
12
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @title 指定层叠字段
|
|
20
|
+
* @description 通过该字段的值,柱子将会被分割为多个部分,通过颜色进行区分
|
|
21
|
+
*/
|
|
13
22
|
readonly stackField?: string;
|
|
14
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* @title 柱子样式配置
|
|
25
|
+
*/
|
|
15
26
|
readonly columnStyle?: StyleAttr;
|
|
16
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/histogram/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr } from '../../types';\n\nexport interface HistogramOptions extends Options {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/histogram/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr } from '../../types';\n\nexport interface HistogramOptions extends Options {\n /**\n * @title 直方图绘制字段\n * @description 设置直方图绘制 (进行分箱) 的字段\n */\n readonly binField: string;\n\n /**\n * @title 设置直方图的分箱宽度\n * @description binWidth 影响直方图分成多少箱,不能与binNumber一起使用\n */\n readonly binWidth?: number;\n /**\n * @title 设置直方图的分箱数量\n * @description binNumber 影响直方图分箱后每个柱子的宽度\n */\n readonly binNumber?: number;\n /**\n * @title 指定层叠字段\n * @description 通过该字段的值,柱子将会被分割为多个部分,通过颜色进行区分\n */\n readonly stackField?: string;\n /**\n * @title 柱子样式配置\n */\n readonly columnStyle?: StyleAttr;\n}\n"]}
|
|
@@ -167,7 +167,7 @@ exports.adjust = adjust;
|
|
|
167
167
|
*/
|
|
168
168
|
function adaptor(params) {
|
|
169
169
|
// flow 的方式处理所有的配置到 G2 API
|
|
170
|
-
return utils_2.flow(geometry, meta, adjust, common_1.theme, coordinate, axis, legend, common_1.tooltip, label, common_1.slider, common_1.interaction, common_1.animation, common_1.annotation(), common_1.limitInPlot)(params);
|
|
170
|
+
return utils_2.flow(geometry, meta, adjust, common_1.theme, coordinate, axis, legend, common_1.tooltip, label, common_1.slider, common_1.scrollbar, common_1.interaction, common_1.animation, common_1.annotation(), common_1.limitInPlot)(params);
|
|
171
171
|
}
|
|
172
172
|
exports.adaptor = adaptor;
|
|
173
173
|
//# sourceMappingURL=adaptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/line/adaptor.ts"],"names":[],"mappings":";;;;AACA,mCAA2C;AAE3C,+
|
|
1
|
+
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/line/adaptor.ts"],"names":[],"mappings":";;;;AACA,mCAA2C;AAE3C,+CAU8B;AAC9B,qCAAuE;AACvE,uDAA6D;AAC7D,qCAAmC;AACnC,yCAAqD;AAGrD;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA2B;IACnC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAA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K,EACL,UAAU,EACV,IAAI,EACJ,MAAM,EACN,gBAAO,EACP,KAAK,EACL,eAAM,EACN,kBAAS,EACT,oBAAW,EACX,kBAAS,EACT,mBAAU,EAAE,EACZ,oBAAW,CACZ,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAnBD,0BAmBC","sourcesContent":["import { Geometry } from '@antv/g2';\nimport { each, isArray } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport {\n tooltip,\n slider,\n interaction,\n animation,\n theme,\n scale,\n annotation,\n limitInPlot,\n scrollbar,\n} from '../../adaptor/common';\nimport { findGeometry, transformLabel, deepAssign } from '../../utils';\nimport { point, line, area } from '../../adaptor/geometries';\nimport { flow } from '../../utils';\nimport { adjustYMetaByZero } from '../../utils/data';\nimport { LineOptions } from './types';\n\n/**\n * geometry 配置处理\n * @param params\n */\nfunction geometry(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { data, color, lineStyle, lineShape, point: pointMapping, area: areaMapping, seriesField } = options;\n const pointState = pointMapping?.state;\n const areaState = areaMapping?.state;\n\n chart.data(data);\n\n // line geometry 处理\n const primary = deepAssign({}, params, {\n options: {\n shapeField: seriesField,\n line: {\n color,\n style: lineStyle,\n shape: lineShape,\n },\n // 颜色保持一致,因为如果颜色不一致,会导致 tooltip 中元素重复。\n // 如果存在,才设置,否则为空\n point: pointMapping && {\n color,\n shape: 'circle',\n ...pointMapping,\n },\n // 面积配置\n area: areaMapping && {\n color,\n ...areaMapping,\n },\n // label 不传递给各个 geometry adaptor,由 label adaptor 处理\n label: undefined,\n },\n });\n const second = deepAssign({}, primary, { options: { tooltip: false, state: pointState } });\n const areaParams = deepAssign({}, primary, { options: { tooltip: false, state: areaState } });\n\n line(primary);\n point(second);\n area(areaParams);\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nexport function meta(params: Params<LineOptions>): Params<LineOptions> {\n const { options } = params;\n const { xAxis, yAxis, xField, yField, data } = options;\n\n return flow(\n scale(\n {\n [xField]: xAxis,\n [yField]: yAxis,\n },\n {\n [xField]: {\n type: 'cat',\n },\n [yField]: adjustYMetaByZero(data, yField),\n }\n )\n )(params);\n}\n\n/**\n * 坐标系配置. 支持 reflect 镜像处理\n * @param params\n */\nfunction coordinate(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { reflect } = options;\n if (reflect) {\n let p = reflect as any;\n if (!isArray(p)) {\n p = [p];\n }\n const actions = p.map((d) => ['reflect', d]);\n\n chart.coordinate({ type: 'rect', actions });\n }\n\n return params;\n}\n\n/**\n * axis 配置\n * @param params\n */\nexport function axis(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { xAxis, yAxis, xField, yField } = options;\n\n // 为 false 则是不显示轴\n if (xAxis === false) {\n chart.axis(xField, false);\n } else {\n chart.axis(xField, xAxis);\n }\n\n if (yAxis === false) {\n chart.axis(yField, false);\n } else {\n chart.axis(yField, yAxis);\n }\n\n return params;\n}\n\n/**\n * legend 配置\n * @param params\n */\nexport function legend(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { legend, seriesField } = options;\n\n if (legend && seriesField) {\n chart.legend(seriesField, legend);\n } else if (legend === false) {\n chart.legend(false);\n }\n\n return params;\n}\n\n/**\n * 数据标签\n * @param params\n */\nfunction label(params: Params<LineOptions>): Params<LineOptions> {\n const { chart, options } = params;\n const { label, yField } = options;\n\n const lineGeometry = findGeometry(chart, 'line');\n\n // label 为 false, 空 则不显示 label\n if (!label) {\n lineGeometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n lineGeometry.label({\n fields: [yField],\n callback,\n cfg: {\n layout: [\n { type: 'limit-in-plot' },\n { type: 'path-adjust-position' },\n { type: 'point-adjust-position' },\n { type: 'limit-in-plot', cfg: { action: 'hide' } },\n ],\n ...transformLabel(cfg),\n },\n });\n }\n\n return params;\n}\n\n/**\n * 统一处理 adjust\n * @param params\n */\nexport function adjust(params: Params<Pick<LineOptions, 'isStack'>>): Params<any> {\n const { chart, options } = params;\n const { isStack } = options;\n\n if (isStack) {\n each(chart.geometries, (g: Geometry) => {\n g.adjust('stack');\n });\n }\n\n return params;\n}\n\n/**\n * 折线图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<LineOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow(\n geometry,\n meta,\n adjust,\n theme,\n coordinate,\n axis,\n legend,\n tooltip,\n label,\n slider,\n scrollbar,\n interaction,\n animation,\n annotation(),\n limitInPlot\n )(params);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/line/constants.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,CAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,GAAG;SACV;KACF;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plots/line/constants.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,CAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,GAAG;SACV;KACF;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,EAAE;KACV;IACD,OAAO,EAAE,KAAK;CACf,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 折线图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n tooltip: {\n shared: true,\n showMarkers: true,\n showCrosshairs: true,\n crosshairs: {\n type: 'x',\n },\n },\n legend: {\n position: 'top-left',\n radio: {},\n },\n isStack: false,\n});\n"]}
|
|
@@ -1,28 +1,58 @@
|
|
|
1
1
|
import { GeometryOptions, AreaGeometryOptions, LineGeometryOptions, PointGeometryOptions } from '../../adaptor/geometries';
|
|
2
2
|
import { Options, StyleAttr } from '../../types';
|
|
3
3
|
export interface LineOptions extends Options, Pick<GeometryOptions, 'customInfo'> {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @title 阶梯折线图类型
|
|
6
|
+
*/
|
|
5
7
|
readonly stepType?: string;
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @title x轴字段
|
|
10
|
+
*/
|
|
7
11
|
readonly xField?: string;
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @title y轴字段
|
|
14
|
+
*/
|
|
9
15
|
readonly yField?: string;
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @title 分组字段
|
|
18
|
+
*/
|
|
11
19
|
readonly seriesField?: string;
|
|
12
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* @title 是否堆积
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
13
24
|
readonly isStack?: boolean;
|
|
14
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* @title 是否平滑
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
15
29
|
readonly smooth?: boolean;
|
|
16
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* @title 是否连接空数据
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
17
34
|
readonly connectNulls?: boolean;
|
|
18
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* @title 折线图形样式
|
|
37
|
+
*/
|
|
19
38
|
readonly lineStyle?: StyleAttr;
|
|
20
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* @title 折线 shape 配置
|
|
41
|
+
*/
|
|
21
42
|
readonly lineShape?: Required<LineGeometryOptions>['line']['shape'];
|
|
22
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* @title 折线数据点
|
|
45
|
+
* @description 1、图形映射属性 2、状态样式
|
|
46
|
+
*/
|
|
23
47
|
readonly point?: PointGeometryOptions['point'] & Pick<PointGeometryOptions, 'state'>;
|
|
24
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* @title 折线趋势填充色
|
|
50
|
+
* @description 1、图形映射属性
|
|
51
|
+
*/
|
|
25
52
|
readonly area?: AreaGeometryOptions['area'] & Pick<PointGeometryOptions, 'state'>;
|
|
26
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* @title 坐标轴反转配置
|
|
55
|
+
* @description 坐标轴反转配置 'x' | 'y' | ['x', 'y']
|
|
56
|
+
*/
|
|
27
57
|
readonly reflect?: 'x' | 'y' | ['x', 'y'];
|
|
28
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/line/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n GeometryOptions,\n AreaGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n} from '../../adaptor/geometries';\nimport { Options, StyleAttr } from '../../types';\n\nexport interface LineOptions extends Options, Pick<GeometryOptions, 'customInfo'> {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/line/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n GeometryOptions,\n AreaGeometryOptions,\n LineGeometryOptions,\n PointGeometryOptions,\n} from '../../adaptor/geometries';\nimport { Options, StyleAttr } from '../../types';\n\nexport interface LineOptions extends Options, Pick<GeometryOptions, 'customInfo'> {\n /**\n * @title 阶梯折线图类型\n */\n readonly stepType?: string;\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 isStack?: boolean;\n /**\n * @title 是否平滑\n * @default false\n */\n readonly smooth?: boolean;\n /**\n * @title 是否连接空数据\n * @default false\n */\n readonly connectNulls?: boolean;\n /**\n * @title 折线图形样式\n */\n readonly lineStyle?: StyleAttr;\n /**\n * @title 折线 shape 配置\n */\n readonly lineShape?: Required<LineGeometryOptions>['line']['shape'];\n /**\n * @title 折线数据点\n * @description 1、图形映射属性 2、状态样式\n */\n readonly point?: PointGeometryOptions['point'] & Pick<PointGeometryOptions, 'state'>;\n /**\n * @title 折线趋势填充色\n * @description 1、图形映射属性\n */\n readonly area?: AreaGeometryOptions['area'] & Pick<PointGeometryOptions, 'state'>;\n /**\n * @title 坐标轴反转配置\n * @description 坐标轴反转配置 'x' | 'y' | ['x', 'y']\n */\n readonly reflect?: 'x' | 'y' | ['x', 'y'];\n}\n"]}
|
|
@@ -13,7 +13,7 @@ var utils_2 = require("./utils");
|
|
|
13
13
|
*/
|
|
14
14
|
function geometry(params) {
|
|
15
15
|
var chart = params.chart, options = params.options;
|
|
16
|
-
var percent = options.percent, liquidStyle = options.liquidStyle, radius = options.radius, outline = options.outline, wave = options.wave, shape = options.shape;
|
|
16
|
+
var percent = options.percent, liquidStyle = options.liquidStyle, radius = options.radius, outline = options.outline, wave = options.wave, shape = options.shape, animation = options.animation;
|
|
17
17
|
chart.scale({
|
|
18
18
|
percent: {
|
|
19
19
|
min: 0,
|
|
@@ -45,6 +45,7 @@ function geometry(params) {
|
|
|
45
45
|
wave: wave,
|
|
46
46
|
shape: shape,
|
|
47
47
|
background: background,
|
|
48
|
+
animation: animation,
|
|
48
49
|
};
|
|
49
50
|
// 将 radius 传入到自定义 shape 中
|
|
50
51
|
geometry.customInfo(customInfo);
|