@antv/g2 5.1.9 → 5.1.11
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/dist/g2.lite.min.js +1 -1
- package/dist/g2.min.js +1 -1
- package/esm/animation/scaleInY.js +103 -33
- package/esm/animation/scaleInY.js.map +1 -1
- package/esm/component/slider.js +32 -2
- package/esm/component/slider.js.map +1 -1
- package/esm/composition/facetCircle.js +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/interaction/chartIndex.d.ts +5 -0
- package/esm/interaction/chartIndex.js +4 -1
- package/esm/interaction/chartIndex.js.map +1 -1
- package/esm/interaction/elementHighlight.d.ts +5 -0
- package/esm/interaction/elementHighlight.js +3 -0
- package/esm/interaction/elementHighlight.js.map +1 -1
- package/esm/interaction/elementHighlightByColor.d.ts +5 -0
- package/esm/interaction/elementHighlightByColor.js +3 -0
- package/esm/interaction/elementHighlightByColor.js.map +1 -1
- package/esm/interaction/elementHighlightByX.d.ts +5 -0
- package/esm/interaction/elementHighlightByX.js +3 -0
- package/esm/interaction/elementHighlightByX.js.map +1 -1
- package/esm/interaction/elementSelect.d.ts +5 -0
- package/esm/interaction/elementSelect.js +3 -0
- package/esm/interaction/elementSelect.js.map +1 -1
- package/esm/interaction/elementSelectByColor.d.ts +5 -0
- package/esm/interaction/elementSelectByColor.js +3 -0
- package/esm/interaction/elementSelectByColor.js.map +1 -1
- package/esm/interaction/elementSelectByX.d.ts +5 -0
- package/esm/interaction/elementSelectByX.js +3 -0
- package/esm/interaction/elementSelectByX.js.map +1 -1
- package/esm/interaction/event.d.ts +5 -0
- package/esm/interaction/event.js +3 -0
- package/esm/interaction/event.js.map +1 -1
- package/esm/interaction/poptip.d.ts +5 -0
- package/esm/interaction/poptip.js +3 -0
- package/esm/interaction/poptip.js.map +1 -1
- package/esm/interaction/sliderFilter.js +2 -0
- package/esm/interaction/sliderFilter.js.map +1 -1
- package/esm/interaction/tooltip.d.ts +5 -0
- package/esm/interaction/tooltip.js +16 -9
- 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/std.d.ts +1 -0
- package/esm/mark/chord.js +2 -0
- package/esm/mark/chord.js.map +1 -1
- package/esm/runtime/library.js +7 -4
- package/esm/runtime/library.js.map +1 -1
- package/esm/runtime/plot.js +41 -19
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js +5 -2
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/types/common.d.ts +1 -1
- package/esm/shape/area/smooth.d.ts +1 -3
- package/esm/shape/area/smooth.js +9 -5
- package/esm/shape/area/smooth.js.map +1 -1
- package/esm/shape/line/smooth.d.ts +1 -3
- package/esm/shape/line/smooth.js +2 -2
- package/esm/shape/line/smooth.js.map +1 -1
- package/esm/spec/composition.d.ts +1 -1
- package/esm/spec/mark.d.ts +1 -1
- package/esm/spec/transform.d.ts +7 -2
- package/esm/transform/index.d.ts +2 -0
- package/esm/transform/index.js +1 -0
- package/esm/transform/index.js.map +1 -1
- package/esm/transform/jitterY.d.ts +8 -0
- package/esm/transform/jitterY.js +25 -0
- package/esm/transform/jitterY.js.map +1 -0
- package/lib/animation/scaleInY.js +102 -32
- package/lib/animation/scaleInY.js.map +1 -1
- package/lib/component/slider.js +32 -2
- package/lib/component/slider.js.map +1 -1
- package/lib/composition/facetCircle.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/interaction/chartIndex.d.ts +5 -0
- package/lib/interaction/chartIndex.js +4 -1
- package/lib/interaction/chartIndex.js.map +1 -1
- package/lib/interaction/elementHighlight.d.ts +5 -0
- package/lib/interaction/elementHighlight.js +3 -0
- package/lib/interaction/elementHighlight.js.map +1 -1
- package/lib/interaction/elementHighlightByColor.d.ts +5 -0
- package/lib/interaction/elementHighlightByColor.js +3 -0
- package/lib/interaction/elementHighlightByColor.js.map +1 -1
- package/lib/interaction/elementHighlightByX.d.ts +5 -0
- package/lib/interaction/elementHighlightByX.js +3 -0
- package/lib/interaction/elementHighlightByX.js.map +1 -1
- package/lib/interaction/elementSelect.d.ts +5 -0
- package/lib/interaction/elementSelect.js +3 -0
- package/lib/interaction/elementSelect.js.map +1 -1
- package/lib/interaction/elementSelectByColor.d.ts +5 -0
- package/lib/interaction/elementSelectByColor.js +3 -0
- package/lib/interaction/elementSelectByColor.js.map +1 -1
- package/lib/interaction/elementSelectByX.d.ts +5 -0
- package/lib/interaction/elementSelectByX.js +3 -0
- package/lib/interaction/elementSelectByX.js.map +1 -1
- package/lib/interaction/event.d.ts +5 -0
- package/lib/interaction/event.js +3 -0
- package/lib/interaction/event.js.map +1 -1
- package/lib/interaction/poptip.d.ts +5 -0
- package/lib/interaction/poptip.js +3 -0
- package/lib/interaction/poptip.js.map +1 -1
- package/lib/interaction/sliderFilter.js +2 -0
- package/lib/interaction/sliderFilter.js.map +1 -1
- package/lib/interaction/tooltip.d.ts +5 -0
- package/lib/interaction/tooltip.js +16 -9
- 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/std.d.ts +1 -0
- package/lib/mark/chord.js +2 -0
- package/lib/mark/chord.js.map +1 -1
- package/lib/runtime/library.js +7 -4
- package/lib/runtime/library.js.map +1 -1
- package/lib/runtime/plot.js +41 -19
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +5 -2
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/types/common.d.ts +1 -1
- package/lib/shape/area/smooth.d.ts +1 -3
- package/lib/shape/area/smooth.js +7 -3
- package/lib/shape/area/smooth.js.map +1 -1
- package/lib/shape/line/smooth.d.ts +1 -3
- package/lib/shape/line/smooth.js +2 -2
- package/lib/shape/line/smooth.js.map +1 -1
- package/lib/spec/composition.d.ts +1 -1
- package/lib/spec/mark.d.ts +1 -1
- package/lib/spec/transform.d.ts +7 -2
- package/lib/transform/index.d.ts +2 -0
- package/lib/transform/index.js +3 -1
- package/lib/transform/index.js.map +1 -1
- package/lib/transform/jitterY.d.ts +8 -0
- package/lib/transform/jitterY.js +29 -0
- package/lib/transform/jitterY.js.map +1 -0
- package/package.json +4 -2
- package/src/animation/scaleInY.ts +142 -43
- package/src/component/slider.ts +42 -2
- package/src/composition/facetCircle.ts +1 -1
- package/src/interaction/chartIndex.ts +5 -1
- package/src/interaction/elementHighlight.ts +4 -0
- package/src/interaction/elementHighlightByColor.ts +4 -0
- package/src/interaction/elementHighlightByX.ts +4 -0
- package/src/interaction/elementSelect.ts +4 -0
- package/src/interaction/elementSelectByColor.ts +4 -0
- package/src/interaction/elementSelectByX.ts +4 -0
- package/src/interaction/event.ts +4 -0
- package/src/interaction/poptip.ts +4 -0
- package/src/interaction/sliderFilter.ts +3 -0
- package/src/interaction/tooltip.ts +18 -12
- package/src/lib/core.ts +2 -0
- package/src/mark/chord.ts +2 -0
- package/src/runtime/library.ts +10 -3
- package/src/runtime/plot.ts +58 -21
- package/src/runtime/render.ts +3 -2
- package/src/runtime/types/common.ts +1 -1
- package/src/shape/area/smooth.ts +14 -8
- package/src/shape/line/smooth.ts +3 -5
- package/src/spec/composition.ts +1 -1
- package/src/spec/mark.ts +1 -1
- package/src/spec/transform.ts +8 -0
- package/src/transform/index.ts +2 -0
- package/src/transform/jitterY.ts +30 -0
- package/CHANGELOG.md +0 -471
package/src/shape/area/smooth.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
curveCatmullRomClosed,
|
|
3
|
+
curveMonotoneX,
|
|
4
|
+
curveMonotoneY,
|
|
5
|
+
} from 'd3-shape';
|
|
6
|
+
import { isPolar, isTranspose } from '../../utils/coordinate';
|
|
3
7
|
import { ShapeComponent as SC } from '../../runtime';
|
|
4
8
|
import { Curve } from './curve';
|
|
5
9
|
|
|
6
|
-
export type SmoothOptions =
|
|
7
|
-
alpha?: number;
|
|
8
|
-
};
|
|
10
|
+
export type SmoothOptions = Record<string, any>;
|
|
9
11
|
|
|
10
12
|
export const Smooth: SC<SmoothOptions> = (options, context) => {
|
|
11
|
-
const {
|
|
13
|
+
const { ...rest } = options;
|
|
12
14
|
const { coordinate } = context;
|
|
13
15
|
return (...params) => {
|
|
14
|
-
const curve = isPolar(coordinate)
|
|
15
|
-
|
|
16
|
+
const curve = isPolar(coordinate)
|
|
17
|
+
? curveCatmullRomClosed
|
|
18
|
+
: isTranspose(coordinate)
|
|
19
|
+
? curveMonotoneY
|
|
20
|
+
: curveMonotoneX;
|
|
21
|
+
return Curve({ curve, ...rest }, context)(...params);
|
|
16
22
|
};
|
|
17
23
|
};
|
|
18
24
|
|
package/src/shape/line/smooth.ts
CHANGED
|
@@ -7,12 +7,10 @@ import { isPolar, isTranspose } from '../../utils/coordinate';
|
|
|
7
7
|
import { ShapeComponent as SC } from '../../runtime';
|
|
8
8
|
import { Curve } from './curve';
|
|
9
9
|
|
|
10
|
-
export type SmoothOptions =
|
|
11
|
-
alpha?: number;
|
|
12
|
-
};
|
|
10
|
+
export type SmoothOptions = Record<string, any>;
|
|
13
11
|
|
|
14
12
|
export const Smooth: SC<SmoothOptions> = (options, context) => {
|
|
15
|
-
const {
|
|
13
|
+
const { ...rest } = options;
|
|
16
14
|
const { coordinate } = context;
|
|
17
15
|
return (...params) => {
|
|
18
16
|
const curve = isPolar(coordinate)
|
|
@@ -20,7 +18,7 @@ export const Smooth: SC<SmoothOptions> = (options, context) => {
|
|
|
20
18
|
: isTranspose(coordinate)
|
|
21
19
|
? curveMonotoneY
|
|
22
20
|
: curveMonotoneX;
|
|
23
|
-
return Curve({ curve
|
|
21
|
+
return Curve({ curve, ...rest }, context)(...params);
|
|
24
22
|
};
|
|
25
23
|
};
|
|
26
24
|
|
package/src/spec/composition.ts
CHANGED
|
@@ -65,7 +65,7 @@ export type ViewComposition = {
|
|
|
65
65
|
insetBottom?: number;
|
|
66
66
|
insetRight?: number;
|
|
67
67
|
coordinate?: Coordinate;
|
|
68
|
-
interaction?: Literal2Object<Interaction>;
|
|
68
|
+
interaction?: Literal2Object<Interaction> & Record<string, any>;
|
|
69
69
|
transform?: Transform[];
|
|
70
70
|
theme?: Theme;
|
|
71
71
|
children?: (Mark | AxisComponent | LegendComponent)[];
|
package/src/spec/mark.ts
CHANGED
|
@@ -188,7 +188,7 @@ export type BaseMark<T extends MarkTypes, C extends string = ChannelTypes> = {
|
|
|
188
188
|
Partial<Record<PositionChannelTypes, Closeable<ScrollbarComponent>>>
|
|
189
189
|
>;
|
|
190
190
|
title?: string | TitleComponent;
|
|
191
|
-
interaction?: Literal2Object<Interaction>;
|
|
191
|
+
interaction?: Literal2Object<Interaction> & Record<string, any>;
|
|
192
192
|
theme?: Theme;
|
|
193
193
|
};
|
|
194
194
|
|
package/src/spec/transform.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type Transform =
|
|
|
8
8
|
| StackEnterTransform
|
|
9
9
|
| JitterTransform
|
|
10
10
|
| JitterXTransform
|
|
11
|
+
| JitterYTransform
|
|
11
12
|
| SymmetryYTransform
|
|
12
13
|
| DiffYTransform
|
|
13
14
|
| SelectTransform
|
|
@@ -34,6 +35,7 @@ export type TransformTypes =
|
|
|
34
35
|
| 'stackEnter'
|
|
35
36
|
| 'jitter'
|
|
36
37
|
| 'jitterX'
|
|
38
|
+
| 'jitterY'
|
|
37
39
|
| 'symmetryY'
|
|
38
40
|
| 'diffY'
|
|
39
41
|
| 'select'
|
|
@@ -109,6 +111,12 @@ export type JitterXTransform = {
|
|
|
109
111
|
random?: () => number;
|
|
110
112
|
};
|
|
111
113
|
|
|
114
|
+
export type JitterYTransform = {
|
|
115
|
+
type?: 'jitterY';
|
|
116
|
+
padding?: number;
|
|
117
|
+
random?: () => number;
|
|
118
|
+
};
|
|
119
|
+
|
|
112
120
|
export type StackEnterTransform = {
|
|
113
121
|
type?: 'stackEnter';
|
|
114
122
|
groupBy?: string[] | string;
|
package/src/transform/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ export { StackEnter } from './stackEnter';
|
|
|
23
23
|
export { NormalizeY } from './normalizeY';
|
|
24
24
|
export { Jitter } from './jitter';
|
|
25
25
|
export { JitterX } from './jitterX';
|
|
26
|
+
export { JitterY } from './jitterY';
|
|
26
27
|
export { SymmetryY } from './symmetryY';
|
|
27
28
|
export { DiffY } from './diffY';
|
|
28
29
|
export { Select } from './select';
|
|
@@ -66,6 +67,7 @@ export type { StackEnterOptions } from './stackEnter';
|
|
|
66
67
|
export type { NormalizeYOptions } from './normalizeY';
|
|
67
68
|
export type { JitterOptions } from './jitter';
|
|
68
69
|
export type { JitterXOptions } from './jitterX';
|
|
70
|
+
export type { JitterYOptions } from './jitterY';
|
|
69
71
|
export type { SymmetryYOptions } from './symmetryY';
|
|
70
72
|
export type { DiffYOptions } from './diffY';
|
|
71
73
|
export type { SelectOptions } from './select';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { deepMix } from '@antv/util';
|
|
2
|
+
import { TransformComponent as TC } from '../runtime';
|
|
3
|
+
import { JitterYTransform } from '../spec';
|
|
4
|
+
import { column, columnOf } from './utils/helper';
|
|
5
|
+
import { rangeOf, interpolate } from './jitter';
|
|
6
|
+
|
|
7
|
+
export type JitterYOptions = Omit<JitterYTransform, 'type'>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The JitterY transform produce dy channels for marks (especially for point)
|
|
11
|
+
* with ordinal x and y dimension, say to make them jitter in their own space.
|
|
12
|
+
*/
|
|
13
|
+
export const JitterY: TC<JitterYOptions> = (options = {}) => {
|
|
14
|
+
const { padding = 0, random = Math.random } = options;
|
|
15
|
+
return (I, mark) => {
|
|
16
|
+
const { encode, scale } = mark;
|
|
17
|
+
const { y: scaleY } = scale;
|
|
18
|
+
const [Y] = columnOf(encode, 'y');
|
|
19
|
+
const rangeY = rangeOf(Y, scaleY, padding);
|
|
20
|
+
const DY = I.map(() => interpolate(random(), ...rangeY));
|
|
21
|
+
return [
|
|
22
|
+
I,
|
|
23
|
+
deepMix({ scale: { y: { padding: 0.5 } } }, mark, {
|
|
24
|
+
encode: { dy: column(DY) },
|
|
25
|
+
}),
|
|
26
|
+
];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
JitterY.props = {};
|