@antv/g2 5.0.1 → 5.0.3
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 +21 -0
- package/dist/g2-lite.min.js +3 -3
- package/dist/g2.min.js +3 -3
- package/esm/animation/morphing.js +4 -2
- package/esm/animation/morphing.js.map +1 -1
- package/esm/api/chart.d.ts +1 -2
- package/esm/api/chart.js.map +1 -1
- package/esm/component/axis.js +1 -1
- package/esm/component/axis.js.map +1 -1
- package/esm/interaction/fisheye.js +3 -1
- package/esm/interaction/fisheye.js.map +1 -1
- package/esm/interaction/tooltip.js +3 -1
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/runtime/render.d.ts +1 -1
- package/esm/runtime/render.js +16 -6
- package/esm/runtime/render.js.map +1 -1
- package/esm/shape/interval/funnel.js +20 -4
- package/esm/shape/interval/funnel.js.map +1 -1
- package/esm/shape/interval/pyramid.js +3 -2
- package/esm/shape/interval/pyramid.js.map +1 -1
- package/esm/spec/composition.d.ts +7 -6
- package/lib/animation/morphing.js +4 -2
- package/lib/animation/morphing.js.map +1 -1
- package/lib/api/chart.d.ts +1 -2
- package/lib/api/chart.js.map +1 -1
- package/lib/component/axis.js +1 -1
- package/lib/component/axis.js.map +1 -1
- package/lib/interaction/fisheye.js +3 -1
- package/lib/interaction/fisheye.js.map +1 -1
- package/lib/interaction/tooltip.js +3 -1
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/runtime/render.d.ts +1 -1
- package/lib/runtime/render.js +16 -6
- package/lib/runtime/render.js.map +1 -1
- package/lib/shape/interval/funnel.js +20 -4
- package/lib/shape/interval/funnel.js.map +1 -1
- package/lib/shape/interval/pyramid.js +3 -2
- package/lib/shape/interval/pyramid.js.map +1 -1
- package/lib/spec/composition.d.ts +7 -6
- package/package.json +3 -3
- package/src/animation/morphing.ts +8 -2
- package/src/api/chart.ts +0 -2
- package/src/component/axis.ts +1 -1
- package/src/interaction/fisheye.ts +4 -1
- package/src/interaction/tooltip.ts +4 -1
- package/src/runtime/render.ts +18 -7
- package/src/shape/interval/funnel.ts +23 -12
- package/src/shape/interval/pyramid.ts +0 -2
- package/src/spec/composition.ts +7 -6
- package/src/.DS_Store +0 -0
- package/src/data/.DS_Store +0 -0
- package/src/shape/.DS_Store +0 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { Path } from '@antv/g';
|
|
2
|
+
import { line, curveLinearClosed } from 'd3-shape';
|
|
1
3
|
import { Coordinate } from '@antv/coord';
|
|
2
4
|
import { isTranspose } from '../../utils/coordinate';
|
|
3
5
|
import { ShapeComponent as SC, Vector2 } from '../../runtime';
|
|
4
|
-
import {
|
|
6
|
+
import { select } from '../../utils/selection';
|
|
7
|
+
import { applyStyle, getShapeTheme, reorder, toOpacityKey } from '../utils';
|
|
5
8
|
|
|
6
9
|
export type FunnelOptions = {
|
|
7
10
|
adjustPoints?: (
|
|
@@ -38,22 +41,30 @@ function getFunnelPoints(
|
|
|
38
41
|
export const Funnel: SC<FunnelOptions> = (options) => {
|
|
39
42
|
const { adjustPoints = getFunnelPoints, ...style } = options;
|
|
40
43
|
return (points, value, coordinate, theme, point2d, ...args) => {
|
|
41
|
-
const { index } = value;
|
|
44
|
+
const { index, mark, shape, defaultShape } = value;
|
|
45
|
+
const { defaultColor, ...defaults } = getShapeTheme(
|
|
46
|
+
theme,
|
|
47
|
+
mark,
|
|
48
|
+
shape,
|
|
49
|
+
defaultShape,
|
|
50
|
+
);
|
|
42
51
|
const nextPoints = point2d[index + 1];
|
|
43
52
|
const funnelPoints = adjustPoints(points, nextPoints, coordinate);
|
|
53
|
+
const tpShape = !!isTranspose(coordinate);
|
|
44
54
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
const [p0, p1, p2, p3] = tpShape ? reorder(funnelPoints) : funnelPoints;
|
|
56
|
+
const { color = defaultColor, opacity } = value;
|
|
57
|
+
const b = line().curve(curveLinearClosed)([p0, p1, p2, p3]);
|
|
58
|
+
return select(new Path({}))
|
|
59
|
+
.call(applyStyle, defaults)
|
|
60
|
+
.style('path', b)
|
|
61
|
+
.style('fill', color)
|
|
62
|
+
.style('fillOpacity', opacity)
|
|
63
|
+
.call(applyStyle, style)
|
|
64
|
+
.node();
|
|
53
65
|
};
|
|
54
66
|
};
|
|
55
67
|
|
|
56
68
|
Funnel.props = {
|
|
57
|
-
|
|
58
|
-
defaultMarker: 'funnel',
|
|
69
|
+
defaultMarker: 'square',
|
|
59
70
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Coordinate } from '@antv/coord';
|
|
2
2
|
import { isTranspose } from '../../utils/coordinate';
|
|
3
3
|
import { ShapeComponent as SC, Vector2 } from '../../runtime';
|
|
4
|
-
import { Color } from './color';
|
|
5
4
|
import { Funnel } from './funnel';
|
|
6
5
|
|
|
7
6
|
export type PyramidOptions = Record<string, any>;
|
|
@@ -46,6 +45,5 @@ export const Pyramid: SC<PyramidOptions> = (options) => {
|
|
|
46
45
|
};
|
|
47
46
|
|
|
48
47
|
Pyramid.props = {
|
|
49
|
-
...Color.props,
|
|
50
48
|
defaultMarker: 'square',
|
|
51
49
|
};
|
package/src/spec/composition.ts
CHANGED
|
@@ -62,6 +62,7 @@ export type ViewComposition = {
|
|
|
62
62
|
theme?: Theme;
|
|
63
63
|
children?: Mark[];
|
|
64
64
|
scale?: Record<string, Scale>;
|
|
65
|
+
frame?: boolean;
|
|
65
66
|
labelTransform?: LabelTransform[];
|
|
66
67
|
// @todo
|
|
67
68
|
axis?: Record<string, any>;
|
|
@@ -141,9 +142,9 @@ export type FacetRectComposition = {
|
|
|
141
142
|
shareSize?: boolean;
|
|
142
143
|
children?: Node[] | ((facet: FacetContext) => Node);
|
|
143
144
|
// @todo
|
|
144
|
-
axis?: Record<string, any
|
|
145
|
+
axis?: Record<string, any> | boolean;
|
|
145
146
|
// @todo
|
|
146
|
-
legend?: Record<string, any
|
|
147
|
+
legend?: Record<string, any> | boolean;
|
|
147
148
|
};
|
|
148
149
|
|
|
149
150
|
export type RepeatMatrixComposition = {
|
|
@@ -172,9 +173,9 @@ export type RepeatMatrixComposition = {
|
|
|
172
173
|
color?: Scale;
|
|
173
174
|
};
|
|
174
175
|
// @todo
|
|
175
|
-
axis?: Record<string, any
|
|
176
|
+
axis?: Record<string, any> | boolean;
|
|
176
177
|
// @todo
|
|
177
|
-
legend?: Record<string, any
|
|
178
|
+
legend?: Record<string, any> | boolean;
|
|
178
179
|
children?: Node[] | ((facet: FacetContext) => Node);
|
|
179
180
|
};
|
|
180
181
|
|
|
@@ -203,9 +204,9 @@ export type FacetCircleComposition = {
|
|
|
203
204
|
};
|
|
204
205
|
children?: Node[] | ((facet: FacetContext) => Node);
|
|
205
206
|
// @todo
|
|
206
|
-
axis?: Record<string, any
|
|
207
|
+
axis?: Record<string, any> | boolean;
|
|
207
208
|
// @todo
|
|
208
|
-
legend?: Record<string, any
|
|
209
|
+
legend?: Record<string, any> | boolean;
|
|
209
210
|
};
|
|
210
211
|
|
|
211
212
|
export type TimingKeyframeComposition = {
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/data/.DS_Store
DELETED
|
Binary file
|
package/src/shape/.DS_Store
DELETED
|
Binary file
|