@antv/g2 5.0.0-beta.10 → 5.0.0-beta.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 +3 -3
- package/dist/g2.min.js +4 -4
- package/esm/composition/view.js +2 -6
- package/esm/composition/view.js.map +1 -1
- package/esm/interaction/native/tooltip.js +11 -4
- package/esm/interaction/native/tooltip.js.map +1 -1
- package/esm/mark/area.js +1 -0
- package/esm/mark/area.js.map +1 -1
- package/esm/mark/box.js +1 -0
- package/esm/mark/box.js.map +1 -1
- package/esm/mark/boxplot.js +1 -3
- package/esm/mark/boxplot.js.map +1 -1
- package/esm/mark/cell.js +1 -0
- package/esm/mark/cell.js.map +1 -1
- package/esm/mark/connector.js +1 -0
- package/esm/mark/connector.js.map +1 -1
- package/esm/mark/forceGraph.js +1 -1
- package/esm/mark/forceGraph.js.map +1 -1
- package/esm/mark/image.js +1 -0
- package/esm/mark/image.js.map +1 -1
- package/esm/mark/interval.js +1 -0
- package/esm/mark/interval.js.map +1 -1
- package/esm/mark/line.js +1 -0
- package/esm/mark/line.js.map +1 -1
- package/esm/mark/lineX.js +1 -0
- package/esm/mark/lineX.js.map +1 -1
- package/esm/mark/lineY.js +1 -0
- package/esm/mark/lineY.js.map +1 -1
- package/esm/mark/link.js +1 -0
- package/esm/mark/link.js.map +1 -1
- package/esm/mark/pack.js +1 -1
- package/esm/mark/pack.js.map +1 -1
- package/esm/mark/path.js +1 -0
- package/esm/mark/path.js.map +1 -1
- package/esm/mark/point.js +1 -0
- package/esm/mark/point.js.map +1 -1
- package/esm/mark/polygon.js +1 -0
- package/esm/mark/polygon.js.map +1 -1
- package/esm/mark/range.js +1 -0
- package/esm/mark/range.js.map +1 -1
- package/esm/mark/rangeX.js +1 -0
- package/esm/mark/rangeX.js.map +1 -1
- package/esm/mark/rangeY.js +1 -0
- package/esm/mark/rangeY.js.map +1 -1
- package/esm/mark/rect.js +1 -0
- package/esm/mark/rect.js.map +1 -1
- package/esm/mark/sankey.js +1 -1
- package/esm/mark/sankey.js.map +1 -1
- package/esm/mark/shape.js +1 -0
- package/esm/mark/shape.js.map +1 -1
- package/esm/mark/text.js +1 -0
- package/esm/mark/text.js.map +1 -1
- package/esm/mark/tree.js +1 -1
- package/esm/mark/tree.js.map +1 -1
- package/esm/mark/treemap.js +1 -1
- package/esm/mark/treemap.js.map +1 -1
- package/esm/mark/vector.js +1 -0
- package/esm/mark/vector.js.map +1 -1
- package/esm/mark/wordCloud.js +1 -1
- package/esm/mark/wordCloud.js.map +1 -1
- package/esm/runtime/mark.js +7 -4
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/plot.js +49 -24
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/scale.js +2 -0
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.js +1 -2
- package/esm/runtime/transform.js.map +1 -1
- package/esm/runtime/types/mark.d.ts +3 -3
- package/esm/runtime/types/options.d.ts +2 -0
- package/esm/scale/constant.d.ts +4 -0
- package/esm/scale/constant.js +6 -0
- package/esm/scale/constant.js.map +1 -0
- package/esm/scale/index.d.ts +2 -0
- package/esm/scale/index.js +1 -0
- package/esm/scale/index.js.map +1 -1
- package/esm/shape/interval/color.js +6 -4
- package/esm/shape/interval/color.js.map +1 -1
- package/esm/spec/scale.d.ts +4 -3
- package/esm/stdlib/index.js +2 -2
- package/esm/stdlib/index.js.map +1 -1
- package/lib/composition/view.js +2 -6
- package/lib/composition/view.js.map +1 -1
- package/lib/interaction/native/tooltip.js +10 -3
- package/lib/interaction/native/tooltip.js.map +1 -1
- package/lib/mark/area.js +1 -0
- package/lib/mark/area.js.map +1 -1
- package/lib/mark/box.js +1 -0
- package/lib/mark/box.js.map +1 -1
- package/lib/mark/boxplot.js +1 -3
- package/lib/mark/boxplot.js.map +1 -1
- package/lib/mark/cell.js +1 -0
- package/lib/mark/cell.js.map +1 -1
- package/lib/mark/connector.js +1 -0
- package/lib/mark/connector.js.map +1 -1
- package/lib/mark/forceGraph.js +1 -1
- package/lib/mark/forceGraph.js.map +1 -1
- package/lib/mark/image.js +1 -0
- package/lib/mark/image.js.map +1 -1
- package/lib/mark/interval.js +1 -0
- package/lib/mark/interval.js.map +1 -1
- package/lib/mark/line.js +1 -0
- package/lib/mark/line.js.map +1 -1
- package/lib/mark/lineX.js +1 -0
- package/lib/mark/lineX.js.map +1 -1
- package/lib/mark/lineY.js +1 -0
- package/lib/mark/lineY.js.map +1 -1
- package/lib/mark/link.js +1 -0
- package/lib/mark/link.js.map +1 -1
- package/lib/mark/pack.js +1 -1
- package/lib/mark/pack.js.map +1 -1
- package/lib/mark/path.js +1 -0
- package/lib/mark/path.js.map +1 -1
- package/lib/mark/point.js +1 -0
- package/lib/mark/point.js.map +1 -1
- package/lib/mark/polygon.js +1 -0
- package/lib/mark/polygon.js.map +1 -1
- package/lib/mark/range.js +1 -0
- package/lib/mark/range.js.map +1 -1
- package/lib/mark/rangeX.js +1 -0
- package/lib/mark/rangeX.js.map +1 -1
- package/lib/mark/rangeY.js +1 -0
- package/lib/mark/rangeY.js.map +1 -1
- package/lib/mark/rect.js +1 -0
- package/lib/mark/rect.js.map +1 -1
- package/lib/mark/sankey.js +1 -1
- package/lib/mark/sankey.js.map +1 -1
- package/lib/mark/shape.js +1 -0
- package/lib/mark/shape.js.map +1 -1
- package/lib/mark/text.js +1 -0
- package/lib/mark/text.js.map +1 -1
- package/lib/mark/tree.js +1 -1
- package/lib/mark/tree.js.map +1 -1
- package/lib/mark/treemap.js +1 -1
- package/lib/mark/treemap.js.map +1 -1
- package/lib/mark/vector.js +1 -0
- package/lib/mark/vector.js.map +1 -1
- package/lib/mark/wordCloud.js +1 -1
- package/lib/mark/wordCloud.js.map +1 -1
- package/lib/runtime/mark.js +7 -4
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/plot.js +49 -24
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/scale.js +2 -0
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.js +1 -2
- package/lib/runtime/transform.js.map +1 -1
- package/lib/runtime/types/mark.d.ts +3 -3
- package/lib/runtime/types/options.d.ts +2 -0
- package/lib/scale/constant.d.ts +4 -0
- package/lib/scale/constant.js +10 -0
- package/lib/scale/constant.js.map +1 -0
- package/lib/scale/index.d.ts +2 -0
- package/lib/scale/index.js +3 -1
- package/lib/scale/index.js.map +1 -1
- package/lib/shape/interval/color.js +6 -4
- package/lib/shape/interval/color.js.map +1 -1
- package/lib/spec/scale.d.ts +4 -3
- package/lib/stdlib/index.js +1 -1
- package/lib/stdlib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/composition/view.ts +1 -9
- package/src/interaction/native/tooltip.ts +13 -4
- package/src/mark/area.ts +1 -0
- package/src/mark/box.ts +1 -0
- package/src/mark/boxplot.ts +1 -3
- package/src/mark/cell.ts +1 -0
- package/src/mark/connector.ts +1 -0
- package/src/mark/forceGraph.ts +1 -1
- package/src/mark/image.ts +1 -0
- package/src/mark/interval.ts +1 -0
- package/src/mark/line.ts +1 -0
- package/src/mark/lineX.ts +1 -0
- package/src/mark/lineY.ts +1 -0
- package/src/mark/link.ts +1 -0
- package/src/mark/pack.ts +1 -1
- package/src/mark/path.ts +1 -0
- package/src/mark/point.ts +1 -0
- package/src/mark/polygon.ts +1 -0
- package/src/mark/range.ts +1 -0
- package/src/mark/rangeX.ts +1 -0
- package/src/mark/rangeY.ts +1 -0
- package/src/mark/rect.ts +1 -0
- package/src/mark/sankey.ts +1 -1
- package/src/mark/shape.ts +1 -0
- package/src/mark/text.ts +1 -0
- package/src/mark/tree.ts +1 -1
- package/src/mark/treemap.ts +1 -1
- package/src/mark/vector.ts +1 -0
- package/src/mark/wordCloud.ts +1 -1
- package/src/runtime/mark.ts +7 -3
- package/src/runtime/plot.ts +74 -33
- package/src/runtime/scale.ts +2 -0
- package/src/runtime/transform.ts +1 -2
- package/src/runtime/types/mark.ts +3 -3
- package/src/runtime/types/options.ts +2 -0
- package/src/scale/constant.ts +11 -0
- package/src/scale/index.ts +2 -0
- package/src/shape/interval/color.ts +11 -7
- package/src/spec/scale.ts +6 -1
- package/src/stdlib/index.ts +2 -0
|
@@ -10,13 +10,13 @@ export type MarkOptions = Record<string, any>;
|
|
|
10
10
|
|
|
11
11
|
export type MarkComponent<O extends MarkOptions = MarkOptions> = {
|
|
12
12
|
(options?: O): Mark;
|
|
13
|
-
props
|
|
13
|
+
props?: MarkProps;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type MarkProps = {
|
|
17
|
-
defaultShape
|
|
17
|
+
defaultShape?: string;
|
|
18
18
|
defaultLabelShape?: string;
|
|
19
|
-
channels
|
|
19
|
+
channels?: Channel[];
|
|
20
20
|
preInference?: TransformSpec[];
|
|
21
21
|
postInference?: TransformSpec[];
|
|
22
22
|
composite?: boolean;
|
|
@@ -83,6 +83,7 @@ export type G2View = {
|
|
|
83
83
|
theme?: G2ThemeOptions;
|
|
84
84
|
title?: G2TitleOptions;
|
|
85
85
|
coordinates?: G2CoordinateOptions[];
|
|
86
|
+
coordinate?: Record<string, any>;
|
|
86
87
|
component?: G2GuideComponentOptions[];
|
|
87
88
|
interaction?: Record<string, any>;
|
|
88
89
|
marks?: G2Mark[];
|
|
@@ -119,6 +120,7 @@ export type G2Mark = {
|
|
|
119
120
|
style?: Record<string, Primitive>;
|
|
120
121
|
labels?: Record<string, any>[];
|
|
121
122
|
interaction?: Record<string, any>;
|
|
123
|
+
coordinate?: Record<string, any>;
|
|
122
124
|
};
|
|
123
125
|
|
|
124
126
|
export type G2MarkChildrenCallback = (
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Constant as ConstantScale } from '@antv/scale';
|
|
2
|
+
import { ConstantScale as ConstantScaleSpec } from '../spec';
|
|
3
|
+
import { ScaleComponent as SC } from '../runtime';
|
|
4
|
+
|
|
5
|
+
export type ConstantOptions = Omit<ConstantScaleSpec, 'type'>;
|
|
6
|
+
|
|
7
|
+
export const Constant: SC<ConstantOptions> = (options) => {
|
|
8
|
+
return new ConstantScale(options);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
Constant.props = {};
|
package/src/scale/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { Quantile } from './quantile';
|
|
|
11
11
|
export { Quantize } from './quantize';
|
|
12
12
|
export { Sqrt } from './sqrt';
|
|
13
13
|
export { Sequential } from './sequential';
|
|
14
|
+
export { Constant } from './constant';
|
|
14
15
|
|
|
15
16
|
export type { BandOptions } from './band';
|
|
16
17
|
export type { LinearOptions } from './linear';
|
|
@@ -25,3 +26,4 @@ export type { QuantileOptions } from './quantile';
|
|
|
25
26
|
export type { QuantizeOptions } from './quantize';
|
|
26
27
|
export type { SqrtOptions } from './sqrt';
|
|
27
28
|
export type { SequentialOptions } from './sequential';
|
|
29
|
+
export type { ConstantOptions } from './constant';
|
|
@@ -147,13 +147,17 @@ export const Color: SC<ColorOptions> = (options) => {
|
|
|
147
147
|
insetTop,
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
-
return
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
return (
|
|
151
|
+
select(rect(points, value, coordinate, extendedStyle))
|
|
152
|
+
.call(applyStyle, defaults)
|
|
153
|
+
.style(colorAttribute, color)
|
|
154
|
+
.style(toOpacityKey(options), opacity)
|
|
155
|
+
.style('lineWidth', lineWidth)
|
|
156
|
+
.style('stroke', stroke === undefined ? color : stroke)
|
|
157
|
+
// shape.style has higher priority.
|
|
158
|
+
.call(applyStyle, rest)
|
|
159
|
+
.node()
|
|
160
|
+
);
|
|
157
161
|
};
|
|
158
162
|
};
|
|
159
163
|
|
package/src/spec/scale.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
QuantizeOptions,
|
|
13
13
|
SqrtOptions,
|
|
14
14
|
SequentialOptions,
|
|
15
|
+
ConstantOptions,
|
|
15
16
|
} from '@antv/scale';
|
|
16
17
|
import { ScaleComponent } from '../runtime';
|
|
17
18
|
import { Palette } from './palette';
|
|
@@ -30,7 +31,8 @@ export type Scale =
|
|
|
30
31
|
| QuantizeScale
|
|
31
32
|
| QuantileScale
|
|
32
33
|
| SequentialScale
|
|
33
|
-
| CustomScale
|
|
34
|
+
| CustomScale
|
|
35
|
+
| ConstantScale;
|
|
34
36
|
|
|
35
37
|
export type ScaleTypes =
|
|
36
38
|
| 'linear'
|
|
@@ -46,6 +48,7 @@ export type ScaleTypes =
|
|
|
46
48
|
| 'quantize'
|
|
47
49
|
| 'quantile'
|
|
48
50
|
| 'sequential'
|
|
51
|
+
| 'constant'
|
|
49
52
|
| ScaleComponent;
|
|
50
53
|
|
|
51
54
|
export type BaseScale<T extends ScaleTypes, O> = {
|
|
@@ -88,4 +91,6 @@ export type QuantizeScale = BaseScale<'quantize', QuantizeOptions>;
|
|
|
88
91
|
|
|
89
92
|
export type SequentialScale = BaseScale<'sequential', SequentialOptions>;
|
|
90
93
|
|
|
94
|
+
export type ConstantScale = BaseScale<'constant', ConstantOptions>;
|
|
95
|
+
|
|
91
96
|
export type CustomScale = BaseScale<ScaleComponent, { [key: string]: any }>;
|
package/src/stdlib/index.ts
CHANGED
|
@@ -76,6 +76,7 @@ import {
|
|
|
76
76
|
Quantize,
|
|
77
77
|
Sqrt,
|
|
78
78
|
Sequential,
|
|
79
|
+
Constant as ConstantScale,
|
|
79
80
|
} from '../scale';
|
|
80
81
|
import {
|
|
81
82
|
Rect as RectShape,
|
|
@@ -410,6 +411,7 @@ export function createLibrary(): G2Library {
|
|
|
410
411
|
'scale.quantile': Quantile,
|
|
411
412
|
'scale.quantize': Quantize,
|
|
412
413
|
'scale.sequential': Sequential,
|
|
414
|
+
'scale.constant': ConstantScale,
|
|
413
415
|
'shape.interval.rect': RectShape,
|
|
414
416
|
'shape.interval.hollow': HollowRect,
|
|
415
417
|
'shape.interval.funnel': Funnel,
|