@antv/g2 5.1.4 → 5.1.5
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 +436 -0
- package/dist/g2.full.min.js +1 -0
- package/dist/g2.lite.min.js +1 -0
- package/dist/g2.min.js +1 -1
- package/esm/api/chart.d.ts +2 -163
- package/esm/api/library.d.ts +1 -162
- package/esm/api/library.js +1 -2
- package/esm/api/library.js.map +1 -1
- package/esm/api/runtime.d.ts +1 -1
- package/esm/api/runtime.js +6 -1
- package/esm/api/runtime.js.map +1 -1
- package/esm/api/utils.d.ts +1 -0
- package/esm/api/utils.js +25 -6
- package/esm/api/utils.js.map +1 -1
- package/esm/composition/repeatMatrix.js +4 -1
- package/esm/composition/repeatMatrix.js.map +1 -1
- package/esm/exports.d.ts +5 -0
- package/esm/exports.js +7 -0
- package/esm/exports.js.map +1 -0
- package/esm/index.d.ts +338 -7
- package/esm/index.js +9 -8
- package/esm/index.js.map +1 -1
- package/esm/interaction/fisheye.js +3 -1
- package/esm/interaction/fisheye.js.map +1 -1
- package/esm/interaction/legendFilter.d.ts +1 -1
- package/esm/interaction/legendFilter.js +72 -31
- package/esm/interaction/legendFilter.js.map +1 -1
- package/esm/interaction/tooltip.d.ts +2 -2
- package/esm/interaction/tooltip.js +37 -21
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/lib/auto.d.ts +3 -0
- package/esm/lib/auto.js +7 -0
- package/esm/lib/auto.js.map +1 -0
- 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 +30 -29
- package/esm/mark/auto.d.ts +1 -0
- package/esm/mark/auto.js +26 -0
- package/esm/mark/auto.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/runtime/plot.js +11 -4
- package/esm/runtime/plot.js.map +1 -1
- package/esm/shape/connector/connector.js +1 -1
- package/esm/shape/connector/connector.js.map +1 -1
- package/esm/shape/index.d.ts +1 -1
- package/esm/spec/index.d.ts +3 -3
- package/esm/spec/mark.d.ts +4 -2
- package/esm/theme/academy.js +30 -358
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/classic.js +4 -433
- package/esm/theme/classic.js.map +1 -1
- package/esm/theme/classicDark.js +3 -404
- package/esm/theme/classicDark.js.map +1 -1
- package/esm/theme/create.d.ts +437 -0
- package/esm/theme/create.js +421 -0
- package/esm/theme/create.js.map +1 -0
- package/esm/theme/dark.d.ts +3 -0
- package/esm/theme/dark.js +76 -0
- package/esm/theme/dark.js.map +1 -0
- package/esm/theme/index.d.ts +1 -0
- package/esm/theme/index.js +1 -0
- package/esm/theme/index.js.map +1 -1
- package/esm/theme/light.js +52 -470
- package/esm/theme/light.js.map +1 -1
- package/esm/utils/event.d.ts +31 -32
- package/esm/utils/event.js +2 -12
- package/esm/utils/event.js.map +1 -1
- package/lib/api/chart.d.ts +2 -163
- package/lib/api/library.d.ts +1 -162
- package/lib/api/library.js +1 -2
- package/lib/api/library.js.map +1 -1
- package/lib/api/runtime.d.ts +1 -1
- package/lib/api/runtime.js +6 -1
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/utils.d.ts +1 -0
- package/lib/api/utils.js +26 -7
- package/lib/api/utils.js.map +1 -1
- package/lib/composition/repeatMatrix.js +4 -1
- package/lib/composition/repeatMatrix.js.map +1 -1
- package/lib/exports.d.ts +5 -0
- package/lib/exports.js +39 -0
- package/lib/exports.js.map +1 -0
- package/lib/index.d.ts +338 -7
- package/lib/index.js +11 -28
- package/lib/index.js.map +1 -1
- package/lib/interaction/fisheye.js +3 -1
- package/lib/interaction/fisheye.js.map +1 -1
- package/lib/interaction/legendFilter.d.ts +1 -1
- package/lib/interaction/legendFilter.js +72 -31
- package/lib/interaction/legendFilter.js.map +1 -1
- package/lib/interaction/tooltip.d.ts +2 -2
- package/lib/interaction/tooltip.js +37 -21
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/lib/auto.d.ts +3 -0
- package/lib/lib/auto.js +11 -0
- package/lib/lib/auto.js.map +1 -0
- 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 +30 -29
- package/lib/mark/auto.d.ts +1 -0
- package/lib/mark/auto.js +30 -0
- package/lib/mark/auto.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/runtime/plot.js +11 -4
- package/lib/runtime/plot.js.map +1 -1
- package/lib/shape/connector/connector.js +1 -1
- package/lib/shape/connector/connector.js.map +1 -1
- package/lib/shape/index.d.ts +1 -1
- package/lib/spec/index.d.ts +3 -3
- package/lib/spec/mark.d.ts +4 -2
- package/lib/theme/academy.js +30 -358
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/classic.js +4 -433
- package/lib/theme/classic.js.map +1 -1
- package/lib/theme/classicDark.js +3 -404
- package/lib/theme/classicDark.js.map +1 -1
- package/lib/theme/create.d.ts +437 -0
- package/lib/theme/create.js +425 -0
- package/lib/theme/create.js.map +1 -0
- package/lib/theme/dark.d.ts +3 -0
- package/lib/theme/dark.js +80 -0
- package/lib/theme/dark.js.map +1 -0
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.js +3 -1
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/light.js +52 -470
- package/lib/theme/light.js.map +1 -1
- package/lib/utils/event.d.ts +31 -32
- package/lib/utils/event.js +2 -12
- package/lib/utils/event.js.map +1 -1
- package/package.json +23 -8
- package/src/api/chart.ts +1 -1
- package/src/api/library.ts +1 -2
- package/src/api/runtime.ts +7 -2
- package/src/api/utils.ts +22 -6
- package/src/composition/repeatMatrix.ts +11 -2
- package/src/exports.ts +32 -0
- package/src/index.ts +13 -41
- package/src/interaction/fisheye.ts +3 -1
- package/src/interaction/legendFilter.ts +81 -48
- package/src/interaction/tooltip.ts +56 -33
- package/src/lib/auto.ts +7 -0
- package/src/lib/core.ts +2 -1
- package/src/lib/index.ts +1 -0
- package/src/mark/auto.ts +22 -0
- package/src/mark/index.ts +1 -0
- package/src/runtime/plot.ts +34 -7
- package/src/shape/connector/connector.ts +1 -1
- package/src/shape/index.ts +1 -1
- package/src/spec/index.ts +3 -3
- package/src/spec/mark.ts +4 -0
- package/src/theme/academy.ts +74 -399
- package/src/theme/classic.ts +11 -438
- package/src/theme/classicDark.ts +10 -409
- package/src/theme/create.ts +439 -0
- package/src/theme/dark.ts +85 -0
- package/src/theme/index.ts +1 -0
- package/src/theme/light.ts +53 -473
- package/src/utils/event.ts +32 -45
- package/dist/g2-lite.min.js +0 -1
|
@@ -2,7 +2,7 @@ import { Circle, DisplayObject, IElement, Line } from '@antv/g';
|
|
|
2
2
|
import { sort, group, mean, bisector, minIndex } from 'd3-array';
|
|
3
3
|
import { deepMix, lowerFirst, throttle } from '@antv/util';
|
|
4
4
|
import { Tooltip as TooltipComponent } from '@antv/gui';
|
|
5
|
-
import { Constant,
|
|
5
|
+
import { Constant, Band } from '@antv/scale';
|
|
6
6
|
import { defined, subObject } from '../utils/helper';
|
|
7
7
|
import { isTranspose, isPolar } from '../utils/coordinate';
|
|
8
8
|
import { angle, sub } from '../utils/vector';
|
|
@@ -200,7 +200,10 @@ function groupNameOf(scale, datum) {
|
|
|
200
200
|
);
|
|
201
201
|
};
|
|
202
202
|
// For non constant color channel.
|
|
203
|
-
if (invertAble(scaleSeries))
|
|
203
|
+
if (invertAble(scaleSeries)) {
|
|
204
|
+
const cloned = scaleSeries.clone();
|
|
205
|
+
return cloned.invert(series);
|
|
206
|
+
}
|
|
204
207
|
if (
|
|
205
208
|
series &&
|
|
206
209
|
scaleSeries instanceof Band &&
|
|
@@ -236,6 +239,7 @@ function groupItems(
|
|
|
236
239
|
scale,
|
|
237
240
|
groupName,
|
|
238
241
|
data = elements.map((d) => d['__data__']),
|
|
242
|
+
theme: Record<string, any> = {},
|
|
239
243
|
) {
|
|
240
244
|
const key = (d) => (d instanceof Date ? +d : d);
|
|
241
245
|
const T = unique(
|
|
@@ -253,10 +257,9 @@ function groupItems(
|
|
|
253
257
|
groupName !== undefined ? groupName : items.length <= 1 ? true : false;
|
|
254
258
|
|
|
255
259
|
return definedItems.map(
|
|
256
|
-
({ color = itemColorOf(element), name, ...item }) => {
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
: name || groupNameOf(scale, datum);
|
|
260
|
+
({ color = itemColorOf(element) || theme.color, name, ...item }) => {
|
|
261
|
+
const groupName = groupNameOf(scale, datum);
|
|
262
|
+
const name1 = useGroupName ? groupName || name : name || groupName;
|
|
260
263
|
return {
|
|
261
264
|
...item,
|
|
262
265
|
color,
|
|
@@ -347,30 +350,34 @@ function hideRuleY(root) {
|
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
352
|
|
|
350
|
-
|
|
351
|
-
function updateMarker(root, { data, style }) {
|
|
353
|
+
function updateMarker(root, { data, style, theme }) {
|
|
352
354
|
if (root.markers) root.markers.forEach((d) => d.remove());
|
|
353
|
-
const markers = data
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
355
|
+
const markers = data
|
|
356
|
+
.filter((d) => {
|
|
357
|
+
const [{ x, y }] = d;
|
|
358
|
+
return defined(x) && defined(y);
|
|
359
|
+
})
|
|
360
|
+
.map((d) => {
|
|
361
|
+
const [{ color, element }, point] = d;
|
|
362
|
+
const fill =
|
|
363
|
+
color || // encode value
|
|
364
|
+
element.style.fill ||
|
|
365
|
+
element.style.stroke ||
|
|
366
|
+
theme.color;
|
|
367
|
+
|
|
368
|
+
const shape = new Circle({
|
|
369
|
+
style: {
|
|
370
|
+
cx: point[0],
|
|
371
|
+
cy: point[1],
|
|
372
|
+
fill,
|
|
373
|
+
r: 4,
|
|
374
|
+
stroke: '#fff',
|
|
375
|
+
strokeWidth: 2,
|
|
376
|
+
...style,
|
|
377
|
+
},
|
|
378
|
+
});
|
|
379
|
+
return shape;
|
|
371
380
|
});
|
|
372
|
-
return shape;
|
|
373
|
-
});
|
|
374
381
|
for (const marker of markers) root.appendChild(marker);
|
|
375
382
|
root.markers = markers;
|
|
376
383
|
}
|
|
@@ -432,8 +439,10 @@ export function seriesTooltip(
|
|
|
432
439
|
enterable,
|
|
433
440
|
mount,
|
|
434
441
|
bounding,
|
|
442
|
+
theme,
|
|
435
443
|
disableNative = false,
|
|
436
444
|
marker = true,
|
|
445
|
+
preserve = false,
|
|
437
446
|
style: _style = {},
|
|
438
447
|
css = {},
|
|
439
448
|
...rest
|
|
@@ -597,6 +606,7 @@ export function seriesTooltip(
|
|
|
597
606
|
scale,
|
|
598
607
|
groupName,
|
|
599
608
|
selectedData,
|
|
609
|
+
theme,
|
|
600
610
|
);
|
|
601
611
|
|
|
602
612
|
// Sort items and filter items.
|
|
@@ -653,6 +663,7 @@ export function seriesTooltip(
|
|
|
653
663
|
updateMarker(root, {
|
|
654
664
|
data: filteredSeriesData,
|
|
655
665
|
style: markerStyles,
|
|
666
|
+
theme,
|
|
656
667
|
});
|
|
657
668
|
}
|
|
658
669
|
|
|
@@ -732,7 +743,11 @@ export function seriesTooltip(
|
|
|
732
743
|
emitter.off('tooltip:hide', onTooltipHide);
|
|
733
744
|
emitter.off('tooltip:disable', onTooltipDisable);
|
|
734
745
|
emitter.off('tooltip:enable', onTooltipEnable);
|
|
735
|
-
|
|
746
|
+
if (preserve) {
|
|
747
|
+
hideTooltip({ root, single, emitter, nativeEvent: false });
|
|
748
|
+
} else {
|
|
749
|
+
destroy();
|
|
750
|
+
}
|
|
736
751
|
};
|
|
737
752
|
}
|
|
738
753
|
|
|
@@ -760,9 +775,11 @@ export function tooltip(
|
|
|
760
775
|
view,
|
|
761
776
|
mount,
|
|
762
777
|
bounding,
|
|
778
|
+
theme,
|
|
763
779
|
shared = false,
|
|
764
780
|
body = true,
|
|
765
781
|
disableNative = false,
|
|
782
|
+
preserve = false,
|
|
766
783
|
css = {},
|
|
767
784
|
}: Record<string, any>,
|
|
768
785
|
) {
|
|
@@ -782,7 +799,7 @@ export function tooltip(
|
|
|
782
799
|
const data =
|
|
783
800
|
group.length === 1 && !shared
|
|
784
801
|
? singleItem(group[0])
|
|
785
|
-
: groupItems(group, scale, groupName);
|
|
802
|
+
: groupItems(group, scale, groupName, undefined, theme);
|
|
786
803
|
|
|
787
804
|
// Sort items and sort.
|
|
788
805
|
if (sortFunction) {
|
|
@@ -847,7 +864,6 @@ export function tooltip(
|
|
|
847
864
|
root.removeEventListener('pointermove', pointerover);
|
|
848
865
|
root.removeEventListener('pointerout', pointerout);
|
|
849
866
|
}
|
|
850
|
-
destroyTooltip({ root, single });
|
|
851
867
|
};
|
|
852
868
|
|
|
853
869
|
const onTooltipShow = ({ nativeEvent, data }) => {
|
|
@@ -888,7 +904,11 @@ export function tooltip(
|
|
|
888
904
|
removeEventListeners();
|
|
889
905
|
emitter.off('tooltip:show', onTooltipShow);
|
|
890
906
|
emitter.off('tooltip:hide', onTooltipHide);
|
|
891
|
-
|
|
907
|
+
if (preserve) {
|
|
908
|
+
hideTooltip({ root, single, emitter, nativeEvent: false });
|
|
909
|
+
} else {
|
|
910
|
+
destroyTooltip({ root, single });
|
|
911
|
+
}
|
|
892
912
|
};
|
|
893
913
|
}
|
|
894
914
|
|
|
@@ -904,7 +924,7 @@ export function Tooltip(options) {
|
|
|
904
924
|
} = options;
|
|
905
925
|
return (target, viewInstances, emitter) => {
|
|
906
926
|
const { container, view } = target;
|
|
907
|
-
const { scale, markState, coordinate } = view;
|
|
927
|
+
const { scale, markState, coordinate, theme } = view;
|
|
908
928
|
// Get default value from mark states.
|
|
909
929
|
const defaultSeries = interactionKeyof(markState, 'seriesTooltip');
|
|
910
930
|
const defaultShowCrosshairs = interactionKeyof(markState, 'crosshairs');
|
|
@@ -915,6 +935,7 @@ export function Tooltip(options) {
|
|
|
915
935
|
if (isSeries && hasSeries(markState) && !facet) {
|
|
916
936
|
return seriesTooltip(plotArea, {
|
|
917
937
|
...rest,
|
|
938
|
+
theme,
|
|
918
939
|
elements: selectG2Elements,
|
|
919
940
|
scale,
|
|
920
941
|
coordinate,
|
|
@@ -943,6 +964,7 @@ export function Tooltip(options) {
|
|
|
943
964
|
// @ts-ignore
|
|
944
965
|
return seriesTooltip(plotArea.parentNode.parentNode, {
|
|
945
966
|
...rest,
|
|
967
|
+
theme,
|
|
946
968
|
elements: () => elements,
|
|
947
969
|
scale,
|
|
948
970
|
coordinate,
|
|
@@ -964,6 +986,7 @@ export function Tooltip(options) {
|
|
|
964
986
|
item,
|
|
965
987
|
emitter,
|
|
966
988
|
view,
|
|
989
|
+
theme,
|
|
967
990
|
shared,
|
|
968
991
|
});
|
|
969
992
|
};
|
package/src/lib/auto.ts
ADDED
package/src/lib/core.ts
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
Sequential as ScaleSequential,
|
|
51
51
|
Constant as ScaleConstant,
|
|
52
52
|
} from '../scale';
|
|
53
|
-
import { Classic, ClassicDark, Academy, Light } from '../theme';
|
|
53
|
+
import { Classic, ClassicDark, Academy, Light, Dark } from '../theme';
|
|
54
54
|
import {
|
|
55
55
|
AxisX,
|
|
56
56
|
AxisY,
|
|
@@ -252,6 +252,7 @@ export function corelib() {
|
|
|
252
252
|
'theme.classicDark': ClassicDark,
|
|
253
253
|
'theme.academy': Academy,
|
|
254
254
|
'theme.light': Light,
|
|
255
|
+
'theme.dark': Dark,
|
|
255
256
|
'component.axisX': AxisX,
|
|
256
257
|
'component.axisY': AxisY,
|
|
257
258
|
'component.legendCategory': LegendCategory,
|
package/src/lib/index.ts
CHANGED
package/src/mark/auto.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Advisor } from '@antv/ava';
|
|
2
|
+
import { deepMix } from '@antv/util';
|
|
3
|
+
|
|
4
|
+
export const Auto = (options) => {
|
|
5
|
+
const chartAdvisor = new Advisor();
|
|
6
|
+
const {
|
|
7
|
+
data,
|
|
8
|
+
dataProps,
|
|
9
|
+
fields,
|
|
10
|
+
options: o,
|
|
11
|
+
colorOptions,
|
|
12
|
+
...rest
|
|
13
|
+
} = options;
|
|
14
|
+
const results = chartAdvisor.advise({
|
|
15
|
+
data,
|
|
16
|
+
dataProps,
|
|
17
|
+
fields,
|
|
18
|
+
options: o,
|
|
19
|
+
colorOptions,
|
|
20
|
+
});
|
|
21
|
+
return deepMix({}, rest, results?.[0].spec);
|
|
22
|
+
};
|
package/src/mark/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { Gauge } from './gauge';
|
|
|
32
32
|
export { Density } from './density';
|
|
33
33
|
export { Heatmap } from './heatmap';
|
|
34
34
|
export { Liquid } from './liquid';
|
|
35
|
+
export { Auto } from './auto';
|
|
35
36
|
|
|
36
37
|
export type { IntervalOptions } from './interval';
|
|
37
38
|
export type { RectOptions } from './rect';
|
package/src/runtime/plot.ts
CHANGED
|
@@ -278,7 +278,12 @@ export async function plot<T extends G2ViewTree>(
|
|
|
278
278
|
for (const typeOption of inferInteraction(options)) {
|
|
279
279
|
const [type, option] = typeOption;
|
|
280
280
|
if (option) {
|
|
281
|
-
const interaction =
|
|
281
|
+
const interaction = useThemeInteraction(
|
|
282
|
+
target.view,
|
|
283
|
+
type,
|
|
284
|
+
option as Record<string, any>,
|
|
285
|
+
useInteraction,
|
|
286
|
+
);
|
|
282
287
|
const destroy = interaction(
|
|
283
288
|
target,
|
|
284
289
|
enterViewInstances,
|
|
@@ -303,7 +308,12 @@ export async function plot<T extends G2ViewTree>(
|
|
|
303
308
|
|
|
304
309
|
// Apply new interaction.
|
|
305
310
|
if (option) {
|
|
306
|
-
const interaction =
|
|
311
|
+
const interaction = useThemeInteraction(
|
|
312
|
+
target.view,
|
|
313
|
+
type,
|
|
314
|
+
option as Record<string, any>,
|
|
315
|
+
useInteraction,
|
|
316
|
+
);
|
|
307
317
|
const destroy = interaction(
|
|
308
318
|
target,
|
|
309
319
|
updateViewInstances,
|
|
@@ -402,17 +412,20 @@ function updateTooltip(
|
|
|
402
412
|
if (!tooltipOptions[1]) return;
|
|
403
413
|
|
|
404
414
|
// Apply new tooltip interaction.
|
|
405
|
-
const applyTooltip =
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
415
|
+
const applyTooltip = useThemeInteraction(
|
|
416
|
+
view,
|
|
417
|
+
'tooltip',
|
|
418
|
+
tooltipOptions[1] as any,
|
|
419
|
+
useInteraction,
|
|
420
|
+
);
|
|
409
421
|
const target = {
|
|
410
422
|
options,
|
|
411
423
|
view,
|
|
412
424
|
container: selection.node(),
|
|
413
425
|
update: (options) => Promise.resolve(options),
|
|
414
426
|
};
|
|
415
|
-
applyTooltip(target, [], context.emitter);
|
|
427
|
+
const destroy = applyTooltip(target, [], context.emitter);
|
|
428
|
+
nameInteraction.set('tooltip', { destroy });
|
|
416
429
|
}
|
|
417
430
|
|
|
418
431
|
async function initializeView(
|
|
@@ -593,6 +606,20 @@ async function initializeMarks(
|
|
|
593
606
|
return markState;
|
|
594
607
|
}
|
|
595
608
|
|
|
609
|
+
function useThemeInteraction(
|
|
610
|
+
view: G2ViewDescriptor,
|
|
611
|
+
type: string,
|
|
612
|
+
option: Record<string, any>,
|
|
613
|
+
useInteraction: (options: G2InteractionOptions, context?: any) => Interaction,
|
|
614
|
+
): Interaction {
|
|
615
|
+
const theme = view.theme;
|
|
616
|
+
const defaults = typeof type === 'string' ? theme[type] || {} : {};
|
|
617
|
+
const interaction = useInteraction(
|
|
618
|
+
deepMix(defaults, { type, ...(option as any) }),
|
|
619
|
+
);
|
|
620
|
+
return interaction;
|
|
621
|
+
}
|
|
622
|
+
|
|
596
623
|
function initializeState(
|
|
597
624
|
markState: Map<G2Mark, G2MarkState>,
|
|
598
625
|
options: G2View,
|
package/src/shape/index.ts
CHANGED
|
@@ -66,7 +66,7 @@ export { Liquid as LiquidShape } from './liquid/liquid';
|
|
|
66
66
|
export type { RectOptions as IntervalShapeOptions } from './interval/rect';
|
|
67
67
|
export type { HollowOptions as IntervalHollowOptions } from './interval/hollow';
|
|
68
68
|
export type { FunnelOptions as IntervalFunnelOptions } from './interval/funnel';
|
|
69
|
-
export type { PyramidOptions as
|
|
69
|
+
export type { PyramidOptions as IntervalPyramidOptions } from './interval/pyramid';
|
|
70
70
|
export type { LineOptions as LineShapeOptions } from './line/line';
|
|
71
71
|
export type { SmoothOptions as LineSmoothOptions } from './line/smooth';
|
|
72
72
|
export type { HVOptions as LineHVOptions } from './line/hv';
|
package/src/spec/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AxisComponent, LegendComponent } from './component';
|
|
2
|
-
import { Composition } from './composition';
|
|
3
|
-
import { Mark } from './mark';
|
|
1
|
+
import type { AxisComponent, LegendComponent } from './component';
|
|
2
|
+
import type { Composition } from './composition';
|
|
3
|
+
import type { Mark } from './mark';
|
|
4
4
|
|
|
5
5
|
export type G2Spec = (Mark | Composition | AxisComponent | LegendComponent) & {
|
|
6
6
|
width?: number;
|
package/src/spec/mark.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AdviseParams } from '@antv/ava';
|
|
1
2
|
import { MarkComponent } from '../runtime';
|
|
2
3
|
import { Encode } from './encode';
|
|
3
4
|
import { Transform } from './transform';
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
import { Closeable, Literal2Object, Padding } from './utils';
|
|
19
20
|
|
|
20
21
|
export type Mark =
|
|
22
|
+
| AutoMark
|
|
21
23
|
| IntervalMark
|
|
22
24
|
| RectMark
|
|
23
25
|
| LineMark
|
|
@@ -51,6 +53,7 @@ export type Mark =
|
|
|
51
53
|
| CompositeMark;
|
|
52
54
|
|
|
53
55
|
export type MarkTypes =
|
|
56
|
+
| 'auto'
|
|
54
57
|
| 'interval'
|
|
55
58
|
| 'rect'
|
|
56
59
|
| 'line'
|
|
@@ -391,3 +394,4 @@ export type HeatmapMark = BaseMark<'heatmap'>;
|
|
|
391
394
|
export type LiquidMark = BaseMark<'liquid'>;
|
|
392
395
|
|
|
393
396
|
export type CustomMark = BaseMark<MarkComponent, ChannelTypes>;
|
|
397
|
+
export type AutoMark = BaseMark<'auto'> & AdviseParams;
|