@antv/g2plot 2.4.20 → 2.4.22
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 +1626 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/dist/g2plot.min.js +2 -2
- package/dist/g2plot.min.js.map +1 -1
- package/esm/adaptor/common.js +2 -11
- package/esm/adaptor/common.js.map +1 -1
- package/esm/adaptor/geometries/base.d.ts +2 -2
- package/esm/adaptor/geometries/base.js +3 -1
- package/esm/adaptor/geometries/base.js.map +1 -1
- package/esm/adaptor/pattern.d.ts +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/plots/box/adaptor.js +2 -2
- package/esm/plots/box/adaptor.js.map +1 -1
- package/esm/plots/chord/adaptor.js +2 -13
- package/esm/plots/chord/adaptor.js.map +1 -1
- package/esm/plots/chord/constant.d.ts +4 -4
- package/esm/plots/chord/constant.js +4 -4
- package/esm/plots/chord/constant.js.map +1 -1
- package/esm/plots/column/adaptor.js +3 -1
- package/esm/plots/column/adaptor.js.map +1 -1
- package/esm/plots/facet/types.d.ts +1 -2
- package/esm/plots/facet/types.js.map +1 -1
- package/esm/plots/facet/utils.js +2 -11
- package/esm/plots/facet/utils.js.map +1 -1
- package/esm/plots/funnel/adaptor.d.ts +5 -0
- package/esm/plots/funnel/adaptor.js +31 -2
- package/esm/plots/funnel/adaptor.js.map +1 -1
- package/esm/plots/funnel/geometries/basic.d.ts +5 -0
- package/esm/plots/funnel/geometries/basic.js +8 -4
- package/esm/plots/funnel/geometries/basic.js.map +1 -1
- package/esm/plots/funnel/geometries/common.d.ts +1 -0
- package/esm/plots/funnel/geometries/common.js +5 -2
- package/esm/plots/funnel/geometries/common.js.map +1 -1
- package/esm/plots/funnel/geometries/compare.d.ts +1 -0
- package/esm/plots/funnel/geometries/compare.js +37 -30
- package/esm/plots/funnel/geometries/compare.js.map +1 -1
- package/esm/plots/funnel/index.d.ts +1 -0
- package/esm/plots/funnel/index.js +1 -0
- package/esm/plots/funnel/index.js.map +1 -1
- package/esm/plots/funnel/interactions/funnel-conversion-tag.d.ts +9 -0
- package/esm/plots/funnel/interactions/funnel-conversion-tag.js +57 -0
- package/esm/plots/funnel/interactions/funnel-conversion-tag.js.map +1 -0
- package/esm/plots/funnel/interactions/index.d.ts +5 -0
- package/esm/plots/funnel/interactions/index.js +10 -0
- package/esm/plots/funnel/interactions/index.js.map +1 -0
- package/esm/plots/funnel/types.d.ts +1 -0
- package/esm/plots/funnel/types.js.map +1 -1
- package/esm/plots/gauge/utils.js +6 -5
- package/esm/plots/gauge/utils.js.map +1 -1
- package/esm/plots/heatmap/adaptor.js +9 -11
- package/esm/plots/heatmap/adaptor.js.map +1 -1
- package/esm/plots/histogram/adaptor.js +3 -0
- package/esm/plots/histogram/adaptor.js.map +1 -1
- package/esm/plots/pie/adaptor.js +3 -1
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/pie/types.d.ts +6 -1
- package/esm/plots/pie/types.js.map +1 -1
- package/esm/plots/progress/adaptor.js +1 -2
- package/esm/plots/progress/adaptor.js.map +1 -1
- package/esm/plots/progress/utils.d.ts +1 -0
- package/esm/plots/progress/utils.js +4 -1
- package/esm/plots/progress/utils.js.map +1 -1
- package/esm/plots/sankey/adaptor.js +2 -11
- package/esm/plots/sankey/adaptor.js.map +1 -1
- package/esm/plots/stock/utils.d.ts +3 -1
- package/esm/plots/stock/utils.js +4 -2
- package/esm/plots/stock/utils.js.map +1 -1
- package/esm/plots/violin/adaptor.js +2 -10
- package/esm/plots/violin/adaptor.js.map +1 -1
- package/esm/types/common.d.ts +4 -3
- package/esm/types/common.js.map +1 -1
- package/esm/utils/conversion.js +4 -3
- package/esm/utils/conversion.js.map +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/view.d.ts +8 -1
- package/esm/utils/view.js +27 -0
- package/esm/utils/view.js.map +1 -1
- package/lib/adaptor/common.js +1 -10
- package/lib/adaptor/common.js.map +1 -1
- package/lib/adaptor/geometries/base.d.ts +2 -2
- package/lib/adaptor/geometries/base.js +3 -1
- package/lib/adaptor/geometries/base.js.map +1 -1
- package/lib/adaptor/pattern.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/box/adaptor.js +1 -1
- package/lib/plots/box/adaptor.js.map +1 -1
- package/lib/plots/chord/adaptor.js +1 -12
- package/lib/plots/chord/adaptor.js.map +1 -1
- package/lib/plots/chord/constant.d.ts +4 -4
- package/lib/plots/chord/constant.js +4 -4
- package/lib/plots/chord/constant.js.map +1 -1
- package/lib/plots/column/adaptor.js +3 -1
- package/lib/plots/column/adaptor.js.map +1 -1
- package/lib/plots/facet/types.d.ts +1 -2
- package/lib/plots/facet/types.js.map +1 -1
- package/lib/plots/facet/utils.js +1 -10
- package/lib/plots/facet/utils.js.map +1 -1
- package/lib/plots/funnel/adaptor.d.ts +5 -0
- package/lib/plots/funnel/adaptor.js +32 -2
- package/lib/plots/funnel/adaptor.js.map +1 -1
- package/lib/plots/funnel/geometries/basic.d.ts +5 -0
- package/lib/plots/funnel/geometries/basic.js +8 -3
- package/lib/plots/funnel/geometries/basic.js.map +1 -1
- package/lib/plots/funnel/geometries/common.d.ts +1 -0
- package/lib/plots/funnel/geometries/common.js +6 -3
- package/lib/plots/funnel/geometries/common.js.map +1 -1
- package/lib/plots/funnel/geometries/compare.d.ts +1 -0
- package/lib/plots/funnel/geometries/compare.js +38 -30
- package/lib/plots/funnel/geometries/compare.js.map +1 -1
- package/lib/plots/funnel/index.d.ts +1 -0
- package/lib/plots/funnel/index.js +1 -0
- package/lib/plots/funnel/index.js.map +1 -1
- package/lib/plots/funnel/interactions/funnel-conversion-tag.d.ts +9 -0
- package/lib/plots/funnel/interactions/funnel-conversion-tag.js +60 -0
- package/lib/plots/funnel/interactions/funnel-conversion-tag.js.map +1 -0
- package/lib/plots/funnel/interactions/index.d.ts +5 -0
- package/lib/plots/funnel/interactions/index.js +13 -0
- package/lib/plots/funnel/interactions/index.js.map +1 -0
- package/lib/plots/funnel/types.d.ts +1 -0
- package/lib/plots/funnel/types.js.map +1 -1
- package/lib/plots/gauge/utils.js +5 -4
- package/lib/plots/gauge/utils.js.map +1 -1
- package/lib/plots/heatmap/adaptor.js +8 -10
- package/lib/plots/heatmap/adaptor.js.map +1 -1
- package/lib/plots/histogram/adaptor.js +3 -0
- package/lib/plots/histogram/adaptor.js.map +1 -1
- package/lib/plots/pie/adaptor.js +3 -1
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/pie/types.d.ts +6 -1
- package/lib/plots/pie/types.js.map +1 -1
- package/lib/plots/progress/adaptor.js +1 -2
- package/lib/plots/progress/adaptor.js.map +1 -1
- package/lib/plots/progress/utils.d.ts +1 -0
- package/lib/plots/progress/utils.js +4 -1
- package/lib/plots/progress/utils.js.map +1 -1
- package/lib/plots/sankey/adaptor.js +2 -11
- package/lib/plots/sankey/adaptor.js.map +1 -1
- package/lib/plots/stock/utils.d.ts +3 -1
- package/lib/plots/stock/utils.js +4 -2
- package/lib/plots/stock/utils.js.map +1 -1
- package/lib/plots/violin/adaptor.js +2 -10
- package/lib/plots/violin/adaptor.js.map +1 -1
- package/lib/types/common.d.ts +4 -3
- package/lib/types/common.js.map +1 -1
- package/lib/utils/conversion.js +4 -3
- package/lib/utils/conversion.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/view.d.ts +8 -1
- package/lib/utils/view.js +29 -1
- package/lib/utils/view.js.map +1 -1
- package/package.json +4 -2
- package/src/adaptor/common.ts +2 -11
- package/src/adaptor/geometries/base.ts +5 -3
- package/src/index.ts +1 -1
- package/src/plots/box/adaptor.ts +2 -2
- package/src/plots/chord/adaptor.ts +2 -14
- package/src/plots/chord/constant.ts +4 -4
- package/src/plots/column/adaptor.ts +3 -1
- package/src/plots/facet/types.ts +1 -1
- package/src/plots/facet/utils.ts +4 -12
- package/src/plots/funnel/adaptor.ts +32 -2
- package/src/plots/funnel/geometries/basic.ts +10 -5
- package/src/plots/funnel/geometries/common.ts +6 -3
- package/src/plots/funnel/geometries/compare.ts +50 -41
- package/src/plots/funnel/index.ts +1 -0
- package/src/plots/funnel/interactions/funnel-conversion-tag.ts +57 -0
- package/src/plots/funnel/interactions/index.ts +11 -0
- package/src/plots/funnel/types.ts +1 -0
- package/src/plots/gauge/utils.ts +5 -4
- package/src/plots/heatmap/adaptor.ts +10 -11
- package/src/plots/histogram/adaptor.ts +2 -0
- package/src/plots/pie/adaptor.ts +3 -1
- package/src/plots/pie/types.ts +6 -1
- package/src/plots/progress/adaptor.ts +1 -2
- package/src/plots/progress/utils.ts +4 -1
- package/src/plots/sankey/adaptor.ts +2 -11
- package/src/plots/stock/utils.ts +4 -3
- package/src/plots/violin/adaptor.ts +2 -11
- package/src/types/common.ts +5 -3
- package/src/utils/conversion.ts +6 -3
- package/src/utils/index.ts +1 -0
- package/src/utils/view.ts +34 -1
package/lib/utils/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/utils/view.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/utils/view.ts"],"names":[],"mappings":";;;AACA,mCAA8C;AAI9C;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAW,EAAE,EAAU;IAClD,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAC,IAAU,IAAK,OAAA,IAAI,CAAC,EAAE,KAAK,EAAE,EAAd,CAAc,CAAC,CAAC;AAC1D,CAAC;AAFD,oCAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAU;IACjC,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC;AAHD,4BAGC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,IAAU;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,KAAK,IAAI,EAAZ,CAAY,CAAC,CAAC;AACtD,CAAC;AAFD,0CAEC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,IAAU,EACV,SAA+B,EAC/B,UAA0D;IAA1D,2BAAA,EAAA,aAA2C,IAAI,CAAC,UAAU;IAE1D,mBAAmB;IACnB,IAAI,OAAO,SAAS,KAAK,SAAS,EAAE;QAClC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;KACzB;SAAM;QACL,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,sCAAsC;IACtC,WAAI,CAAC,UAAU,EAAE,UAAC,CAAW;QAC3B,IAAI,YAAY,CAAC;QACjB,IAAI,iBAAU,CAAC,SAAS,CAAC,EAAE;YACzB,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;SAC5D;aAAM;YACL,YAAY,GAAG,SAAS,CAAC;SAC1B;QAED,CAAC,CAAC,OAAO,CAAC,YAAyB,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAvBD,4CAuBC","sourcesContent":["import { Geometry, View, Types } from '@antv/g2';\nimport { each, isFunction } from '@antv/util';\nimport { Options } from '../types';\nimport { Animation } from '../types/animation';\n\n/**\n * 在 Chart 中查找特定 id 的子 View\n * @param chart\n * @param id\n */\nexport function findViewById(chart: View, id: string): View {\n return chart.views.find((view: View) => view.id === id);\n}\n\n/**\n * 获取同 view 同一级的所有 views\n * @param view 当前 view\n * @returns 同一级的 views\n * @ignore\n */\nexport function getViews(view: View): View[] {\n const parent = view.parent;\n return parent ? parent.views : [];\n}\n\n/**\n * 获取同 view 同一级的 views,不包括自身\n * @param view 当前 view\n * @returns 同一级的 views\n * @ignore\n */\nexport function getSiblingViews(view: View): View[] {\n return getViews(view).filter((sub) => sub !== view);\n}\n\n/**\n * 所有的 Geometries 都使用同一动画(各个图形如有区别,自行覆盖)并添加处理动画回调\n * @param view View\n * @param animation 动画配置\n */\nexport function addViewAnimation(\n view: View,\n animation: Options['animation'],\n geometries: Geometry<Types.ShapePoint>[] = view.geometries\n) {\n // 同时设置整个 view 动画选项\n if (typeof animation === 'boolean') {\n view.animate(animation);\n } else {\n view.animate(true);\n }\n\n // 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)\n each(geometries, (g: Geometry) => {\n let animationCfg;\n if (isFunction(animation)) {\n animationCfg = animation(g.type || g.shapeType, g) || true;\n } else {\n animationCfg = animation;\n }\n\n g.animate(animationCfg as Animation);\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g2plot",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.22",
|
|
4
4
|
"description": "An interactive and responsive charting library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -160,6 +160,8 @@
|
|
|
160
160
|
"monaco-editor": "0.21.3",
|
|
161
161
|
"@babel/plugin-transform-spread": "7.12.1",
|
|
162
162
|
"@babel/standalone": "7.12.6",
|
|
163
|
-
"d3-array": "2.12.1"
|
|
163
|
+
"d3-array": "2.12.1",
|
|
164
|
+
"remark-mdx": "1.6.22",
|
|
165
|
+
"@types/lodash": "4.14.182"
|
|
164
166
|
}
|
|
165
167
|
}
|
package/src/adaptor/common.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Interaction } from '../types/interaction';
|
|
|
6
6
|
import { Transformations } from '../types/coordinate';
|
|
7
7
|
import { Axis } from '../types/axis';
|
|
8
8
|
import { AXIS_META_CONFIG_KEYS } from '../constant';
|
|
9
|
-
import { pick, deepAssign } from '../utils';
|
|
9
|
+
import { pick, deepAssign, addViewAnimation } from '../utils';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 通用 legend 配置, 适用于带 colorField 或 seriesField 的图表
|
|
@@ -69,17 +69,8 @@ export function animation<O extends Pick<Options, 'animation'>>(params: Params<O
|
|
|
69
69
|
const { chart, options } = params;
|
|
70
70
|
const { animation } = options;
|
|
71
71
|
|
|
72
|
-
// 同时设置整个 view 动画选项
|
|
73
|
-
if (typeof animation === 'boolean') {
|
|
74
|
-
chart.animate(animation);
|
|
75
|
-
} else {
|
|
76
|
-
chart.animate(true);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
72
|
// 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)
|
|
80
|
-
|
|
81
|
-
g.animate(animation);
|
|
82
|
-
});
|
|
73
|
+
addViewAnimation(chart, animation);
|
|
83
74
|
|
|
84
75
|
return params;
|
|
85
76
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { uniq, isFunction, isObject, isString, isNumber, isEmpty } from '@antv/util';
|
|
2
2
|
import { Params } from '../../core/adaptor';
|
|
3
|
-
import { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum } from '../../types';
|
|
3
|
+
import { ColorAttr, ShapeAttr, SizeAttr, StyleAttr, TooltipAttr, Options, Datum, RawFields } from '../../types';
|
|
4
4
|
import { Label } from '../../types/label';
|
|
5
5
|
import { State } from '../../types/state';
|
|
6
6
|
import { transformLabel } from '../../utils';
|
|
@@ -43,7 +43,7 @@ export type Geometry = {
|
|
|
43
43
|
/** tooltip 的映射字段 */
|
|
44
44
|
readonly tooltipFields?: string[] | false;
|
|
45
45
|
/** 其他原始字段, 用于 mapping 回调参数 */
|
|
46
|
-
readonly rawFields?:
|
|
46
|
+
readonly rawFields?: RawFields;
|
|
47
47
|
/** 图形映射规则 */
|
|
48
48
|
readonly mapping?: MappingOptions;
|
|
49
49
|
/** label 映射通道,因为历史原因导致实现略有区别 */
|
|
@@ -73,9 +73,11 @@ export function getMappingField(
|
|
|
73
73
|
mappingFields: string[];
|
|
74
74
|
tileMappingField: string;
|
|
75
75
|
} {
|
|
76
|
-
const { type, xField, yField, colorField, shapeField, sizeField, styleField
|
|
76
|
+
const { type, xField, yField, colorField, shapeField, sizeField, styleField } = o;
|
|
77
|
+
let { rawFields } = o;
|
|
77
78
|
|
|
78
79
|
let fields = [];
|
|
80
|
+
rawFields = (isFunction(rawFields) ? rawFields(type, field) : rawFields) || [];
|
|
79
81
|
|
|
80
82
|
// 因为 color 会影响到数据分组,以及最后的图形映射。所以导致 bar 图中的 widthRatio 设置不生效
|
|
81
83
|
// 所以对于 color 字段,仅仅保留 colorField 好了! + rawFields
|
package/src/index.ts
CHANGED
package/src/plots/box/adaptor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isArray } from '@antv/util';
|
|
2
2
|
import { Types } from '@antv/g2';
|
|
3
3
|
import { Params } from '../../core/adaptor';
|
|
4
|
-
import { interaction, animation, theme, tooltip } from '../../adaptor/common';
|
|
4
|
+
import { interaction, animation, theme, tooltip, annotation } from '../../adaptor/common';
|
|
5
5
|
import { point, schema } from '../../adaptor/geometries';
|
|
6
6
|
import { flow, pick, deepAssign } from '../../utils';
|
|
7
7
|
import { AXIS_META_CONFIG_KEYS } from '../../constant';
|
|
@@ -167,5 +167,5 @@ export function legend(params: Params<BoxOptions>): Params<BoxOptions> {
|
|
|
167
167
|
* @param params
|
|
168
168
|
*/
|
|
169
169
|
export function adaptor(params: Params<BoxOptions>) {
|
|
170
|
-
return flow(field, outliersPoint, meta, axis, legend, tooltip, interaction, animation, theme)(params);
|
|
170
|
+
return flow(field, outliersPoint, meta, axis, legend, tooltip, annotation(), interaction, animation, theme)(params);
|
|
171
171
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Geometry } from '@antv/g2';
|
|
2
|
-
import { each } from '@antv/util';
|
|
3
1
|
import { interaction, theme, state } from '../../adaptor/common';
|
|
4
2
|
import { Params } from '../../core/adaptor';
|
|
5
3
|
import { flow, pick } from '../../utils';
|
|
6
4
|
import { polygon, edge } from '../../adaptor/geometries';
|
|
7
5
|
import { chordLayout } from '../../utils/transform/chord';
|
|
8
|
-
import { getAllGeometriesRecursively, transformDataToNodeLinkData } from '../../utils';
|
|
6
|
+
import { getAllGeometriesRecursively, transformDataToNodeLinkData, addViewAnimation } from '../../utils';
|
|
9
7
|
import { ChordOptions } from './types';
|
|
10
8
|
import { X_FIELD, Y_FIELD, NODE_COLOR_FIELD, EDGE_COLOR_FIELD } from './constant';
|
|
11
9
|
|
|
@@ -170,17 +168,7 @@ function animation(params: Params<ChordOptions>): Params<ChordOptions> {
|
|
|
170
168
|
const { chart, options } = params;
|
|
171
169
|
const { animation } = options;
|
|
172
170
|
|
|
173
|
-
|
|
174
|
-
if (typeof animation === 'boolean') {
|
|
175
|
-
chart.animate(animation);
|
|
176
|
-
} else {
|
|
177
|
-
chart.animate(true);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// 所有的 Geometry 都使用同一动画(各个图形如有区别,自行覆盖)
|
|
181
|
-
each(getAllGeometriesRecursively(chart), (g: Geometry) => {
|
|
182
|
-
g.animate(animation);
|
|
183
|
-
});
|
|
171
|
+
addViewAnimation(chart, animation, getAllGeometriesRecursively(chart));
|
|
184
172
|
|
|
185
173
|
return params;
|
|
186
174
|
}
|
|
@@ -22,14 +22,14 @@ export const DEFAULT_OPTIONS = {
|
|
|
22
22
|
const centerX = (x[0] + x[1]) / 2;
|
|
23
23
|
const offsetX = centerX > 0.5 ? -4 : 4;
|
|
24
24
|
return {
|
|
25
|
-
labelEmit: true,
|
|
26
|
-
style: {
|
|
27
|
-
fill: '#8c8c8c',
|
|
28
|
-
},
|
|
29
25
|
offsetX,
|
|
30
26
|
content: name,
|
|
31
27
|
};
|
|
32
28
|
},
|
|
29
|
+
labelEmit: true,
|
|
30
|
+
style: {
|
|
31
|
+
fill: '#8c8c8c',
|
|
32
|
+
},
|
|
33
33
|
},
|
|
34
34
|
tooltip: {
|
|
35
35
|
showTitle: false,
|
|
@@ -251,6 +251,7 @@ function columnTooltip(params: Params<ColumnOptions>): Params<ColumnOptions> {
|
|
|
251
251
|
let tooltipOptions = tooltip;
|
|
252
252
|
// fix: https://github.com/antvis/G2Plot/issues/2572
|
|
253
253
|
if (isGroup && isStack) {
|
|
254
|
+
const { customItems } = tooltipOptions;
|
|
254
255
|
const tooltipFormatter =
|
|
255
256
|
tooltipOptions?.formatter ||
|
|
256
257
|
((datum: Datum) => ({ name: `${datum[seriesField]} - ${datum[groupField]}`, value: datum[yField] }));
|
|
@@ -271,7 +272,8 @@ function columnTooltip(params: Params<ColumnOptions>): Params<ColumnOptions> {
|
|
|
271
272
|
});
|
|
272
273
|
});
|
|
273
274
|
});
|
|
274
|
-
|
|
275
|
+
// fix https://github.com/antvis/G2Plot/issues/3367
|
|
276
|
+
return customItems ? customItems(items) : items;
|
|
275
277
|
},
|
|
276
278
|
};
|
|
277
279
|
}
|
package/src/plots/facet/types.ts
CHANGED
package/src/plots/facet/utils.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { View } from '@antv/g2';
|
|
2
2
|
import { each } from '@antv/util';
|
|
3
3
|
import { geometry as geometryAdaptor } from '../../adaptor/geometries/base';
|
|
4
4
|
import { AXIS_META_CONFIG_KEYS } from '../../constant';
|
|
5
|
-
import { pick, deepAssign } from '../../utils';
|
|
6
|
-
import { Axis, Interaction } from '../../types';
|
|
5
|
+
import { pick, deepAssign, addViewAnimation } from '../../utils';
|
|
6
|
+
import { Axis, Interaction, Options } from '../../types';
|
|
7
7
|
import { IView } from './types';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -74,15 +74,7 @@ export function execViewAdaptor(viewOfG2: View, options: IView): void {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
// 7. animation (先做动画)
|
|
77
|
-
|
|
78
|
-
viewOfG2.animate(false);
|
|
79
|
-
} else {
|
|
80
|
-
viewOfG2.animate(true);
|
|
81
|
-
// 所有的 Geometry 都使用同一动画(各个图形如有区别,todo 自行覆盖)
|
|
82
|
-
each(viewOfG2.geometries, (g: Geometry) => {
|
|
83
|
-
g.animate(animation);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
77
|
+
addViewAnimation(viewOfG2, animation as Options['animation']);
|
|
86
78
|
|
|
87
79
|
if (tooltip) {
|
|
88
80
|
// 8. tooltip
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isFunction, clone } from '@antv/util';
|
|
1
|
+
import { isFunction, clone, each } from '@antv/util';
|
|
2
2
|
import { Params } from '../../core/adaptor';
|
|
3
|
-
import {
|
|
3
|
+
import { animation, theme, scale, annotation, tooltip } from '../../adaptor/common';
|
|
4
4
|
import { getLocale } from '../../core/locale';
|
|
5
5
|
import { Datum } from '../../types';
|
|
6
6
|
import { flow, deepAssign } from '../../utils';
|
|
@@ -11,6 +11,8 @@ import { compareFunnel } from './geometries/compare';
|
|
|
11
11
|
import { facetFunnel } from './geometries/facet';
|
|
12
12
|
import { dynamicHeightFunnel } from './geometries/dynamic-height';
|
|
13
13
|
import { FUNNEL_CONVERSATION, FUNNEL_PERCENT } from './constant';
|
|
14
|
+
import { interactionStart, FUNNEL_LEGEND_FILTER } from './interactions';
|
|
15
|
+
import type { Interaction } from './types';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
*
|
|
@@ -137,6 +139,34 @@ function legend(params: Params<FunnelOptions>): Params<FunnelOptions> {
|
|
|
137
139
|
return params;
|
|
138
140
|
}
|
|
139
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Interaction 配置
|
|
144
|
+
* @param params
|
|
145
|
+
*/
|
|
146
|
+
export function interaction<O extends Pick<FunnelOptions, 'interactions'>>(params: Params<O>): Params<O> {
|
|
147
|
+
const { chart, options } = params;
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
const { interactions, dynamicHeight } = options;
|
|
150
|
+
|
|
151
|
+
each(interactions, (i: Interaction) => {
|
|
152
|
+
if (i.enable === false) {
|
|
153
|
+
chart.removeInteraction(i.type);
|
|
154
|
+
} else {
|
|
155
|
+
chart.interaction(i.type, i.cfg || {});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
// 动态高度 不进行交互操作
|
|
159
|
+
if (!dynamicHeight) {
|
|
160
|
+
chart.interaction(FUNNEL_LEGEND_FILTER, {
|
|
161
|
+
start: [{ ...interactionStart, arg: options }],
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
chart.removeInteraction(FUNNEL_LEGEND_FILTER);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return params;
|
|
168
|
+
}
|
|
169
|
+
|
|
140
170
|
/**
|
|
141
171
|
* 漏斗图适配器
|
|
142
172
|
* @param chart
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Types } from '@antv/g2';
|
|
2
|
-
import { isArray } from '@antv/util';
|
|
2
|
+
import { isArray, get, map } from '@antv/util';
|
|
3
3
|
import { flow, findGeometry } from '../../../utils';
|
|
4
4
|
import { getTooltipMapping } from '../../../utils/tooltip';
|
|
5
5
|
import { Params } from '../../../core/adaptor';
|
|
@@ -80,10 +80,15 @@ function transpose(params: Params<FunnelOptions>): Params<FunnelOptions> {
|
|
|
80
80
|
* 转化率组件
|
|
81
81
|
* @param params
|
|
82
82
|
*/
|
|
83
|
-
function conversionTag(params: Params<FunnelOptions>): Params<FunnelOptions> {
|
|
84
|
-
const { options } = params;
|
|
83
|
+
export function conversionTag(params: Params<FunnelOptions>): Params<FunnelOptions> {
|
|
84
|
+
const { options, chart } = params;
|
|
85
85
|
const { maxSize } = options;
|
|
86
86
|
|
|
87
|
+
// 获取形状位置,再转化为需要的转化率位置
|
|
88
|
+
const dataArray = get(chart, ['geometries', '0', 'dataArray'], []);
|
|
89
|
+
const size = get(chart, ['options', 'data', 'length']);
|
|
90
|
+
const x = map(dataArray, (item) => get(item, ['0', 'nextPoints', '0', 'x']) * size - 0.5);
|
|
91
|
+
|
|
87
92
|
const getLineCoordinate = (
|
|
88
93
|
datum: Datum,
|
|
89
94
|
datumIndex: number,
|
|
@@ -93,8 +98,8 @@ function conversionTag(params: Params<FunnelOptions>): Params<FunnelOptions> {
|
|
|
93
98
|
const percent = maxSize - (maxSize - datum[FUNNEL_MAPPING_VALUE]) / 2;
|
|
94
99
|
return {
|
|
95
100
|
...initLineOption,
|
|
96
|
-
start: [datumIndex - 0.5, percent],
|
|
97
|
-
end: [datumIndex - 0.5, percent + 0.05],
|
|
101
|
+
start: [x[datumIndex - 1] || datumIndex - 0.5, percent],
|
|
102
|
+
end: [x[datumIndex - 1] || datumIndex - 0.5, percent + 0.05],
|
|
98
103
|
};
|
|
99
104
|
};
|
|
100
105
|
|
|
@@ -5,6 +5,8 @@ import { FUNNEL_PERCENT, FUNNEL_CONVERSATION, FUNNEL_MAPPING_VALUE } from '../co
|
|
|
5
5
|
import { Params } from '../../../core/adaptor';
|
|
6
6
|
import { FunnelOptions } from '../types';
|
|
7
7
|
|
|
8
|
+
export const CONVERSION_TAG_NAME = 'CONVERSION_TAG_NAME';
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* 漏斗图 transform
|
|
10
12
|
* @param geometry
|
|
@@ -47,16 +49,17 @@ export function conversionTagComponent(
|
|
|
47
49
|
) {
|
|
48
50
|
return function (params: Params<FunnelOptions>): Params<FunnelOptions> {
|
|
49
51
|
const { chart, options } = params;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const { data } = chart.getOptions();
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
const { conversionTag, filteredData } = options;
|
|
53
54
|
|
|
55
|
+
const data = filteredData || chart.getOptions().data;
|
|
54
56
|
if (conversionTag) {
|
|
55
57
|
const { formatter } = conversionTag;
|
|
56
58
|
data.forEach((obj, index) => {
|
|
57
59
|
if (index <= 0 || Number.isNaN(obj[FUNNEL_MAPPING_VALUE])) return;
|
|
58
60
|
const lineOption = getLineCoordinate(obj, index, data, {
|
|
59
61
|
top: true,
|
|
62
|
+
name: CONVERSION_TAG_NAME,
|
|
60
63
|
text: {
|
|
61
64
|
content: isFunction(formatter) ? formatter(obj, data) : formatter,
|
|
62
65
|
offsetX: conversionTag.offsetX,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Types } from '@antv/g2';
|
|
2
|
-
import { isArray } from '@antv/util';
|
|
2
|
+
import { isArray, isNumber, get, map } from '@antv/util';
|
|
3
3
|
import { flow, deepAssign } from '../../../utils';
|
|
4
4
|
import { Params } from '../../../core/adaptor';
|
|
5
5
|
import { Datum, Data } from '../../../types/common';
|
|
@@ -114,52 +114,61 @@ function geometry(params: Params<FunnelOptions>): Params<FunnelOptions> {
|
|
|
114
114
|
return params;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
export function compareConversionTag(params: Params<FunnelOptions>) {
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
const { chart, index, options } = params;
|
|
120
|
+
const { conversionTag, isTransposed } = options;
|
|
121
|
+
(isNumber(index) ? [chart] : chart.views).forEach((view, viewIndex) => {
|
|
122
|
+
// 获取形状位置,再转化为需要的转化率位置
|
|
123
|
+
const dataArray = get(view, ['geometries', '0', 'dataArray'], []);
|
|
124
|
+
const size = get(view, ['options', 'data', 'length']);
|
|
125
|
+
const x = map(dataArray, (item) => get(item, ['0', 'nextPoints', '0', 'x']) * size - 0.5);
|
|
126
|
+
|
|
127
|
+
const getLineCoordinate = (
|
|
128
|
+
datum: Datum,
|
|
129
|
+
datumIndex: number,
|
|
130
|
+
data: Data,
|
|
131
|
+
initLineOption: Record<string, any>
|
|
132
|
+
): Types.LineOption => {
|
|
133
|
+
const ratio = (index || viewIndex) === 0 ? -1 : 1;
|
|
134
|
+
return deepAssign({}, initLineOption, {
|
|
135
|
+
start: [x[datumIndex - 1] || datumIndex - 0.5, datum[FUNNEL_MAPPING_VALUE]],
|
|
136
|
+
end: [x[datumIndex - 1] || datumIndex - 0.5, datum[FUNNEL_MAPPING_VALUE] + 0.05],
|
|
137
|
+
text: isTransposed
|
|
138
|
+
? {
|
|
139
|
+
style: {
|
|
140
|
+
textAlign: 'start',
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
: {
|
|
144
|
+
offsetX: conversionTag !== false ? ratio * conversionTag.offsetX : 0,
|
|
145
|
+
style: {
|
|
146
|
+
textAlign: (index || viewIndex) === 0 ? 'end' : 'start',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
conversionTagComponent(getLineCoordinate)(
|
|
153
|
+
deepAssign(
|
|
154
|
+
{},
|
|
155
|
+
{
|
|
156
|
+
chart: view,
|
|
157
|
+
options,
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
117
164
|
/**
|
|
118
165
|
* 转化率组件
|
|
119
166
|
* @param params
|
|
120
167
|
*/
|
|
121
168
|
function conversionTag(params: Params<FunnelOptions>): Params<FunnelOptions> {
|
|
122
|
-
const { chart
|
|
123
|
-
const { conversionTag, isTransposed } = options;
|
|
169
|
+
const { chart } = params;
|
|
124
170
|
// @ts-ignore
|
|
125
|
-
chart.once('beforepaint', () =>
|
|
126
|
-
chart.views.forEach((view, viewIndex) => {
|
|
127
|
-
const getLineCoordinate = (
|
|
128
|
-
datum: Datum,
|
|
129
|
-
datumIndex: number,
|
|
130
|
-
data: Data,
|
|
131
|
-
initLineOption: Record<string, any>
|
|
132
|
-
): Types.LineOption => {
|
|
133
|
-
const ratio = viewIndex === 0 ? -1 : 1;
|
|
134
|
-
return deepAssign({}, initLineOption, {
|
|
135
|
-
start: [datumIndex - 0.5, datum[FUNNEL_MAPPING_VALUE]],
|
|
136
|
-
end: [datumIndex - 0.5, datum[FUNNEL_MAPPING_VALUE] + 0.05],
|
|
137
|
-
text: isTransposed
|
|
138
|
-
? {
|
|
139
|
-
style: {
|
|
140
|
-
textAlign: 'start',
|
|
141
|
-
},
|
|
142
|
-
}
|
|
143
|
-
: {
|
|
144
|
-
offsetX: conversionTag !== false ? ratio * conversionTag.offsetX : 0,
|
|
145
|
-
style: {
|
|
146
|
-
textAlign: viewIndex === 0 ? 'end' : 'start',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
conversionTagComponent(getLineCoordinate)(
|
|
153
|
-
deepAssign(
|
|
154
|
-
{},
|
|
155
|
-
{
|
|
156
|
-
chart: view,
|
|
157
|
-
options,
|
|
158
|
-
}
|
|
159
|
-
)
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
});
|
|
171
|
+
chart.once('beforepaint', () => compareConversionTag(params));
|
|
163
172
|
return params;
|
|
164
173
|
}
|
|
165
174
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { get, map, filter, each } from '@antv/util';
|
|
2
|
+
import { Action } from '@antv/g2';
|
|
3
|
+
import { conversionTag as basicConversionTag } from '../geometries/basic';
|
|
4
|
+
import { compareConversionTag } from '../geometries/compare';
|
|
5
|
+
import { transformData, CONVERSION_TAG_NAME } from '../geometries/common';
|
|
6
|
+
import { FunnelOptions } from '../types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Funnel 转化率跟随 legend 变化事件
|
|
10
|
+
*/
|
|
11
|
+
export class ConversionTagAction extends Action {
|
|
12
|
+
private rendering = false;
|
|
13
|
+
public change(options: FunnelOptions) {
|
|
14
|
+
// 防止多次重复渲染
|
|
15
|
+
if (!this.rendering) {
|
|
16
|
+
const { seriesField, compareField } = options;
|
|
17
|
+
const conversionTag = compareField ? compareConversionTag : basicConversionTag;
|
|
18
|
+
const { view } = this.context;
|
|
19
|
+
// 兼容分面漏斗图
|
|
20
|
+
const views = seriesField || compareField ? view.views : [view];
|
|
21
|
+
map(views, (v, index) => {
|
|
22
|
+
// 防止影响其他 annotations 被去除
|
|
23
|
+
const annotationController = v.getController('annotation');
|
|
24
|
+
|
|
25
|
+
const annotations = filter(
|
|
26
|
+
get(annotationController, ['option'], []),
|
|
27
|
+
({ name }) => name !== CONVERSION_TAG_NAME
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
annotationController.clear(true);
|
|
31
|
+
|
|
32
|
+
each(annotations, (annotation) => {
|
|
33
|
+
if (typeof annotation === 'object') {
|
|
34
|
+
v.annotation()[annotation.type](annotation);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const data = get(v, ['filteredData'], v.getOptions().data);
|
|
39
|
+
|
|
40
|
+
conversionTag({
|
|
41
|
+
chart: v,
|
|
42
|
+
index,
|
|
43
|
+
options: {
|
|
44
|
+
...options,
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
filteredData: transformData(data, data, options),
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
v.filterData(data);
|
|
51
|
+
this.rendering = true;
|
|
52
|
+
v.render(true);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
this.rendering = false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { registerAction, registerInteraction } from '@antv/g2';
|
|
2
|
+
import { ConversionTagAction } from './funnel-conversion-tag';
|
|
3
|
+
|
|
4
|
+
const FUNNEL_CONVERSION_TAG = 'funnel-conversion-tag';
|
|
5
|
+
export const FUNNEL_LEGEND_FILTER = 'funnel-afterrender';
|
|
6
|
+
export const interactionStart = { trigger: 'afterrender', action: `${FUNNEL_CONVERSION_TAG}:change` };
|
|
7
|
+
|
|
8
|
+
registerAction(FUNNEL_CONVERSION_TAG, ConversionTagAction);
|
|
9
|
+
registerInteraction(FUNNEL_LEGEND_FILTER, {
|
|
10
|
+
start: [interactionStart],
|
|
11
|
+
});
|
package/src/plots/gauge/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clamp, get, size } from '@antv/util';
|
|
1
|
+
import { clamp, get, size, uniq } from '@antv/util';
|
|
2
2
|
import { Data, Datum } from '../../types';
|
|
3
3
|
import { RANGE_VALUE, RANGE_TYPE, PERCENT } from './constants';
|
|
4
4
|
import { GaugeOptions, GaugeRangeData } from './types';
|
|
@@ -16,8 +16,6 @@ export function processRangeData(range: number[], percent: GaugeOptions['percent
|
|
|
16
16
|
.map((r: number, idx: number) => {
|
|
17
17
|
return { [RANGE_VALUE]: r - (range[idx - 1] || 0), [RANGE_TYPE]: `${idx}`, [PERCENT]: percent };
|
|
18
18
|
})
|
|
19
|
-
// 去掉 0 的数据
|
|
20
|
-
.filter((d: Datum) => !!d[RANGE_VALUE])
|
|
21
19
|
);
|
|
22
20
|
}
|
|
23
21
|
|
|
@@ -37,6 +35,9 @@ export function getIndicatorData(percent: GaugeOptions['percent']): Data {
|
|
|
37
35
|
export function getRangeData(percent: GaugeOptions['percent'], range?: GaugeOptions['range']): GaugeRangeData {
|
|
38
36
|
const ticks = get(range, ['ticks'], []);
|
|
39
37
|
|
|
40
|
-
const clampTicks = size(ticks) ? ticks : [0, clamp(percent, 0, 1), 1];
|
|
38
|
+
const clampTicks = size(ticks) ? uniq(ticks) : [0, clamp(percent, 0, 1), 1];
|
|
39
|
+
if (!clampTicks[0]) {
|
|
40
|
+
clampTicks.shift();
|
|
41
|
+
}
|
|
41
42
|
return processRangeData(clampTicks as number[], percent);
|
|
42
43
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { get } from '@antv/util';
|
|
1
|
+
import { get, isNumber } from '@antv/util';
|
|
2
2
|
import { Params } from '../../core/adaptor';
|
|
3
3
|
import { deepAssign, findGeometry } from '../../utils';
|
|
4
4
|
import { flow, transformLabel } from '../../utils';
|
|
@@ -9,7 +9,8 @@ import { HeatmapOptions } from './types';
|
|
|
9
9
|
|
|
10
10
|
function geometry(params: Params<HeatmapOptions>): Params<HeatmapOptions> {
|
|
11
11
|
const { chart, options } = params;
|
|
12
|
-
const { data, type, xField, yField, colorField, sizeField, sizeRatio, shape, color, tooltip, heatmapStyle } =
|
|
12
|
+
const { data, type, xField, yField, colorField, sizeField, sizeRatio, shape, color, tooltip, heatmapStyle, meta } =
|
|
13
|
+
options;
|
|
13
14
|
|
|
14
15
|
chart.data(data);
|
|
15
16
|
let geometryType = 'polygon';
|
|
@@ -51,8 +52,9 @@ function geometry(params: Params<HeatmapOptions>): Params<HeatmapOptions> {
|
|
|
51
52
|
(sizeField
|
|
52
53
|
? (dautm) => {
|
|
53
54
|
const field = data.map((row) => row[sizeField]);
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
let { min, max } = meta?.[sizeField] || {};
|
|
56
|
+
min = isNumber(min) ? min : Math.min(...field);
|
|
57
|
+
max = isNumber(max) ? max : Math.max(...field);
|
|
56
58
|
return [shape, (get(dautm, sizeField) - min) / (max - min), checkedSizeRatio];
|
|
57
59
|
}
|
|
58
60
|
: () => [shape, 1, checkedSizeRatio]),
|
|
@@ -167,17 +169,14 @@ function coordinate(params: Params<HeatmapOptions>): Params<HeatmapOptions> {
|
|
|
167
169
|
const { chart, options } = params;
|
|
168
170
|
const { coordinate, reflect } = options;
|
|
169
171
|
|
|
170
|
-
|
|
171
|
-
chart.coordinate({
|
|
172
|
-
type: coordinate.type || 'rect',
|
|
173
|
-
cfg: coordinate.cfg,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
172
|
+
const coordinateOption = deepAssign({ actions: [] }, coordinate ?? { type: 'rect' });
|
|
176
173
|
|
|
177
174
|
if (reflect) {
|
|
178
|
-
|
|
175
|
+
coordinateOption.actions?.push?.(['reflect', reflect]);
|
|
179
176
|
}
|
|
180
177
|
|
|
178
|
+
chart.coordinate(coordinateOption);
|
|
179
|
+
|
|
181
180
|
return params;
|
|
182
181
|
}
|
|
183
182
|
|
package/src/plots/pie/adaptor.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { PieOptions } from './types';
|
|
|
19
19
|
*/
|
|
20
20
|
function geometry(params: Params<PieOptions>): Params<PieOptions> {
|
|
21
21
|
const { chart, options } = params;
|
|
22
|
-
const { data, angleField, colorField, color, pieStyle } = options;
|
|
22
|
+
const { data, angleField, colorField, color, pieStyle, shape } = options;
|
|
23
23
|
|
|
24
24
|
// 处理不合法的数据
|
|
25
25
|
let processData = processIllegalData(data, angleField);
|
|
@@ -38,6 +38,7 @@ function geometry(params: Params<PieOptions>): Params<PieOptions> {
|
|
|
38
38
|
isStack: true,
|
|
39
39
|
interval: {
|
|
40
40
|
color,
|
|
41
|
+
shape,
|
|
41
42
|
style: pieStyle,
|
|
42
43
|
},
|
|
43
44
|
args: {
|
|
@@ -59,6 +60,7 @@ function geometry(params: Params<PieOptions>): Params<PieOptions> {
|
|
|
59
60
|
isStack: true,
|
|
60
61
|
interval: {
|
|
61
62
|
color,
|
|
63
|
+
shape,
|
|
62
64
|
style: pieStyle,
|
|
63
65
|
},
|
|
64
66
|
args: {
|