@antv/g2 5.0.19 → 5.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -34
- package/README.zh-CN.md +99 -0
- package/dist/g2-lite.min.js +4 -4
- package/dist/g2.min.js +4 -4
- package/esm/api/chart.d.ts +13 -855
- package/esm/api/chart.js.map +1 -1
- package/esm/api/extend.d.ts +2 -1
- package/esm/api/extend.js.map +1 -1
- package/esm/api/library.d.ts +1 -0
- package/esm/api/runtime.js +2 -2
- package/esm/api/runtime.js.map +1 -1
- package/esm/api/utils.d.ts +5 -0
- package/esm/api/utils.js +3 -2
- package/esm/api/utils.js.map +1 -1
- package/esm/component/axis.d.ts +11 -1
- package/esm/component/axis.js +46 -11
- package/esm/component/axis.js.map +1 -1
- package/esm/component/axisX.js +7 -4
- package/esm/component/axisX.js.map +1 -1
- package/esm/component/axisY.js +6 -2
- package/esm/component/axisY.js.map +1 -1
- package/esm/component/axisZ.d.ts +8 -0
- package/esm/component/axisZ.js +14 -0
- package/esm/component/axisZ.js.map +1 -0
- package/esm/component/index.d.ts +1 -0
- package/esm/component/index.js +1 -0
- package/esm/component/index.js.map +1 -1
- package/esm/component/scrollbar.d.ts +2 -1
- package/esm/component/scrollbar.js +1 -1
- package/esm/component/scrollbar.js.map +1 -1
- package/esm/composition/mark.js +3 -1
- package/esm/composition/mark.js.map +1 -1
- package/esm/coordinate/cartesian3D.d.ts +7 -0
- package/esm/coordinate/cartesian3D.js +6 -0
- package/esm/coordinate/cartesian3D.js.map +1 -0
- package/esm/coordinate/index.d.ts +2 -0
- package/esm/coordinate/index.js +1 -0
- package/esm/coordinate/index.js.map +1 -1
- package/esm/data/index.d.ts +2 -0
- package/esm/data/index.js +1 -0
- package/esm/data/index.js.map +1 -1
- package/esm/data/log.d.ts +7 -0
- package/esm/data/log.js +11 -0
- package/esm/data/log.js.map +1 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/interaction/brushFilter.js +18 -16
- package/esm/interaction/brushFilter.js.map +1 -1
- package/esm/interaction/chartIndex.js +25 -22
- package/esm/interaction/chartIndex.js.map +1 -1
- package/esm/interaction/event.js +20 -9
- package/esm/interaction/event.js.map +1 -1
- package/esm/interaction/fisheye.js +17 -13
- package/esm/interaction/fisheye.js.map +1 -1
- package/esm/interaction/legendFilter.js +32 -26
- package/esm/interaction/legendFilter.js.map +1 -1
- package/esm/interaction/sliderFilter.js +8 -9
- package/esm/interaction/sliderFilter.js.map +1 -1
- package/esm/interaction/tooltip.d.ts +1 -1
- package/esm/interaction/tooltip.js +39 -4
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/lib/core.d.ts +1 -0
- package/esm/lib/core.js +2 -1
- package/esm/lib/core.js.map +1 -1
- package/esm/lib/index.d.ts +1 -0
- package/esm/lib/index.js +1 -0
- package/esm/lib/index.js.map +1 -1
- package/esm/lib/std.d.ts +1 -0
- package/esm/lib/threed.d.ts +5 -0
- package/esm/lib/threed.js +11 -0
- package/esm/lib/threed.js.map +1 -0
- package/esm/mark/index.d.ts +1 -0
- package/esm/mark/index.js +1 -0
- package/esm/mark/index.js.map +1 -1
- package/esm/mark/point3D.d.ts +9 -0
- package/esm/mark/point3D.js +76 -0
- package/esm/mark/point3D.js.map +1 -0
- package/esm/mark/utils.d.ts +7 -0
- package/esm/mark/utils.js +6 -0
- package/esm/mark/utils.js.map +1 -1
- package/esm/runtime/component.js +6 -3
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/coordinate.js +9 -4
- package/esm/runtime/coordinate.js.map +1 -1
- package/esm/runtime/layout.d.ts +1 -0
- package/esm/runtime/layout.js +109 -29
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plot.js +26 -9
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js +12 -3
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/types/common.d.ts +4 -0
- package/esm/runtime/types/component.d.ts +8 -2
- package/esm/runtime/types/options.d.ts +5 -1
- package/esm/shape/index.d.ts +2 -0
- package/esm/shape/index.js +2 -0
- package/esm/shape/index.js.map +1 -1
- package/esm/shape/point3D/cube.d.ts +6 -0
- package/esm/shape/point3D/cube.js +70 -0
- package/esm/shape/point3D/cube.js.map +1 -0
- package/esm/shape/point3D/sphere.d.ts +6 -0
- package/esm/shape/point3D/sphere.js +70 -0
- package/esm/shape/point3D/sphere.js.map +1 -0
- package/esm/shape/shape/shape.js +2 -2
- package/esm/shape/shape/shape.js.map +1 -1
- package/esm/shape/utils.d.ts +2 -2
- package/esm/shape/utils.js +2 -2
- package/esm/shape/utils.js.map +1 -1
- package/esm/spec/component.d.ts +1 -1
- package/esm/spec/composition.d.ts +2 -0
- package/esm/spec/coordinate.d.ts +5 -2
- package/esm/spec/dataTransform.d.ts +3 -2
- package/esm/spec/index.d.ts +1 -0
- package/esm/spec/index.js.map +1 -1
- package/esm/spec/interaction.d.ts +2 -1
- package/esm/spec/mark.d.ts +2 -2
- package/esm/transform/index.d.ts +1 -0
- package/esm/transform/index.js +1 -0
- package/esm/transform/index.js.map +1 -1
- package/esm/transform/maybeZeroZ.d.ts +6 -0
- package/esm/transform/maybeZeroZ.js +22 -0
- package/esm/transform/maybeZeroZ.js.map +1 -0
- package/esm/utils/size.d.ts +1 -0
- package/esm/utils/size.js +1 -0
- package/esm/utils/size.js.map +1 -1
- package/lib/api/chart.d.ts +13 -855
- package/lib/api/chart.js.map +1 -1
- package/lib/api/extend.d.ts +2 -1
- package/lib/api/extend.js.map +1 -1
- package/lib/api/library.d.ts +1 -0
- package/lib/api/runtime.js +2 -2
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/utils.d.ts +5 -0
- package/lib/api/utils.js +3 -2
- package/lib/api/utils.js.map +1 -1
- package/lib/component/axis.d.ts +11 -1
- package/lib/component/axis.js +48 -12
- package/lib/component/axis.js.map +1 -1
- package/lib/component/axisX.js +6 -3
- package/lib/component/axisX.js.map +1 -1
- package/lib/component/axisY.js +5 -1
- package/lib/component/axisY.js.map +1 -1
- package/lib/component/axisZ.d.ts +8 -0
- package/lib/component/axisZ.js +19 -0
- package/lib/component/axisZ.js.map +1 -0
- package/lib/component/index.d.ts +1 -0
- package/lib/component/index.js +3 -1
- package/lib/component/index.js.map +1 -1
- package/lib/component/scrollbar.d.ts +2 -1
- package/lib/component/scrollbar.js +1 -1
- package/lib/component/scrollbar.js.map +1 -1
- package/lib/composition/mark.js +3 -1
- package/lib/composition/mark.js.map +1 -1
- package/lib/coordinate/cartesian3D.d.ts +7 -0
- package/lib/coordinate/cartesian3D.js +10 -0
- package/lib/coordinate/cartesian3D.js.map +1 -0
- package/lib/coordinate/index.d.ts +2 -0
- package/lib/coordinate/index.js +3 -1
- package/lib/coordinate/index.js.map +1 -1
- package/lib/data/index.d.ts +2 -0
- package/lib/data/index.js +3 -1
- package/lib/data/index.js.map +1 -1
- package/lib/data/log.d.ts +7 -0
- package/lib/data/log.js +15 -0
- package/lib/data/log.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/interaction/brushFilter.js +18 -16
- package/lib/interaction/brushFilter.js.map +1 -1
- package/lib/interaction/chartIndex.js +25 -22
- package/lib/interaction/chartIndex.js.map +1 -1
- package/lib/interaction/event.js +20 -9
- package/lib/interaction/event.js.map +1 -1
- package/lib/interaction/fisheye.js +17 -13
- package/lib/interaction/fisheye.js.map +1 -1
- package/lib/interaction/legendFilter.js +32 -26
- package/lib/interaction/legendFilter.js.map +1 -1
- package/lib/interaction/sliderFilter.js +8 -9
- package/lib/interaction/sliderFilter.js.map +1 -1
- package/lib/interaction/tooltip.d.ts +1 -1
- package/lib/interaction/tooltip.js +38 -3
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/lib/core.d.ts +1 -0
- package/lib/lib/core.js +1 -0
- package/lib/lib/core.js.map +1 -1
- package/lib/lib/index.d.ts +1 -0
- package/lib/lib/index.js +3 -1
- package/lib/lib/index.js.map +1 -1
- package/lib/lib/std.d.ts +1 -0
- package/lib/lib/threed.d.ts +5 -0
- package/lib/lib/threed.js +15 -0
- package/lib/lib/threed.js.map +1 -0
- package/lib/mark/index.d.ts +1 -0
- package/lib/mark/index.js +3 -1
- package/lib/mark/index.js.map +1 -1
- package/lib/mark/point3D.d.ts +9 -0
- package/lib/mark/point3D.js +80 -0
- package/lib/mark/point3D.js.map +1 -0
- package/lib/mark/utils.d.ts +7 -0
- package/lib/mark/utils.js +8 -1
- package/lib/mark/utils.js.map +1 -1
- package/lib/runtime/component.js +6 -3
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/coordinate.js +8 -3
- package/lib/runtime/coordinate.js.map +1 -1
- package/lib/runtime/layout.d.ts +1 -0
- package/lib/runtime/layout.js +112 -31
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plot.js +25 -8
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +12 -3
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/types/common.d.ts +4 -0
- package/lib/runtime/types/component.d.ts +8 -2
- package/lib/runtime/types/options.d.ts +5 -1
- package/lib/shape/index.d.ts +2 -0
- package/lib/shape/index.js +6 -2
- package/lib/shape/index.js.map +1 -1
- package/lib/shape/point3D/cube.d.ts +6 -0
- package/lib/shape/point3D/cube.js +74 -0
- package/lib/shape/point3D/cube.js.map +1 -0
- package/lib/shape/point3D/sphere.d.ts +6 -0
- package/lib/shape/point3D/sphere.js +74 -0
- package/lib/shape/point3D/sphere.js.map +1 -0
- package/lib/shape/shape/shape.js +2 -2
- package/lib/shape/shape/shape.js.map +1 -1
- package/lib/shape/utils.d.ts +2 -2
- package/lib/shape/utils.js +2 -2
- package/lib/shape/utils.js.map +1 -1
- package/lib/spec/component.d.ts +1 -1
- package/lib/spec/composition.d.ts +2 -0
- package/lib/spec/coordinate.d.ts +5 -2
- package/lib/spec/dataTransform.d.ts +3 -2
- package/lib/spec/index.d.ts +1 -0
- package/lib/spec/index.js.map +1 -1
- package/lib/spec/interaction.d.ts +2 -1
- package/lib/spec/mark.d.ts +2 -2
- package/lib/transform/index.d.ts +1 -0
- package/lib/transform/index.js +3 -1
- package/lib/transform/index.js.map +1 -1
- package/lib/transform/maybeZeroZ.d.ts +6 -0
- package/lib/transform/maybeZeroZ.js +26 -0
- package/lib/transform/maybeZeroZ.js.map +1 -0
- package/lib/utils/size.d.ts +1 -0
- package/lib/utils/size.js +1 -0
- package/lib/utils/size.js.map +1 -1
- package/package.json +10 -3
- package/src/api/chart.ts +3 -3
- package/src/api/extend.ts +5 -3
- package/src/api/runtime.ts +2 -2
- package/src/api/utils.ts +3 -2
- package/src/component/axis.ts +65 -9
- package/src/component/axisX.ts +8 -3
- package/src/component/axisY.ts +8 -3
- package/src/component/axisZ.ts +25 -0
- package/src/component/index.ts +1 -0
- package/src/component/scrollbar.ts +3 -2
- package/src/composition/mark.ts +4 -0
- package/src/coordinate/cartesian3D.ts +11 -0
- package/src/coordinate/index.ts +2 -0
- package/src/data/index.ts +2 -0
- package/src/data/log.ts +16 -0
- package/src/index.ts +1 -1
- package/src/interaction/brushFilter.ts +31 -28
- package/src/interaction/chartIndex.ts +26 -23
- package/src/interaction/event.ts +22 -9
- package/src/interaction/fisheye.ts +16 -12
- package/src/interaction/legendFilter.ts +45 -40
- package/src/interaction/sliderFilter.ts +15 -16
- package/src/interaction/tooltip.ts +47 -3
- package/src/lib/core.ts +2 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/threed.ts +11 -0
- package/src/mark/index.ts +1 -0
- package/src/mark/point3D.ts +90 -0
- package/src/mark/utils.ts +7 -0
- package/src/runtime/component.ts +6 -0
- package/src/runtime/coordinate.ts +18 -10
- package/src/runtime/layout.ts +178 -33
- package/src/runtime/plot.ts +33 -10
- package/src/runtime/render.ts +14 -3
- package/src/runtime/types/common.ts +4 -0
- package/src/runtime/types/component.ts +10 -1
- package/src/runtime/types/options.ts +5 -0
- package/src/shape/index.ts +2 -0
- package/src/shape/point3D/cube.ts +68 -0
- package/src/shape/point3D/sphere.ts +68 -0
- package/src/shape/shape/shape.ts +9 -6
- package/src/shape/utils.ts +4 -4
- package/src/spec/component.ts +1 -1
- package/src/spec/composition.ts +2 -0
- package/src/spec/coordinate.ts +6 -0
- package/src/spec/dataTransform.ts +5 -0
- package/src/spec/index.ts +1 -0
- package/src/spec/interaction.ts +3 -1
- package/src/spec/mark.ts +7 -1
- package/src/transform/index.ts +1 -0
- package/src/transform/maybeZeroZ.ts +25 -0
- package/src/utils/size.ts +2 -0
- package/README.en-US.md +0 -99
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Cartesian3D } from '../coordinate';
|
|
2
|
+
import { AxisZ } from '../component';
|
|
3
|
+
import { Point3D } from '../mark';
|
|
4
|
+
|
|
5
|
+
export function threedlib() {
|
|
6
|
+
return {
|
|
7
|
+
'coordinate.cartesian3D': Cartesian3D,
|
|
8
|
+
'component.axisZ': AxisZ,
|
|
9
|
+
'mark.point3D': Point3D,
|
|
10
|
+
} as const;
|
|
11
|
+
}
|
package/src/mark/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { Interval } from './interval';
|
|
|
2
2
|
export { Rect } from './rect';
|
|
3
3
|
export { Line } from './line';
|
|
4
4
|
export { Point } from './point';
|
|
5
|
+
export { Point3D } from './point3D';
|
|
5
6
|
export { Text } from './text';
|
|
6
7
|
export { Cell } from './cell';
|
|
7
8
|
export { Area } from './area';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Coordinate3D } from '@antv/coord';
|
|
2
|
+
import { MarkComponent as MC, Vector3 } from '../runtime';
|
|
3
|
+
import { PointMark } from '../spec';
|
|
4
|
+
import { MaybeZeroX, MaybeZeroY, MaybeZeroZ, MaybeSize } from '../transform';
|
|
5
|
+
import { Sphere, Cube } from '../shape';
|
|
6
|
+
import {
|
|
7
|
+
baseGeometryChannels,
|
|
8
|
+
basePostInference,
|
|
9
|
+
basePreInference,
|
|
10
|
+
tooltip3d,
|
|
11
|
+
} from './utils';
|
|
12
|
+
|
|
13
|
+
export type PointOptions = Omit<PointMark, 'type'>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Convert value for each channel to point shapes.
|
|
17
|
+
* Calc the bbox of each point based on x, y and r.
|
|
18
|
+
* This is for allowing their radius can be affected by coordinate(e.g. fisheye).
|
|
19
|
+
*/
|
|
20
|
+
export const Point3D: MC<PointOptions> = (options) => {
|
|
21
|
+
return (index, _, value, coordinate) => {
|
|
22
|
+
const { x: X, y: Y, z: Z, size: S, dx: DX, dy: DY, dz: DZ } = value;
|
|
23
|
+
const [width, height, depth] = (
|
|
24
|
+
coordinate as unknown as Coordinate3D
|
|
25
|
+
).getSize();
|
|
26
|
+
const xyz: (i: number) => Vector3 = (i) => {
|
|
27
|
+
const dx = +(DX?.[i] || 0);
|
|
28
|
+
const dy = +(DY?.[i] || 0);
|
|
29
|
+
const dz = +(DZ?.[i] || 0);
|
|
30
|
+
const x = +X[i];
|
|
31
|
+
const y = +Y[i];
|
|
32
|
+
const z = +Z[i];
|
|
33
|
+
const cx = x + dx;
|
|
34
|
+
const cy = y + dy;
|
|
35
|
+
const cz = z + dz;
|
|
36
|
+
return [cx, cy, cz];
|
|
37
|
+
};
|
|
38
|
+
const P = S
|
|
39
|
+
? Array.from(index, (i) => {
|
|
40
|
+
const [cx, cy, cz] = xyz(i);
|
|
41
|
+
const r = +S[i];
|
|
42
|
+
const a = r / width;
|
|
43
|
+
const b = r / height;
|
|
44
|
+
const c = r / depth;
|
|
45
|
+
const p1: Vector3 = [cx - a, cy - b, cz - c];
|
|
46
|
+
const p2: Vector3 = [cx + a, cy + b, cz + c];
|
|
47
|
+
return [
|
|
48
|
+
(coordinate as unknown as Coordinate3D).map([...p1, cz]),
|
|
49
|
+
(coordinate as unknown as Coordinate3D).map([...p2, cz]),
|
|
50
|
+
] as Vector3[];
|
|
51
|
+
})
|
|
52
|
+
: Array.from(index, (i) => {
|
|
53
|
+
const [cx, cy, cz] = xyz(i);
|
|
54
|
+
return [
|
|
55
|
+
(coordinate as unknown as Coordinate3D).map([cx, cy, cz]),
|
|
56
|
+
] as Vector3[];
|
|
57
|
+
});
|
|
58
|
+
return [index, P];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const shape = {
|
|
63
|
+
sphere: Sphere,
|
|
64
|
+
cube: Cube,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
Point3D.props = {
|
|
68
|
+
defaultShape: 'cube',
|
|
69
|
+
defaultLabelShape: 'label',
|
|
70
|
+
composite: false,
|
|
71
|
+
shape,
|
|
72
|
+
channels: [
|
|
73
|
+
...baseGeometryChannels({ shapes: Object.keys(shape) }),
|
|
74
|
+
{ name: 'x', required: true },
|
|
75
|
+
{ name: 'y', required: true },
|
|
76
|
+
{ name: 'z', required: true },
|
|
77
|
+
{ name: 'series', scale: 'band' },
|
|
78
|
+
{ name: 'size', quantitative: 'sqrt' },
|
|
79
|
+
{ name: 'dx', scale: 'identity' },
|
|
80
|
+
{ name: 'dy', scale: 'identity' },
|
|
81
|
+
{ name: 'dz', scale: 'identity' },
|
|
82
|
+
],
|
|
83
|
+
preInference: [
|
|
84
|
+
...basePreInference(),
|
|
85
|
+
{ type: MaybeZeroX },
|
|
86
|
+
{ type: MaybeZeroY },
|
|
87
|
+
{ type: MaybeZeroZ },
|
|
88
|
+
],
|
|
89
|
+
postInference: [...basePostInference(), { type: MaybeSize }, ...tooltip3d()],
|
|
90
|
+
};
|
package/src/mark/utils.ts
CHANGED
|
@@ -30,6 +30,13 @@ export function baseGeometryChannels(options: ChannelOptions = {}): Channel[] {
|
|
|
30
30
|
return [...baseChannels(options), { name: 'title', scale: 'identity' }];
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export function tooltip3d() {
|
|
34
|
+
return [
|
|
35
|
+
{ type: MaybeTitle, channel: 'color' },
|
|
36
|
+
{ type: MaybeTooltip, channel: ['x', 'y', 'z'] },
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
export function tooltip2d() {
|
|
34
41
|
return [
|
|
35
42
|
{ type: MaybeTitle, channel: 'color' },
|
package/src/runtime/component.ts
CHANGED
|
@@ -102,6 +102,7 @@ export function inferComponent(
|
|
|
102
102
|
const { props } = createGuideComponent(type);
|
|
103
103
|
const {
|
|
104
104
|
defaultPosition,
|
|
105
|
+
defaultPlane = 'xy',
|
|
105
106
|
defaultOrientation,
|
|
106
107
|
defaultSize,
|
|
107
108
|
defaultOrder,
|
|
@@ -148,6 +149,7 @@ export function inferComponent(
|
|
|
148
149
|
defaultSize,
|
|
149
150
|
length,
|
|
150
151
|
position,
|
|
152
|
+
plane: defaultPlane,
|
|
151
153
|
orientation,
|
|
152
154
|
padding,
|
|
153
155
|
order,
|
|
@@ -363,6 +365,10 @@ function inferAxisComponentType(
|
|
|
363
365
|
if (isRadial(coordinates)) return ['axisArc', [scale]];
|
|
364
366
|
return [isTranspose(coordinates) ? 'axisX' : 'axisY', [scale]];
|
|
365
367
|
}
|
|
368
|
+
// Only support linear axis for z.
|
|
369
|
+
if (name.startsWith('z')) {
|
|
370
|
+
return ['axisZ', [scale]];
|
|
371
|
+
}
|
|
366
372
|
if (name.startsWith('position')) {
|
|
367
373
|
if (isRadar(coordinates)) return ['axisRadar', [scale]];
|
|
368
374
|
if (!isPolar(coordinates)) return ['axisY', [scale]];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Coordinate } from '@antv/coord';
|
|
1
|
+
import { Coordinate, Coordinate3D } from '@antv/coord';
|
|
2
2
|
import { G2View, G2CoordinateOptions, G2Library } from './types/options';
|
|
3
3
|
import { CoordinateComponent, CoordinateTransform } from './types/component';
|
|
4
4
|
import { useLibrary } from './library';
|
|
@@ -21,22 +21,27 @@ export function createCoordinate(
|
|
|
21
21
|
insetTop,
|
|
22
22
|
insetRight,
|
|
23
23
|
insetBottom,
|
|
24
|
-
marginLeft,
|
|
25
|
-
marginTop,
|
|
26
24
|
} = layout;
|
|
27
25
|
const { coordinates: partialTransform = [] } = partialOptions;
|
|
28
26
|
const transform = inferCoordinate(partialTransform);
|
|
29
|
-
|
|
27
|
+
|
|
28
|
+
const isCartesian3D = transform[0].type === 'cartesian3D';
|
|
29
|
+
const options = {
|
|
30
30
|
// @todo Find a better solution.
|
|
31
31
|
// Store more layout information for component.
|
|
32
32
|
...layout,
|
|
33
|
-
x: insetLeft
|
|
34
|
-
y: insetTop
|
|
33
|
+
x: insetLeft,
|
|
34
|
+
y: insetTop,
|
|
35
35
|
width: innerWidth - insetLeft - insetRight,
|
|
36
36
|
height: innerHeight - insetBottom - insetTop,
|
|
37
|
-
transformations: transform.
|
|
38
|
-
}
|
|
39
|
-
|
|
37
|
+
transformations: transform.flatMap(useCoordinate),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const coordinate = isCartesian3D
|
|
41
|
+
? // @ts-ignore
|
|
42
|
+
new Coordinate3D(options)
|
|
43
|
+
: new Coordinate(options);
|
|
44
|
+
return coordinate as Coordinate;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
export function coordinate2Transform(node: G2View, library: G2Library): G2View {
|
|
@@ -112,6 +117,9 @@ export function isReflectY(coordinates: G2CoordinateOptions[]) {
|
|
|
112
117
|
function inferCoordinate(
|
|
113
118
|
coordinates: G2CoordinateOptions[],
|
|
114
119
|
): G2CoordinateOptions[] {
|
|
115
|
-
if (
|
|
120
|
+
if (
|
|
121
|
+
coordinates.find((d) => d.type === 'cartesian' || d.type === 'cartesian3D')
|
|
122
|
+
)
|
|
123
|
+
return coordinates;
|
|
116
124
|
return [...coordinates, { type: 'cartesian' }];
|
|
117
125
|
}
|
package/src/runtime/layout.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
Section,
|
|
13
13
|
SectionArea,
|
|
14
14
|
G2Theme,
|
|
15
|
+
GuideComponentPlane,
|
|
15
16
|
} from './types/common';
|
|
16
17
|
import {
|
|
17
18
|
computeComponentSize,
|
|
@@ -24,6 +25,45 @@ import {
|
|
|
24
25
|
import { G2GuideComponentOptions, G2Library, G2View } from './types/options';
|
|
25
26
|
import { isPolar as isPolarOptions } from './coordinate';
|
|
26
27
|
|
|
28
|
+
export function processAxisZ(components: G2GuideComponentOptions[]) {
|
|
29
|
+
const axisZ = components.find(({ type }) => type === 'axisZ');
|
|
30
|
+
if (axisZ) {
|
|
31
|
+
const axisX = components.find(({ type }) => type === 'axisX');
|
|
32
|
+
axisX.plane = 'xy';
|
|
33
|
+
const axisY = components.find(({ type }) => type === 'axisY');
|
|
34
|
+
axisY.plane = 'xy';
|
|
35
|
+
axisZ.plane = 'yz';
|
|
36
|
+
axisZ.origin = [axisX.bbox.x, axisX.bbox.y, 0];
|
|
37
|
+
axisZ.eulerAngles = [0, -90, 0];
|
|
38
|
+
axisZ.bbox.x = axisX.bbox.x;
|
|
39
|
+
axisZ.bbox.y = axisX.bbox.y;
|
|
40
|
+
components.push({
|
|
41
|
+
...axisX,
|
|
42
|
+
plane: 'xz',
|
|
43
|
+
showLabel: false,
|
|
44
|
+
showTitle: false,
|
|
45
|
+
origin: [axisX.bbox.x, axisX.bbox.y, 0],
|
|
46
|
+
eulerAngles: [-90, 0, 0],
|
|
47
|
+
});
|
|
48
|
+
components.push({
|
|
49
|
+
...axisY,
|
|
50
|
+
plane: 'yz',
|
|
51
|
+
showLabel: false,
|
|
52
|
+
showTitle: false,
|
|
53
|
+
origin: [axisY.bbox.x + axisY.bbox.width, axisY.bbox.y, 0],
|
|
54
|
+
eulerAngles: [0, -90, 0],
|
|
55
|
+
});
|
|
56
|
+
components.push({
|
|
57
|
+
...axisZ,
|
|
58
|
+
plane: 'xz',
|
|
59
|
+
actualPosition: 'left',
|
|
60
|
+
showLabel: false,
|
|
61
|
+
showTitle: false,
|
|
62
|
+
eulerAngles: [90, -90, 0],
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
27
67
|
export function computeLayout(
|
|
28
68
|
components: G2GuideComponentOptions[],
|
|
29
69
|
options: G2View,
|
|
@@ -33,8 +73,10 @@ export function computeLayout(
|
|
|
33
73
|
const {
|
|
34
74
|
width,
|
|
35
75
|
height,
|
|
76
|
+
depth,
|
|
36
77
|
x = 0,
|
|
37
78
|
y = 0,
|
|
79
|
+
z = 0,
|
|
38
80
|
inset = 0,
|
|
39
81
|
insetLeft = inset,
|
|
40
82
|
insetTop = inset,
|
|
@@ -109,6 +151,7 @@ export function computeLayout(
|
|
|
109
151
|
return {
|
|
110
152
|
width,
|
|
111
153
|
height,
|
|
154
|
+
depth,
|
|
112
155
|
insetLeft,
|
|
113
156
|
insetTop,
|
|
114
157
|
insetBottom,
|
|
@@ -125,6 +168,7 @@ export function computeLayout(
|
|
|
125
168
|
marginRight,
|
|
126
169
|
x,
|
|
127
170
|
y,
|
|
171
|
+
z,
|
|
128
172
|
};
|
|
129
173
|
}
|
|
130
174
|
|
|
@@ -314,7 +358,11 @@ export function placeComponents(
|
|
|
314
358
|
coordinate: Coordinate,
|
|
315
359
|
layout: Layout,
|
|
316
360
|
): void {
|
|
317
|
-
|
|
361
|
+
// Group components by plane & position.
|
|
362
|
+
const positionComponents = group<G2GuideComponentOptions, string>(
|
|
363
|
+
components,
|
|
364
|
+
(d) => `${d.plane || 'xy'}-${d.position}`,
|
|
365
|
+
);
|
|
318
366
|
const {
|
|
319
367
|
paddingLeft,
|
|
320
368
|
paddingRight,
|
|
@@ -332,8 +380,135 @@ export function placeComponents(
|
|
|
332
380
|
insetTop,
|
|
333
381
|
height,
|
|
334
382
|
width,
|
|
383
|
+
depth,
|
|
335
384
|
} = layout;
|
|
336
385
|
|
|
386
|
+
const planes = {
|
|
387
|
+
xy: createSection({
|
|
388
|
+
width,
|
|
389
|
+
height,
|
|
390
|
+
paddingLeft,
|
|
391
|
+
paddingRight,
|
|
392
|
+
paddingTop,
|
|
393
|
+
paddingBottom,
|
|
394
|
+
marginLeft,
|
|
395
|
+
marginTop,
|
|
396
|
+
marginBottom,
|
|
397
|
+
marginRight,
|
|
398
|
+
innerHeight,
|
|
399
|
+
innerWidth,
|
|
400
|
+
insetBottom,
|
|
401
|
+
insetLeft,
|
|
402
|
+
insetRight,
|
|
403
|
+
insetTop,
|
|
404
|
+
}),
|
|
405
|
+
yz: createSection({
|
|
406
|
+
width: depth,
|
|
407
|
+
height: height,
|
|
408
|
+
paddingLeft: 0,
|
|
409
|
+
paddingRight: 0,
|
|
410
|
+
paddingTop: 0,
|
|
411
|
+
paddingBottom: 0,
|
|
412
|
+
marginLeft: 0,
|
|
413
|
+
marginTop: 0,
|
|
414
|
+
marginBottom: 0,
|
|
415
|
+
marginRight: 0,
|
|
416
|
+
innerWidth: depth,
|
|
417
|
+
innerHeight: height,
|
|
418
|
+
insetBottom: 0,
|
|
419
|
+
insetLeft: 0,
|
|
420
|
+
insetRight: 0,
|
|
421
|
+
insetTop: 0,
|
|
422
|
+
}),
|
|
423
|
+
xz: createSection({
|
|
424
|
+
width,
|
|
425
|
+
height: depth,
|
|
426
|
+
paddingLeft: 0,
|
|
427
|
+
paddingRight: 0,
|
|
428
|
+
paddingTop: 0,
|
|
429
|
+
paddingBottom: 0,
|
|
430
|
+
marginLeft: 0,
|
|
431
|
+
marginTop: 0,
|
|
432
|
+
marginBottom: 0,
|
|
433
|
+
marginRight: 0,
|
|
434
|
+
innerWidth: width,
|
|
435
|
+
innerHeight: depth,
|
|
436
|
+
insetBottom: 0,
|
|
437
|
+
insetLeft: 0,
|
|
438
|
+
insetRight: 0,
|
|
439
|
+
insetTop: 0,
|
|
440
|
+
}),
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
for (const [key, components] of positionComponents.entries()) {
|
|
444
|
+
const [plane, position] = key.split('-') as [GuideComponentPlane, GCP];
|
|
445
|
+
const area = planes[plane][position];
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* @description non-entity components: axis in the center, inner, outer, component in the center
|
|
449
|
+
* @description entity components: other components
|
|
450
|
+
* @description no volume components take up no extra space
|
|
451
|
+
*/
|
|
452
|
+
|
|
453
|
+
const [nonEntityComponents, entityComponents] = divide(
|
|
454
|
+
components,
|
|
455
|
+
(component) => {
|
|
456
|
+
if (typeof component.type !== 'string') return false;
|
|
457
|
+
if (position === 'center') return true;
|
|
458
|
+
if (
|
|
459
|
+
component.type.startsWith('axis') &&
|
|
460
|
+
['inner', 'outer'].includes(position)
|
|
461
|
+
) {
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
},
|
|
466
|
+
);
|
|
467
|
+
|
|
468
|
+
if (nonEntityComponents.length) {
|
|
469
|
+
placeNonEntityComponents(nonEntityComponents, coordinate, area, position);
|
|
470
|
+
}
|
|
471
|
+
if (entityComponents.length) {
|
|
472
|
+
placePaddingArea(components, coordinate, area);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function createSection({
|
|
478
|
+
width,
|
|
479
|
+
height,
|
|
480
|
+
paddingLeft,
|
|
481
|
+
paddingRight,
|
|
482
|
+
paddingTop,
|
|
483
|
+
paddingBottom,
|
|
484
|
+
marginLeft,
|
|
485
|
+
marginTop,
|
|
486
|
+
marginBottom,
|
|
487
|
+
marginRight,
|
|
488
|
+
innerHeight,
|
|
489
|
+
innerWidth,
|
|
490
|
+
insetBottom,
|
|
491
|
+
insetLeft,
|
|
492
|
+
insetRight,
|
|
493
|
+
insetTop,
|
|
494
|
+
}: {
|
|
495
|
+
width: number;
|
|
496
|
+
height: number;
|
|
497
|
+
paddingLeft: number;
|
|
498
|
+
paddingRight: number;
|
|
499
|
+
paddingTop: number;
|
|
500
|
+
paddingBottom: number;
|
|
501
|
+
marginLeft: number;
|
|
502
|
+
marginTop: number;
|
|
503
|
+
marginBottom: number;
|
|
504
|
+
marginRight: number;
|
|
505
|
+
innerHeight: number;
|
|
506
|
+
innerWidth: number;
|
|
507
|
+
insetBottom: number;
|
|
508
|
+
insetLeft: number;
|
|
509
|
+
insetRight: number;
|
|
510
|
+
insetTop: number;
|
|
511
|
+
}): Section {
|
|
337
512
|
const pl = paddingLeft + marginLeft;
|
|
338
513
|
const pt = paddingTop + marginTop;
|
|
339
514
|
const pr = paddingRight + marginRight;
|
|
@@ -349,7 +524,7 @@ export function placeComponents(
|
|
|
349
524
|
null,
|
|
350
525
|
];
|
|
351
526
|
|
|
352
|
-
const
|
|
527
|
+
const xySection: Section = {
|
|
353
528
|
top: [pl, 0, innerWidth, pt, 'vertical', true, ascending],
|
|
354
529
|
right: [width - pr, pt, pr, innerHeight, 'horizontal', false, ascending],
|
|
355
530
|
bottom: [pl, height - pb, innerWidth, pb, 'vertical', false, ascending],
|
|
@@ -379,37 +554,7 @@ export function placeComponents(
|
|
|
379
554
|
outer: centerSection,
|
|
380
555
|
};
|
|
381
556
|
|
|
382
|
-
|
|
383
|
-
const area = section[position];
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* @description non-entity components: axis in the center, inner, outer, component in the center
|
|
387
|
-
* @description entity components: other components
|
|
388
|
-
* @description no volume components take up no extra space
|
|
389
|
-
*/
|
|
390
|
-
|
|
391
|
-
const [nonEntityComponents, entityComponents] = divide(
|
|
392
|
-
components,
|
|
393
|
-
(component) => {
|
|
394
|
-
if (typeof component.type !== 'string') return false;
|
|
395
|
-
if (position === 'center') return true;
|
|
396
|
-
if (
|
|
397
|
-
component.type.startsWith('axis') &&
|
|
398
|
-
['inner', 'outer'].includes(position)
|
|
399
|
-
) {
|
|
400
|
-
return true;
|
|
401
|
-
}
|
|
402
|
-
return false;
|
|
403
|
-
},
|
|
404
|
-
);
|
|
405
|
-
|
|
406
|
-
if (nonEntityComponents.length) {
|
|
407
|
-
placeNonEntityComponents(nonEntityComponents, coordinate, area, position);
|
|
408
|
-
}
|
|
409
|
-
if (entityComponents.length) {
|
|
410
|
-
placePaddingArea(components, coordinate, area);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
557
|
+
return xySection;
|
|
413
558
|
}
|
|
414
559
|
|
|
415
560
|
function placeNonEntityComponents(
|
package/src/runtime/plot.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Vector2 } from '@antv/coord';
|
|
2
2
|
import { DisplayObject, IAnimation as GAnimation, Rect } from '@antv/g';
|
|
3
3
|
import { deepMix, upperFirst } from '@antv/util';
|
|
4
|
-
import { group, groups } from 'd3-array';
|
|
4
|
+
import { group, groups, sort } from 'd3-array';
|
|
5
5
|
import { format } from 'd3-format';
|
|
6
6
|
import { mapObject } from '../utils/array';
|
|
7
7
|
import { ChartEvent } from '../utils/event';
|
|
@@ -33,7 +33,12 @@ import {
|
|
|
33
33
|
VIEW_CLASS_NAME,
|
|
34
34
|
} from './constant';
|
|
35
35
|
import { coordinate2Transform, createCoordinate } from './coordinate';
|
|
36
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
computeLayout,
|
|
38
|
+
computeRoughPlotSize,
|
|
39
|
+
placeComponents,
|
|
40
|
+
processAxisZ,
|
|
41
|
+
} from './layout';
|
|
37
42
|
import { documentOf, useLibrary } from './library';
|
|
38
43
|
import { initializeMark } from './mark';
|
|
39
44
|
import {
|
|
@@ -237,12 +242,27 @@ export async function plot<T extends G2ViewTree>(
|
|
|
237
242
|
const viewInstanceof = (
|
|
238
243
|
viewContainer: Map<G2ViewDescriptor, DisplayObject>,
|
|
239
244
|
) => {
|
|
240
|
-
return Array.from(viewContainer.entries()).map(([view, container]) =>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
options
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
return Array.from(viewContainer.entries()).map(([view, container]) => {
|
|
246
|
+
// Index state by component or interaction name,
|
|
247
|
+
// such as legend, scrollbar, brushFilter.
|
|
248
|
+
// Each state transform options to another options.
|
|
249
|
+
const store = new Map<any, (options: G2ViewTree) => G2ViewTree>();
|
|
250
|
+
const setState = (key, reducer = (x) => x) => store.set(key, reducer);
|
|
251
|
+
const update = createUpdateView(select(container), library, context);
|
|
252
|
+
const options = viewNode.get(view);
|
|
253
|
+
return {
|
|
254
|
+
view,
|
|
255
|
+
container,
|
|
256
|
+
options,
|
|
257
|
+
setState,
|
|
258
|
+
update: async () => {
|
|
259
|
+
// Apply all state functions to get new options.
|
|
260
|
+
const reducer = compose(Array.from(store.values()));
|
|
261
|
+
const newOptions = reducer(options);
|
|
262
|
+
return await update(newOptions);
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
});
|
|
246
266
|
};
|
|
247
267
|
|
|
248
268
|
// Interactions for enter views.
|
|
@@ -611,6 +631,9 @@ function initializeState(
|
|
|
611
631
|
// Place components and mutate their bbox.
|
|
612
632
|
placeComponents(groupComponents(components), coordinate, layout);
|
|
613
633
|
|
|
634
|
+
// AxisZ need a copy of axisX and axisY to show grids in X-Z & Y-Z planes.
|
|
635
|
+
processAxisZ(components);
|
|
636
|
+
|
|
614
637
|
// Scale from marks and components.
|
|
615
638
|
const scaleInstance = {};
|
|
616
639
|
|
|
@@ -1537,8 +1560,8 @@ async function applyTransform<T extends G2ViewTree>(
|
|
|
1537
1560
|
|
|
1538
1561
|
function updateBBox(selection: Selection) {
|
|
1539
1562
|
selection
|
|
1540
|
-
.style('x', (d) => d.paddingLeft)
|
|
1541
|
-
.style('y', (d) => d.paddingTop)
|
|
1563
|
+
.style('x', (d) => d.paddingLeft + d.marginLeft)
|
|
1564
|
+
.style('y', (d) => d.paddingTop + d.marginTop)
|
|
1542
1565
|
.style('width', (d) => d.innerWidth)
|
|
1543
1566
|
.style('height', (d) => d.innerHeight);
|
|
1544
1567
|
}
|
package/src/runtime/render.ts
CHANGED
|
@@ -70,7 +70,7 @@ export function render<T extends G2ViewTree = G2ViewTree>(
|
|
|
70
70
|
},
|
|
71
71
|
): HTMLElement {
|
|
72
72
|
// Initialize the context if it is not provided.
|
|
73
|
-
const { width = 640, height = 480, theme } = options;
|
|
73
|
+
const { width = 640, height = 480, depth = 0, theme } = options;
|
|
74
74
|
if (!theme) {
|
|
75
75
|
error(
|
|
76
76
|
'ChartOptions.theme is required, such as `const chart = new Chart({ theme: "classic"})`.',
|
|
@@ -84,7 +84,11 @@ export function render<T extends G2ViewTree = G2ViewTree>(
|
|
|
84
84
|
} = context;
|
|
85
85
|
context.canvas = canvas;
|
|
86
86
|
context.emitter = emitter;
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
const { width: prevWidth, height: prevHeight } = canvas.getConfig();
|
|
89
|
+
if (prevWidth !== width || prevHeight !== height) {
|
|
90
|
+
canvas.resize(width, height);
|
|
91
|
+
}
|
|
88
92
|
|
|
89
93
|
emitter.emit(ChartEvent.BEFORE_RENDER);
|
|
90
94
|
|
|
@@ -93,9 +97,16 @@ export function render<T extends G2ViewTree = G2ViewTree>(
|
|
|
93
97
|
const selection = select(canvas.document.documentElement);
|
|
94
98
|
canvas.ready
|
|
95
99
|
.then(() =>
|
|
96
|
-
plot<T>({ ...keyed, width, height }, selection, library, context),
|
|
100
|
+
plot<T>({ ...keyed, width, height, depth }, selection, library, context),
|
|
97
101
|
)
|
|
98
102
|
.then(() => {
|
|
103
|
+
// Place the center of whole scene at z axis' origin.
|
|
104
|
+
if (depth) {
|
|
105
|
+
const [x, y] = canvas!.document.documentElement.getPosition();
|
|
106
|
+
// Since `render` method can be called for multiple times, use setPosition instead of translate here.
|
|
107
|
+
canvas!.document.documentElement.setPosition(x, y, -depth / 2);
|
|
108
|
+
}
|
|
109
|
+
|
|
99
110
|
// Wait for the next tick.
|
|
100
111
|
canvas.requestAnimationFrame(() => {
|
|
101
112
|
emitter.emit(ChartEvent.AFTER_RENDER);
|
|
@@ -126,6 +126,7 @@ export type Channel = {
|
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
export type Vector2 = [number, number];
|
|
129
|
+
export type Vector3 = [number, number, number];
|
|
129
130
|
|
|
130
131
|
export type BBox = {
|
|
131
132
|
x?: number;
|
|
@@ -152,6 +153,7 @@ export type GuideComponentPosition =
|
|
|
152
153
|
| GuideCompositePosition;
|
|
153
154
|
|
|
154
155
|
export type GuideComponentOrientation = 'horizontal' | 'vertical' | number;
|
|
156
|
+
export type GuideComponentPlane = 'xy' | 'xz' | 'yz';
|
|
155
157
|
|
|
156
158
|
export type Layout = {
|
|
157
159
|
paddingLeft?: number;
|
|
@@ -173,6 +175,8 @@ export type Layout = {
|
|
|
173
175
|
marginRight?: number;
|
|
174
176
|
x?: number;
|
|
175
177
|
y?: number;
|
|
178
|
+
z?: number;
|
|
179
|
+
depth?: number;
|
|
176
180
|
};
|
|
177
181
|
|
|
178
182
|
export type Direction = 'horizontal' | 'vertical' | 'center';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Coordinate, Transformation } from '@antv/coord';
|
|
1
|
+
import { Coordinate, Transformation, Transformation3D } from '@antv/coord';
|
|
2
2
|
import EventEmitter from '@antv/event-emitter';
|
|
3
3
|
import { DisplayObject, IAnimation as GAnimation, IDocument } from '@antv/g';
|
|
4
4
|
import {
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
IndexedValue,
|
|
10
10
|
Vector2,
|
|
11
11
|
G2MarkState,
|
|
12
|
+
GuideComponentPlane,
|
|
12
13
|
} from './common';
|
|
13
14
|
import { DataComponent } from './data';
|
|
14
15
|
import { Encode, EncodeComponent } from './encode';
|
|
@@ -115,6 +116,13 @@ export type CoordinateComponent<O = Record<string, unknown>> = G2BaseComponent<
|
|
|
115
116
|
CoordinateProps
|
|
116
117
|
>;
|
|
117
118
|
|
|
119
|
+
export type Coordinate3DTransform = Transformation3D[];
|
|
120
|
+
export type Coordinate3DProps = {
|
|
121
|
+
transform?: boolean;
|
|
122
|
+
};
|
|
123
|
+
export type Coordinate3DComponent<O = Record<string, unknown>> =
|
|
124
|
+
G2BaseComponent<Coordinate3DTransform, O, Coordinate3DProps>;
|
|
125
|
+
|
|
118
126
|
export type Palette = string[];
|
|
119
127
|
export type PaletteComponent<O = Record<string, unknown>> = G2BaseComponent<
|
|
120
128
|
Palette,
|
|
@@ -169,6 +177,7 @@ export type GuideComponent = (context: GuideComponentContext) => DisplayObject;
|
|
|
169
177
|
|
|
170
178
|
export type GuideComponentProps = {
|
|
171
179
|
defaultPosition?: GuideComponentPosition;
|
|
180
|
+
defaultPlane?: GuideComponentPlane;
|
|
172
181
|
defaultOrientation?: GuideComponentOrientation;
|
|
173
182
|
defaultSize?: number;
|
|
174
183
|
defaultOrder?: number;
|
|
@@ -4,6 +4,7 @@ import { Canvas, IAnimation as GAnimation } from '@antv/g';
|
|
|
4
4
|
import {
|
|
5
5
|
G2Title,
|
|
6
6
|
G2ViewDescriptor,
|
|
7
|
+
GuideComponentPlane,
|
|
7
8
|
GuideComponentPosition,
|
|
8
9
|
Layout,
|
|
9
10
|
Primitive,
|
|
@@ -32,6 +33,7 @@ import { TransformComponent } from './transform';
|
|
|
32
33
|
export type G2ViewTree = {
|
|
33
34
|
width?: number;
|
|
34
35
|
height?: number;
|
|
36
|
+
depth?: number;
|
|
35
37
|
} & Node;
|
|
36
38
|
|
|
37
39
|
export type Node = {
|
|
@@ -68,8 +70,10 @@ export type G2View = {
|
|
|
68
70
|
key?: string;
|
|
69
71
|
x?: number;
|
|
70
72
|
y?: number;
|
|
73
|
+
z?: number;
|
|
71
74
|
width?: number;
|
|
72
75
|
height?: number;
|
|
76
|
+
depth?: number;
|
|
73
77
|
padding?: number;
|
|
74
78
|
paddingLeft?: number;
|
|
75
79
|
paddingRight?: number;
|
|
@@ -186,6 +190,7 @@ export type G2GuideComponentOptions = G2BaseComponentOptions<
|
|
|
186
190
|
{
|
|
187
191
|
scale?: G2ScaleOptions;
|
|
188
192
|
position?: GuideComponentPosition;
|
|
193
|
+
plane?: GuideComponentPlane;
|
|
189
194
|
size?: number;
|
|
190
195
|
order?: number;
|
|
191
196
|
zIndex?: number;
|