@antv/g2 4.2.7 → 4.2.9
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 +1433 -0
- package/dist/g2.min.js +2 -2
- package/dist/g2.min.js.map +1 -1
- package/esm/animate/animation/index.d.ts +1 -1
- package/esm/animate/index.js.map +1 -1
- package/esm/chart/controller/axis.d.ts +1 -1
- package/esm/chart/controller/axis.js +2 -1
- package/esm/chart/controller/axis.js.map +1 -1
- package/esm/chart/controller/base.d.ts +1 -1
- package/esm/chart/layout/constraint/types.d.ts +2 -2
- package/esm/chart/layout/index.d.ts +1 -1
- package/esm/chart/layout/padding-cal.d.ts +1 -1
- package/esm/chart/view.js +3 -2
- package/esm/chart/view.js.map +1 -1
- package/esm/component/update-label.d.ts +1 -1
- package/esm/core.d.ts +1 -1
- package/esm/core.js +1 -3
- package/esm/core.js.map +1 -1
- package/esm/dependents.d.ts +1 -1
- package/esm/geometry/label/base.d.ts +1 -1
- package/esm/geometry/label/index.d.ts +1 -1
- package/esm/geometry/label/interface.d.ts +2 -2
- package/esm/geometry/shape/area/index.js.map +1 -1
- package/esm/geometry/shape/area/line.js.map +1 -1
- package/esm/geometry/shape/area/smooth-line.js.map +1 -1
- package/esm/geometry/shape/area/smooth.js.map +1 -1
- package/esm/geometry/shape/base.js.map +1 -1
- package/esm/geometry/shape/edge/arc.js.map +1 -1
- package/esm/geometry/shape/edge/index.js.map +1 -1
- package/esm/geometry/shape/edge/smooth.js.map +1 -1
- package/esm/geometry/shape/edge/vhv.js.map +1 -1
- package/esm/geometry/shape/interval/funnel.js.map +1 -1
- package/esm/geometry/shape/interval/hollow-rect.js.map +1 -1
- package/esm/geometry/shape/interval/index.js.map +1 -1
- package/esm/geometry/shape/interval/line.js.map +1 -1
- package/esm/geometry/shape/interval/pyramid.js.map +1 -1
- package/esm/geometry/shape/interval/tick.js.map +1 -1
- package/esm/geometry/shape/line/index.js.map +1 -1
- package/esm/geometry/shape/line/step.js.map +1 -1
- package/esm/geometry/shape/point/hollow.js.map +1 -1
- package/esm/geometry/shape/point/image.js.map +1 -1
- package/esm/geometry/shape/point/index.js.map +1 -1
- package/esm/geometry/shape/point/solid.js.map +1 -1
- package/esm/geometry/shape/polygon/index.js.map +1 -1
- package/esm/geometry/shape/polygon/square.js.map +1 -1
- package/esm/geometry/shape/schema/box.js.map +1 -1
- package/esm/geometry/shape/schema/candle.js.map +1 -1
- package/esm/geometry/shape/violin/hollow.js.map +1 -1
- package/esm/geometry/shape/violin/index.js.map +1 -1
- package/esm/geometry/shape/violin/smooth.js.map +1 -1
- package/esm/index.js +67 -0
- package/esm/index.js.map +1 -1
- package/esm/interaction/action/element/highlight-util.d.ts +1 -1
- package/esm/interaction/action/element/highlight.d.ts +1 -1
- package/esm/interaction/action/element/link-by-color.d.ts +1 -1
- package/esm/interaction/action/mask/circle.d.ts +5 -0
- package/esm/interaction/action/mask/circle.js +18 -16
- package/esm/interaction/action/mask/circle.js.map +1 -1
- package/esm/interaction/action/mask/dim-rect.d.ts +1 -0
- package/esm/interaction/action/mask/dim-rect.js +38 -37
- package/esm/interaction/action/mask/dim-rect.js.map +1 -1
- package/esm/interaction/action/mask/multiple/base.d.ts +125 -0
- package/esm/interaction/action/mask/multiple/base.js +286 -0
- package/esm/interaction/action/mask/multiple/base.js.map +1 -0
- package/esm/interaction/action/mask/multiple/circle.d.ts +11 -0
- package/esm/interaction/action/mask/multiple/circle.js +19 -0
- package/esm/interaction/action/mask/multiple/circle.js.map +1 -0
- package/esm/interaction/action/mask/multiple/dim-rect.d.ts +10 -0
- package/esm/interaction/action/mask/multiple/dim-rect.js +22 -0
- package/esm/interaction/action/mask/multiple/dim-rect.js.map +1 -0
- package/esm/interaction/action/mask/multiple/path.d.ts +12 -0
- package/esm/interaction/action/mask/multiple/path.js +22 -0
- package/esm/interaction/action/mask/multiple/path.js.map +1 -0
- package/esm/interaction/action/mask/multiple/rect.d.ts +16 -0
- package/esm/interaction/action/mask/multiple/rect.js +25 -0
- package/esm/interaction/action/mask/multiple/rect.js.map +1 -0
- package/esm/interaction/action/mask/multiple/smooth-path.d.ts +11 -0
- package/esm/interaction/action/mask/multiple/smooth-path.js +19 -0
- package/esm/interaction/action/mask/multiple/smooth-path.js.map +1 -0
- package/esm/interaction/action/mask/path.d.ts +9 -0
- package/esm/interaction/action/mask/path.js +27 -18
- package/esm/interaction/action/mask/path.js.map +1 -1
- package/esm/interaction/action/mask/rect.d.ts +12 -0
- package/esm/interaction/action/mask/rect.js +25 -16
- package/esm/interaction/action/mask/rect.js.map +1 -1
- package/esm/interaction/action/mask/smooth-path.d.ts +12 -0
- package/esm/interaction/action/mask/smooth-path.js +17 -3
- package/esm/interaction/action/mask/smooth-path.js.map +1 -1
- package/esm/interaction/action/register.d.ts +1 -1
- package/esm/interaction/action/util.d.ts +6 -0
- package/esm/interaction/action/util.js +112 -12
- package/esm/interaction/action/util.js.map +1 -1
- package/esm/interaction/interaction.d.ts +1 -1
- package/esm/interface.d.ts +59 -59
- package/esm/util/collision-detect.d.ts +1 -1
- package/esm/util/legend.d.ts +1 -1
- package/esm/util/text.d.ts +2 -2
- package/esm/util/types.d.ts +1 -1
- package/lib/animate/animation/index.d.ts +1 -1
- package/lib/animate/index.js.map +1 -1
- package/lib/chart/controller/axis.d.ts +1 -1
- package/lib/chart/controller/axis.js +2 -1
- package/lib/chart/controller/axis.js.map +1 -1
- package/lib/chart/controller/base.d.ts +1 -1
- package/lib/chart/layout/constraint/types.d.ts +2 -2
- package/lib/chart/layout/index.d.ts +1 -1
- package/lib/chart/layout/padding-cal.d.ts +1 -1
- package/lib/chart/view.js +3 -2
- package/lib/chart/view.js.map +1 -1
- package/lib/component/update-label.d.ts +1 -1
- package/lib/core.d.ts +1 -1
- package/lib/core.js +9 -9
- package/lib/core.js.map +1 -1
- package/lib/dependents.d.ts +1 -1
- package/lib/geometry/label/base.d.ts +1 -1
- package/lib/geometry/label/index.d.ts +1 -1
- package/lib/geometry/label/interface.d.ts +2 -2
- package/lib/geometry/shape/area/index.js.map +1 -1
- package/lib/geometry/shape/area/line.js.map +1 -1
- package/lib/geometry/shape/area/smooth-line.js.map +1 -1
- package/lib/geometry/shape/area/smooth.js.map +1 -1
- package/lib/geometry/shape/base.js.map +1 -1
- package/lib/geometry/shape/edge/arc.js.map +1 -1
- package/lib/geometry/shape/edge/index.js.map +1 -1
- package/lib/geometry/shape/edge/smooth.js.map +1 -1
- package/lib/geometry/shape/edge/vhv.js.map +1 -1
- package/lib/geometry/shape/interval/funnel.js.map +1 -1
- package/lib/geometry/shape/interval/hollow-rect.js.map +1 -1
- package/lib/geometry/shape/interval/index.js.map +1 -1
- package/lib/geometry/shape/interval/line.js.map +1 -1
- package/lib/geometry/shape/interval/pyramid.js.map +1 -1
- package/lib/geometry/shape/interval/tick.js.map +1 -1
- package/lib/geometry/shape/line/index.js.map +1 -1
- package/lib/geometry/shape/line/step.js.map +1 -1
- package/lib/geometry/shape/point/hollow.js.map +1 -1
- package/lib/geometry/shape/point/image.js.map +1 -1
- package/lib/geometry/shape/point/index.js.map +1 -1
- package/lib/geometry/shape/point/solid.js.map +1 -1
- package/lib/geometry/shape/polygon/index.js.map +1 -1
- package/lib/geometry/shape/polygon/square.js.map +1 -1
- package/lib/geometry/shape/schema/box.js.map +1 -1
- package/lib/geometry/shape/schema/candle.js.map +1 -1
- package/lib/geometry/shape/violin/hollow.js.map +1 -1
- package/lib/geometry/shape/violin/index.js.map +1 -1
- package/lib/geometry/shape/violin/smooth.js.map +1 -1
- package/lib/index.js +67 -0
- package/lib/index.js.map +1 -1
- package/lib/interaction/action/element/highlight-util.d.ts +1 -1
- package/lib/interaction/action/element/highlight.d.ts +1 -1
- package/lib/interaction/action/element/link-by-color.d.ts +1 -1
- package/lib/interaction/action/mask/circle.d.ts +5 -0
- package/lib/interaction/action/mask/circle.js +20 -16
- package/lib/interaction/action/mask/circle.js.map +1 -1
- package/lib/interaction/action/mask/dim-rect.d.ts +1 -0
- package/lib/interaction/action/mask/dim-rect.js +40 -37
- package/lib/interaction/action/mask/dim-rect.js.map +1 -1
- package/lib/interaction/action/mask/multiple/base.d.ts +125 -0
- package/lib/interaction/action/mask/multiple/base.js +288 -0
- package/lib/interaction/action/mask/multiple/base.js.map +1 -0
- package/lib/interaction/action/mask/multiple/circle.d.ts +11 -0
- package/lib/interaction/action/mask/multiple/circle.js +21 -0
- package/lib/interaction/action/mask/multiple/circle.js.map +1 -0
- package/lib/interaction/action/mask/multiple/dim-rect.d.ts +10 -0
- package/lib/interaction/action/mask/multiple/dim-rect.js +24 -0
- package/lib/interaction/action/mask/multiple/dim-rect.js.map +1 -0
- package/lib/interaction/action/mask/multiple/path.d.ts +12 -0
- package/lib/interaction/action/mask/multiple/path.js +24 -0
- package/lib/interaction/action/mask/multiple/path.js.map +1 -0
- package/lib/interaction/action/mask/multiple/rect.d.ts +16 -0
- package/lib/interaction/action/mask/multiple/rect.js +27 -0
- package/lib/interaction/action/mask/multiple/rect.js.map +1 -0
- package/lib/interaction/action/mask/multiple/smooth-path.d.ts +11 -0
- package/lib/interaction/action/mask/multiple/smooth-path.js +21 -0
- package/lib/interaction/action/mask/multiple/smooth-path.js.map +1 -0
- package/lib/interaction/action/mask/path.d.ts +9 -0
- package/lib/interaction/action/mask/path.js +30 -18
- package/lib/interaction/action/mask/path.js.map +1 -1
- package/lib/interaction/action/mask/rect.d.ts +12 -0
- package/lib/interaction/action/mask/rect.js +28 -16
- package/lib/interaction/action/mask/rect.js.map +1 -1
- package/lib/interaction/action/mask/smooth-path.d.ts +12 -0
- package/lib/interaction/action/mask/smooth-path.js +20 -3
- package/lib/interaction/action/mask/smooth-path.js.map +1 -1
- package/lib/interaction/action/register.d.ts +1 -1
- package/lib/interaction/action/util.d.ts +6 -0
- package/lib/interaction/action/util.js +115 -14
- package/lib/interaction/action/util.js.map +1 -1
- package/lib/interaction/interaction.d.ts +1 -1
- package/lib/interface.d.ts +59 -59
- package/lib/util/collision-detect.d.ts +1 -1
- package/lib/util/legend.d.ts +1 -1
- package/lib/util/text.d.ts +2 -2
- package/lib/util/types.d.ts +1 -1
- package/package.json +2 -21
- package/src/chart/controller/axis.ts +1 -1
- package/src/chart/view.ts +3 -2
- package/src/core.ts +1 -1
- package/src/index.ts +70 -0
- package/src/interaction/action/mask/circle.ts +19 -16
- package/src/interaction/action/mask/dim-rect.ts +39 -37
- package/src/interaction/action/mask/multiple/base.ts +314 -0
- package/src/interaction/action/mask/multiple/circle.ts +13 -0
- package/src/interaction/action/mask/multiple/dim-rect.ts +16 -0
- package/src/interaction/action/mask/multiple/path.ts +16 -0
- package/src/interaction/action/mask/multiple/rect.ts +19 -0
- package/src/interaction/action/mask/multiple/smooth-path.ts +13 -0
- package/src/interaction/action/mask/path.ts +28 -18
- package/src/interaction/action/mask/rect.ts +28 -17
- package/src/interaction/action/mask/smooth-path.ts +19 -3
- package/src/interaction/action/util.ts +123 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { View } from '../chart';
|
|
2
2
|
import { LooseObject } from '../interface';
|
|
3
|
-
export
|
|
3
|
+
export type InteractionConstructor = new (view: View, cfg: LooseObject) => Interaction;
|
|
4
4
|
/**
|
|
5
5
|
* 交互的基类。
|
|
6
6
|
*/
|
package/esm/interface.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export interface RangePoint {
|
|
|
42
42
|
/**
|
|
43
43
|
* WAI-ARIA 无障碍标签配置
|
|
44
44
|
*/
|
|
45
|
-
export
|
|
45
|
+
export type AriaOption = false | {
|
|
46
46
|
readonly label: string;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
@@ -281,7 +281,7 @@ export interface StyleOption {
|
|
|
281
281
|
/**
|
|
282
282
|
* @title geometry.custom() custom 自定义的配置,可以传入任何数据
|
|
283
283
|
*/
|
|
284
|
-
export
|
|
284
|
+
export type CustomOption = any;
|
|
285
285
|
/**
|
|
286
286
|
* @title `geometry.tooltip({})` Tooltip 配置定义
|
|
287
287
|
*/
|
|
@@ -457,43 +457,43 @@ export interface StateOption {
|
|
|
457
457
|
/**
|
|
458
458
|
* @title interval label 的位置
|
|
459
459
|
*/
|
|
460
|
-
export
|
|
460
|
+
export type IntervalGeometryLabelPosition = 'top' | 'bottom' | 'middle' | 'left' | 'right';
|
|
461
461
|
/**
|
|
462
462
|
* @title G2 提供的 adjust 类型
|
|
463
463
|
*/
|
|
464
|
-
export
|
|
464
|
+
export type AdjustType = 'stack' | 'jitter' | 'dodge' | 'symmetric';
|
|
465
465
|
/**
|
|
466
466
|
* @title geometry.color() 图形属性回调函数定义
|
|
467
467
|
*/
|
|
468
|
-
export
|
|
468
|
+
export type ColorAttrCallback = (...args: any[]) => string;
|
|
469
469
|
/**
|
|
470
470
|
* @title geometry.shape() 图形属性回调函数定义
|
|
471
471
|
*/
|
|
472
|
-
export
|
|
472
|
+
export type ShapeAttrCallback = (...args: any[]) => string | any[];
|
|
473
473
|
/**
|
|
474
474
|
* @title geometry.size() 图形属性回调函数定义
|
|
475
475
|
*/
|
|
476
|
-
export
|
|
476
|
+
export type SizeAttrCallback = (...args: any[]) => number;
|
|
477
477
|
/**
|
|
478
478
|
* @title geometry.tooltip() 接口回调函数定义
|
|
479
479
|
*/
|
|
480
|
-
export
|
|
480
|
+
export type TooltipCallback = (...args: any[]) => LooseObject;
|
|
481
481
|
/**
|
|
482
482
|
* @title geometry.style() 接口回调函数定义
|
|
483
483
|
*/
|
|
484
|
-
export
|
|
484
|
+
export type StyleCallback = (...args: any[]) => LooseObject;
|
|
485
485
|
/**
|
|
486
486
|
* @title geometry.label() 接口回调函数定义
|
|
487
487
|
*/
|
|
488
|
-
export
|
|
488
|
+
export type LabelCallback = (...args: any[]) => GeometryLabelCfg | null | undefined;
|
|
489
489
|
/**
|
|
490
490
|
* @title geometry label 中 content 属性的回调函数类型定义
|
|
491
491
|
*/
|
|
492
|
-
export
|
|
492
|
+
export type GeometryLabelContentCallback = (data: Datum, mappingData: MappingDatum, index: number) => string | IShape | IGroup;
|
|
493
493
|
/**
|
|
494
494
|
* @title state 下 style 回调函数定义
|
|
495
495
|
*/
|
|
496
|
-
export
|
|
496
|
+
export type StateStyleCallback = (element: Element) => LooseObject;
|
|
497
497
|
/**
|
|
498
498
|
* @title 获取 shape marker 时需要的信息
|
|
499
499
|
*/
|
|
@@ -610,7 +610,7 @@ export interface ShapePoint {
|
|
|
610
610
|
/**
|
|
611
611
|
* @title 小提琴图 shape 关键点信息
|
|
612
612
|
*/
|
|
613
|
-
export
|
|
613
|
+
export type ViolinShapePoint = ShapePoint & {
|
|
614
614
|
_size?: number[];
|
|
615
615
|
};
|
|
616
616
|
/**
|
|
@@ -704,15 +704,15 @@ export interface ShapeFactory extends RegisterShapeFactory {
|
|
|
704
704
|
/**
|
|
705
705
|
* @title 自定义 Shape marker 的函数
|
|
706
706
|
*/
|
|
707
|
-
export
|
|
707
|
+
export type ShapeMarkerSymbol = (x: number, y: number, r: number) => PathCommand[];
|
|
708
708
|
/**
|
|
709
709
|
* @title Annotation position 回调函数
|
|
710
710
|
*/
|
|
711
|
-
export
|
|
711
|
+
export type AnnotationPositionCallback = (xScales: Scale[] | Record<string, Scale>, yScales: Scale[] | Record<string, Scale>) => [number | string, number | string];
|
|
712
712
|
/**
|
|
713
713
|
* @title Annotation 位置相关属性的类型定义
|
|
714
714
|
*/
|
|
715
|
-
export
|
|
715
|
+
export type AnnotationPosition = [number | string, number | string] | Record<string, number | string> | AnnotationPositionCallback;
|
|
716
716
|
/**
|
|
717
717
|
* @title Annotation 定义的通用属性,chart.annotation().line({})
|
|
718
718
|
*/
|
|
@@ -791,11 +791,11 @@ export interface LineOption extends RegionPositionBaseOption {
|
|
|
791
791
|
/**
|
|
792
792
|
* @title 使用 Arc Annotation 组件的配置定义
|
|
793
793
|
*/
|
|
794
|
-
export
|
|
794
|
+
export type ArcOption = RegionPositionBaseOption;
|
|
795
795
|
/**
|
|
796
796
|
* @title 使用 Region Annotation 组件的配置定义
|
|
797
797
|
*/
|
|
798
|
-
export
|
|
798
|
+
export type RegionOption = RegionPositionBaseOption;
|
|
799
799
|
/**
|
|
800
800
|
* @title 使用 Text Annotation 组件的配置定义
|
|
801
801
|
*/
|
|
@@ -1191,7 +1191,7 @@ export interface ChartCfg extends Omit<ViewCfg, 'parent' | 'canvas' | 'foregroun
|
|
|
1191
1191
|
*/
|
|
1192
1192
|
readonly defaultInteractions?: string[];
|
|
1193
1193
|
}
|
|
1194
|
-
export
|
|
1194
|
+
export type SyncViewPaddingFn = (chart: View, views: View[], PC: PaddingCalCtor) => void;
|
|
1195
1195
|
/**
|
|
1196
1196
|
* @title View 构造参数
|
|
1197
1197
|
*/
|
|
@@ -1624,7 +1624,7 @@ export interface TooltipCrosshairsText extends CrosshairTextCfg {
|
|
|
1624
1624
|
* @param currentPoint 对应当前坐标点
|
|
1625
1625
|
* @returns 返回当前 crosshairs 对应的辅助线文本配置
|
|
1626
1626
|
*/
|
|
1627
|
-
export
|
|
1627
|
+
export type TooltipCrosshairsTextCallback = (type: string, defaultContent: any, items: any[], currentPoint: Point) => TooltipCrosshairsText;
|
|
1628
1628
|
/**
|
|
1629
1629
|
* @title Tooltip crosshairs 配置结构
|
|
1630
1630
|
*/
|
|
@@ -1682,8 +1682,8 @@ export interface TooltipCrosshairs {
|
|
|
1682
1682
|
*/
|
|
1683
1683
|
follow?: boolean;
|
|
1684
1684
|
}
|
|
1685
|
-
export
|
|
1686
|
-
export
|
|
1685
|
+
export type TooltipTitle = string | ((title: string, datum: Datum) => string);
|
|
1686
|
+
export type TooltipItem = {
|
|
1687
1687
|
/**
|
|
1688
1688
|
* @title 原始数据
|
|
1689
1689
|
*/
|
|
@@ -2086,13 +2086,13 @@ export interface SliderCfg {
|
|
|
2086
2086
|
/**
|
|
2087
2087
|
* 事件 payload
|
|
2088
2088
|
*/
|
|
2089
|
-
export
|
|
2089
|
+
export type EventPayload = LooseObject & {
|
|
2090
2090
|
/**
|
|
2091
2091
|
* @title 触发事件的来源
|
|
2092
2092
|
*/
|
|
2093
2093
|
source?: string;
|
|
2094
2094
|
};
|
|
2095
|
-
export
|
|
2095
|
+
export type EventCallback = (event: LooseObject) => void;
|
|
2096
2096
|
/**
|
|
2097
2097
|
* todo: 事件名可穷举,后续需要补充
|
|
2098
2098
|
* 事件配置项
|
|
@@ -2103,7 +2103,7 @@ export interface EventCfg {
|
|
|
2103
2103
|
/**
|
|
2104
2104
|
* 缩略轴的配置项
|
|
2105
2105
|
*/
|
|
2106
|
-
export
|
|
2106
|
+
export type SliderOption = SliderCfg | boolean;
|
|
2107
2107
|
/**
|
|
2108
2108
|
* @title 滚动条组件配置项
|
|
2109
2109
|
*/
|
|
@@ -2157,7 +2157,7 @@ export interface ScrollbarCfg {
|
|
|
2157
2157
|
/**
|
|
2158
2158
|
* @title 滚动条配置
|
|
2159
2159
|
*/
|
|
2160
|
-
export
|
|
2160
|
+
export type ScrollbarOption = ScrollbarCfg | boolean;
|
|
2161
2161
|
/**
|
|
2162
2162
|
* @title 配置项声明式
|
|
2163
2163
|
*/
|
|
@@ -2234,47 +2234,47 @@ export interface Options {
|
|
|
2234
2234
|
/**
|
|
2235
2235
|
* @title 支持的 Marker 类型
|
|
2236
2236
|
*/
|
|
2237
|
-
export
|
|
2237
|
+
export type Marker = 'circle' | 'square' | 'diamond' | 'triangle' | 'triangle-down' | 'hexagon' | 'bowtie' | 'cross' | 'tick' | 'plus' | 'hyphen' | 'line';
|
|
2238
2238
|
/**
|
|
2239
2239
|
* @title 自定义 Marker 的回调函数定义
|
|
2240
2240
|
*/
|
|
2241
|
-
export
|
|
2241
|
+
export type MarkerCallback = (x: number, y: number, r: number) => PathCommand[];
|
|
2242
2242
|
/**
|
|
2243
2243
|
* @title chart.tooltip() 参数类型
|
|
2244
2244
|
*/
|
|
2245
|
-
export
|
|
2246
|
-
export
|
|
2245
|
+
export type TooltipOption = TooltipCfg | boolean;
|
|
2246
|
+
export type FilterCondition = (value: any, datum: Datum, idx?: number) => boolean;
|
|
2247
2247
|
/**
|
|
2248
2248
|
* @title chart.axis() 参数类型
|
|
2249
2249
|
*/
|
|
2250
|
-
export
|
|
2250
|
+
export type AxisOption = AxisCfg | boolean;
|
|
2251
2251
|
/**
|
|
2252
2252
|
* @title chart.legend() 参数类型
|
|
2253
2253
|
*/
|
|
2254
|
-
export
|
|
2254
|
+
export type LegendOption = LegendCfg | boolean;
|
|
2255
2255
|
/**
|
|
2256
2256
|
* @title Options 中 legends 的配置定义
|
|
2257
2257
|
*/
|
|
2258
|
-
export
|
|
2258
|
+
export type AllLegendsOptions = LegendCfg | Record<string, LegendOption> | boolean;
|
|
2259
2259
|
/**
|
|
2260
2260
|
* @title G2 支持的度量类型
|
|
2261
2261
|
*/
|
|
2262
|
-
export
|
|
2263
|
-
export
|
|
2264
|
-
export
|
|
2265
|
-
export
|
|
2266
|
-
export
|
|
2262
|
+
export type ScaleType = 'linear' | 'cat' | 'category' | 'identity' | 'log' | 'pow' | 'time' | 'timeCat' | 'quantize' | 'quantile';
|
|
2263
|
+
export type CoordinateRotate = ['rotate', number];
|
|
2264
|
+
export type CoordinateReflect = ['reflect', 'x' | 'y'];
|
|
2265
|
+
export type CoordinateScale = ['scale', number, number];
|
|
2266
|
+
export type CoordinateTranspose = ['transpose'];
|
|
2267
2267
|
/**
|
|
2268
2268
|
* @title 坐标系支持的 action 配置
|
|
2269
2269
|
*/
|
|
2270
|
-
export
|
|
2271
|
-
export
|
|
2270
|
+
export type CoordinateActions = CoordinateRotate | CoordinateReflect | CoordinateScale | CoordinateTranspose;
|
|
2271
|
+
export type FacetCtor = new (view: View, cfg: any) => Facet;
|
|
2272
2272
|
export interface Condition {
|
|
2273
2273
|
readonly field: string;
|
|
2274
2274
|
readonly value: any;
|
|
2275
2275
|
readonly values: any[];
|
|
2276
2276
|
}
|
|
2277
|
-
export
|
|
2277
|
+
export type FacetDataFilter = (data: Datum[]) => boolean;
|
|
2278
2278
|
/**
|
|
2279
2279
|
* 默认的基础配置
|
|
2280
2280
|
*/
|
|
@@ -2395,7 +2395,7 @@ export interface RectCfg extends FacetCfg<RectData> {
|
|
|
2395
2395
|
*/
|
|
2396
2396
|
readonly rowTitle?: FacetTitle;
|
|
2397
2397
|
}
|
|
2398
|
-
export
|
|
2398
|
+
export type RectData = FacetData;
|
|
2399
2399
|
/**
|
|
2400
2400
|
* @title mirror 分面类型配置
|
|
2401
2401
|
*/
|
|
@@ -2409,7 +2409,7 @@ export interface MirrorCfg extends FacetCfg<MirrorData> {
|
|
|
2409
2409
|
*/
|
|
2410
2410
|
readonly title?: FacetTitle;
|
|
2411
2411
|
}
|
|
2412
|
-
export
|
|
2412
|
+
export type MirrorData = FacetData;
|
|
2413
2413
|
/**
|
|
2414
2414
|
* @title list 分面类型配置
|
|
2415
2415
|
*/
|
|
@@ -2439,7 +2439,7 @@ export interface MatrixCfg extends FacetCfg<MirrorData> {
|
|
|
2439
2439
|
*/
|
|
2440
2440
|
readonly rowTitle?: FacetTitle;
|
|
2441
2441
|
}
|
|
2442
|
-
export
|
|
2442
|
+
export type MatrixData = FacetData;
|
|
2443
2443
|
/**
|
|
2444
2444
|
* @title circle 分面类型配置
|
|
2445
2445
|
*/
|
|
@@ -2449,7 +2449,7 @@ export interface CircleCfg extends FacetCfg<CircleData> {
|
|
|
2449
2449
|
*/
|
|
2450
2450
|
readonly title?: FacetTitle;
|
|
2451
2451
|
}
|
|
2452
|
-
export
|
|
2452
|
+
export type CircleData = FacetData;
|
|
2453
2453
|
export interface Line {
|
|
2454
2454
|
readonly style?: ShapeAttrs;
|
|
2455
2455
|
readonly smooth?: boolean;
|
|
@@ -3568,7 +3568,7 @@ export interface StyleSheet {
|
|
|
3568
3568
|
/**
|
|
3569
3569
|
* @title createTheme 主题样式表配置
|
|
3570
3570
|
*/
|
|
3571
|
-
export
|
|
3571
|
+
export type StyleSheetCfg = Partial<StyleSheet>;
|
|
3572
3572
|
/**
|
|
3573
3573
|
* @title 交互反馈的定义
|
|
3574
3574
|
*/
|
|
@@ -3659,28 +3659,28 @@ export interface IInteractionContext extends LooseObject {
|
|
|
3659
3659
|
/**
|
|
3660
3660
|
* @title G 的渲染类型
|
|
3661
3661
|
*/
|
|
3662
|
-
export
|
|
3662
|
+
export type Renderer = 'svg' | 'canvas';
|
|
3663
3663
|
/**
|
|
3664
3664
|
* @title 数据的定义
|
|
3665
3665
|
*/
|
|
3666
|
-
export
|
|
3667
|
-
export
|
|
3668
|
-
export
|
|
3669
|
-
export
|
|
3670
|
-
export
|
|
3671
|
-
export
|
|
3672
|
-
export
|
|
3673
|
-
export
|
|
3674
|
-
export
|
|
3666
|
+
export type Datum = Record<string, any>;
|
|
3667
|
+
export type Data = Datum[];
|
|
3668
|
+
export type ActionCallback = (context: IInteractionContext) => void;
|
|
3669
|
+
export type Padding = [number, number, number, number];
|
|
3670
|
+
export type ViewPadding = number | number[] | 'auto';
|
|
3671
|
+
export type ViewAppendPadding = number | number[];
|
|
3672
|
+
export type Position = [number, number];
|
|
3673
|
+
export type AttributeType = 'position' | 'size' | 'color' | 'shape';
|
|
3674
|
+
export type ShapeVertices = RangePoint[] | Point[] | Point[][];
|
|
3675
3675
|
/**
|
|
3676
3676
|
* @title easing 的回调函数, 入参 data 为对应的原始数据记录
|
|
3677
3677
|
*/
|
|
3678
|
-
export
|
|
3678
|
+
export type AnimateEasingCallback = (data: Datum) => string;
|
|
3679
3679
|
/**
|
|
3680
3680
|
* @title delay 的回调函数, 入参 data 为对应的原始数据记录
|
|
3681
3681
|
*/
|
|
3682
|
-
export
|
|
3682
|
+
export type AnimateDelayCallback = (data: Datum) => number;
|
|
3683
3683
|
/**
|
|
3684
3684
|
* @title duration 的回调函数, 入参 data 为对应的原始数据记录
|
|
3685
3685
|
*/
|
|
3686
|
-
export
|
|
3686
|
+
export type AnimateDurationCallback = (data: Datum) => number;
|
package/esm/util/legend.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { LegendCfg, LegendItem } from '../interface';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function getLegendLayout(direction: DIRECTION): 'vertical' | 'horizontal';
|
|
13
13
|
/** item of @antv/component legend */
|
|
14
|
-
|
|
14
|
+
type ComponentLegendItem = Omit<LegendItem, 'marker'> & {
|
|
15
15
|
marker: any;
|
|
16
16
|
};
|
|
17
17
|
/**
|
package/esm/util/text.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as CSS from 'csstype';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type FontFace = CSS.Properties;
|
|
3
|
+
type Font = Pick<FontFace, 'fontFamily' | 'fontWeight' | 'fontStyle' | 'fontVariant'> & {
|
|
4
4
|
fontSize?: number;
|
|
5
5
|
};
|
|
6
6
|
/**
|
package/esm/util/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IGroup, IShape } from '../../dependents';
|
|
2
2
|
import { GAnimateCfg } from '../../interface';
|
|
3
3
|
import { AnimateExtraCfg } from '../interface';
|
|
4
|
-
|
|
4
|
+
type Animation = (element: IGroup | IShape, animateCfg: GAnimateCfg, cfg: AnimateExtraCfg) => void;
|
|
5
5
|
/**
|
|
6
6
|
* 根据名称获取对应的动画执行函数
|
|
7
7
|
* @param type 动画函数名称
|
package/lib/animate/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animate/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAsD;AACtD,wCAA2C;AAK3C,yCAA2C;AAE3C,YAAY;AACC,QAAA,mBAAmB,GAAG;IACjC,MAAM,EAAE;QACN,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,aAAa;KACtB;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,eAAe;KACxB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,eAAe;KACxB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,YAAY;KACrB,EAAE,YAAY;CAChB,CAAC;AAEF,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S,EAAE,GAAG,EAAE;gBACxB,UAAU,YAAA;gBACV,SAAS,WAAA;gBACT,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AAxBD,oDAwBC","sourcesContent":["import { deepMix, get, isFunction } from '@antv/util';\nimport { FIELD_ORIGIN } from '../constant';\nimport { Coordinate, IGroup, IShape } from '../dependents';\nimport { AnimateCfg, Data, Datum, GAnimateCfg, Point } from '../interface';\nimport { AnimateExtraCfg } from './interface';\n\nimport { getAnimation } from './animation';\n\n// 默认的动画参数配置\nexport const DEFAULT_ANIMATE_CFG = {\n appear: {\n duration: 450,\n easing: 'easeQuadOut',\n }, // 初始入场动画配置\n update: {\n duration: 400,\n easing: 'easeQuadInOut',\n }, // 更新时发生变更的动画配置\n enter: {\n duration: 400,\n easing: 'easeQuadInOut',\n }, // 更新时新增元素的入场动画配置\n leave: {\n duration: 350,\n easing: 'easeQuadIn',\n }, // 更新时销毁动画配置\n};\n\n// 各个 Geometry 默认的动画执行函数\nconst GEOMETRY_ANIMATE_CFG = {\n interval: (coordinate: Coordinate) => {\n return {\n enter: {\n animation: coordinate.isRect ? (coordinate.isTransposed ? 'scale-in-x' : 'scale-in-y') : 'fade-in',\n },\n update: {\n animation: coordinate.isPolar && coordinate.isTransposed ? 'sector-path-update' : null,\n },\n leave: {\n animation: 'fade-out',\n },\n };\n },\n line: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n path: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n point: {\n appear: {\n animation: 'zoom-in',\n },\n enter: {\n animation: 'zoom-in',\n },\n leave: {\n animation: 'zoom-out',\n },\n },\n area: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n polygon: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n schema: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n edge: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n label: {\n appear: {\n animation: 'fade-in',\n delay: 450,\n },\n enter: {\n animation: 'fade-in',\n },\n update: {\n animation: 'position-update',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n};\n\n// 各个 Geometry 默认的群组出场动画\nconst GEOMETRY_GROUP_APPEAR_ANIMATION = {\n line: () => {\n return {\n animation: 'wave-in',\n };\n },\n area: () => {\n return {\n animation: 'wave-in',\n };\n },\n path: () => {\n return {\n animation: 'fade-in',\n };\n },\n interval(coordinate: Coordinate) {\n let animation;\n\n if (coordinate.isRect) {\n animation = coordinate.isTransposed ? 'grow-in-x' : 'grow-in-y';\n } else {\n animation = 'grow-in-xy';\n if (coordinate.isPolar && coordinate.isTransposed) {\n // pie chart\n animation = 'wave-in';\n }\n }\n return {\n animation,\n };\n },\n schema: (coordinate) => {\n let animation;\n if (coordinate.isRect) {\n animation = coordinate.isTransposed ? 'grow-in-x' : 'grow-in-y';\n } else {\n animation = 'grow-in-xy';\n }\n return {\n animation,\n };\n },\n polygon: () => {\n return {\n animation: 'fade-in',\n duration: 500,\n };\n },\n edge: () => {\n return {\n animation: 'fade-in',\n };\n },\n};\n\n// 解析用户的动画配置\nfunction parseAnimateConfig(animateCfg: AnimateCfg, data: Data | Datum): GAnimateCfg {\n return {\n delay: isFunction(animateCfg.delay) ? animateCfg.delay(data) : animateCfg.delay,\n easing: isFunction(animateCfg.easing) ? animateCfg.easing(data) : animateCfg.easing,\n duration: isFunction(animateCfg.duration) ? animateCfg.duration(data) : animateCfg.duration,\n callback: animateCfg.callback,\n repeat: animateCfg.repeat,\n };\n}\n\n/**\n * @ignore\n * 获取 elementName 对应的动画配置,当声明了 `animateType`,则返回 `animateType` 对应的动画配置\n * @param elementName 元素名称\n * @param coordinate 做表弟类型\n * @param animateType 可选,动画类型\n */\nexport function getDefaultAnimateCfg(elementName: string, coordinate: Coordinate, animateType?: string) {\n let animateCfg = GEOMETRY_ANIMATE_CFG[elementName];\n\n if (animateCfg) {\n if (isFunction(animateCfg)) {\n animateCfg = animateCfg(coordinate);\n }\n animateCfg = deepMix({}, DEFAULT_ANIMATE_CFG, animateCfg);\n\n if (animateType) {\n return animateCfg[animateType];\n }\n }\n return animateCfg;\n}\n\n/**\n * @ignore\n * 工具函数\n * 根据用户传入的配置为 shape 执行动画\n * @param shape 执行动画的图形元素\n * @param animateCfg 动画配置\n * @param cfg 额外的信息\n */\nexport function doAnimate(shape: IGroup | IShape, animateCfg: AnimateCfg, cfg: AnimateExtraCfg) {\n const data = get(shape.get('origin'), 'data', FIELD_ORIGIN);\n const animation = animateCfg.animation; // 获取动画执行函数\n const parsedAnimateCfg = parseAnimateConfig(animateCfg, data);\n if (animation) {\n // 用户声明了动画执行函数\n const animateFunction = getAnimation(animation);\n if (animateFunction) {\n animateFunction(shape, parsedAnimateCfg, cfg);\n }\n } else {\n // 没有声明,则根据 toAttrs 做差值动画\n shape.animate(cfg.toAttrs, parsedAnimateCfg);\n }\n}\n\n/**\n * @ignore\n * 执行 Geometry 群组入场动画\n * @param container 执行群组动画的图形元素\n * @param animateCfg 动画配置\n * @param geometryType geometry 类型\n * @param coordinate 坐标系对象\n * @param minYPoint y 轴最小值对应的画布坐标点\n */\nexport function doGroupAppearAnimate(\n container: IGroup,\n animateCfg: AnimateCfg,\n geometryType: string,\n coordinate: Coordinate,\n minYPoint: Point\n) {\n if (GEOMETRY_GROUP_APPEAR_ANIMATION[geometryType]) {\n const defaultCfg = GEOMETRY_GROUP_APPEAR_ANIMATION[geometryType](coordinate);\n const animation = getAnimation(get(defaultCfg, 'animation', ''));\n if (animation) {\n const cfg = {\n ...DEFAULT_ANIMATE_CFG.appear,\n ...defaultCfg,\n ...animateCfg,\n };\n container.stopAnimate(); // 先结束当前 container 动画\n animation(container, cfg, {\n coordinate,\n minYPoint,\n toAttrs: null,\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sour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EACpB,UAAsB,EACtB,SAAgB;IAEhB,IAAI,+BAA+B,CAAC,YAAY,CAAC,EAAE;QACjD,IAAM,UAAU,GAAG,+BAA+B,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAM,SAAS,GAAG,IAAA,wBAAY,EAAC,IAAA,UAAG,EAAC,UAAU,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,SAAS,EAAE;YACb,IAAM,GAAG,0DACJ,2BAAmB,CAAC,MAAM,GAC1B,UAAU,GACV,UAAU,CACd,CAAC;YACF,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,qBAAqB;YAC9C,SAAS,CAAC,SAAS,EAAE,GAAG,EAAE;gBACxB,UAAU,YAAA;gBACV,SAAS,WAAA;gBACT,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AAxBD,oDAwBC","sourcesContent":["import { deepMix, get, isFunction } from '@antv/util';\nimport { FIELD_ORIGIN } from '../constant';\nimport { Coordinate, IGroup, IShape } from '../dependents';\nimport { AnimateCfg, Data, Datum, GAnimateCfg, Point } from '../interface';\nimport { AnimateExtraCfg } from './interface';\n\nimport { getAnimation } from './animation';\n\n// 默认的动画参数配置\nexport const DEFAULT_ANIMATE_CFG = {\n appear: {\n duration: 450,\n easing: 'easeQuadOut',\n }, // 初始入场动画配置\n update: {\n duration: 400,\n easing: 'easeQuadInOut',\n }, // 更新时发生变更的动画配置\n enter: {\n duration: 400,\n easing: 'easeQuadInOut',\n }, // 更新时新增元素的入场动画配置\n leave: {\n duration: 350,\n easing: 'easeQuadIn',\n }, // 更新时销毁动画配置\n};\n\n// 各个 Geometry 默认的动画执行函数\nconst GEOMETRY_ANIMATE_CFG = {\n interval: (coordinate: Coordinate) => {\n return {\n enter: {\n animation: coordinate.isRect ? (coordinate.isTransposed ? 'scale-in-x' : 'scale-in-y') : 'fade-in',\n },\n update: {\n animation: coordinate.isPolar && coordinate.isTransposed ? 'sector-path-update' : null,\n },\n leave: {\n animation: 'fade-out',\n },\n };\n },\n line: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n path: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n point: {\n appear: {\n animation: 'zoom-in',\n },\n enter: {\n animation: 'zoom-in',\n },\n leave: {\n animation: 'zoom-out',\n },\n },\n area: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n polygon: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n schema: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n edge: {\n enter: {\n animation: 'fade-in',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n label: {\n appear: {\n animation: 'fade-in',\n delay: 450,\n },\n enter: {\n animation: 'fade-in',\n },\n update: {\n animation: 'position-update',\n },\n leave: {\n animation: 'fade-out',\n },\n },\n};\n\n// 各个 Geometry 默认的群组出场动画\nconst GEOMETRY_GROUP_APPEAR_ANIMATION = {\n line: () => {\n return {\n animation: 'wave-in',\n };\n },\n area: () => {\n return {\n animation: 'wave-in',\n };\n },\n path: () => {\n return {\n animation: 'fade-in',\n };\n },\n interval(coordinate: Coordinate) {\n let animation;\n\n if (coordinate.isRect) {\n animation = coordinate.isTransposed ? 'grow-in-x' : 'grow-in-y';\n } else {\n animation = 'grow-in-xy';\n if (coordinate.isPolar && coordinate.isTransposed) {\n // pie chart\n animation = 'wave-in';\n }\n }\n return {\n animation,\n };\n },\n schema: (coordinate) => {\n let animation;\n if (coordinate.isRect) {\n animation = coordinate.isTransposed ? 'grow-in-x' : 'grow-in-y';\n } else {\n animation = 'grow-in-xy';\n }\n return {\n animation,\n };\n },\n polygon: () => {\n return {\n animation: 'fade-in',\n duration: 500,\n };\n },\n edge: () => {\n return {\n animation: 'fade-in',\n };\n },\n};\n\n// 解析用户的动画配置\nfunction parseAnimateConfig(animateCfg: AnimateCfg, data: Data | Datum): GAnimateCfg {\n return {\n delay: isFunction(animateCfg.delay) ? animateCfg.delay(data) : animateCfg.delay,\n easing: isFunction(animateCfg.easing) ? animateCfg.easing(data) : animateCfg.easing,\n duration: isFunction(animateCfg.duration) ? animateCfg.duration(data) : animateCfg.duration,\n callback: animateCfg.callback,\n repeat: animateCfg.repeat,\n };\n}\n\n/**\n * @ignore\n * 获取 elementName 对应的动画配置,当声明了 `animateType`,则返回 `animateType` 对应的动画配置\n * @param elementName 元素名称\n * @param coordinate 做表弟类型\n * @param animateType 可选,动画类型\n */\nexport function getDefaultAnimateCfg(elementName: string, coordinate: Coordinate, animateType?: string) {\n let animateCfg = GEOMETRY_ANIMATE_CFG[elementName];\n\n if (animateCfg) {\n if (isFunction(animateCfg)) {\n animateCfg = animateCfg(coordinate);\n }\n animateCfg = deepMix({}, DEFAULT_ANIMATE_CFG, animateCfg);\n\n if (animateType) {\n return animateCfg[animateType];\n }\n }\n return animateCfg;\n}\n\n/**\n * @ignore\n * 工具函数\n * 根据用户传入的配置为 shape 执行动画\n * @param shape 执行动画的图形元素\n * @param animateCfg 动画配置\n * @param cfg 额外的信息\n */\nexport function doAnimate(shape: IGroup | IShape, animateCfg: AnimateCfg, cfg: AnimateExtraCfg) {\n const data = get(shape.get('origin'), 'data', FIELD_ORIGIN);\n const animation = animateCfg.animation; // 获取动画执行函数\n const parsedAnimateCfg = parseAnimateConfig(animateCfg, data);\n if (animation) {\n // 用户声明了动画执行函数\n const animateFunction = getAnimation(animation);\n if (animateFunction) {\n animateFunction(shape, parsedAnimateCfg, cfg);\n }\n } else {\n // 没有声明,则根据 toAttrs 做差值动画\n shape.animate(cfg.toAttrs, parsedAnimateCfg);\n }\n}\n\n/**\n * @ignore\n * 执行 Geometry 群组入场动画\n * @param container 执行群组动画的图形元素\n * @param animateCfg 动画配置\n * @param geometryType geometry 类型\n * @param coordinate 坐标系对象\n * @param minYPoint y 轴最小值对应的画布坐标点\n */\nexport function doGroupAppearAnimate(\n container: IGroup,\n animateCfg: AnimateCfg,\n geometryType: string,\n coordinate: Coordinate,\n minYPoint: Point\n) {\n if (GEOMETRY_GROUP_APPEAR_ANIMATION[geometryType]) {\n const defaultCfg = GEOMETRY_GROUP_APPEAR_ANIMATION[geometryType](coordinate);\n const animation = getAnimation(get(defaultCfg, 'animation', ''));\n if (animation) {\n const cfg = {\n ...DEFAULT_ANIMATE_CFG.appear,\n ...defaultCfg,\n ...animateCfg,\n };\n container.stopAnimate(); // 先结束当前 container 动画\n animation(container, cfg, {\n coordinate,\n minYPoint,\n toAttrs: null,\n });\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxisOption, ComponentOption } from '../../interface';
|
|
2
2
|
import View from '../view';
|
|
3
3
|
import { Controller } from './base';
|
|
4
|
-
|
|
4
|
+
type Option = Record<string, AxisOption> | boolean;
|
|
5
5
|
/**
|
|
6
6
|
* @ignore
|
|
7
7
|
* G2 Axis controller, will:
|
|
@@ -524,7 +524,8 @@ var Axis = /** @class */ (function (_super) {
|
|
|
524
524
|
var ticks = scale.getTicks().map(function (tick) { return ({ id: "".concat(tick.tickValue), name: tick.text, value: tick.value }); });
|
|
525
525
|
if (!scale.isCategory && Math.abs(coordinate.endAngle - coordinate.startAngle) === Math.PI * 2) {
|
|
526
526
|
// x 轴对应的值如果是非 cat 类型,在整圆的情况下坐标轴第一个和最后一个文本会重叠,默认只展示第一个文本
|
|
527
|
-
ticks.
|
|
527
|
+
if (ticks.length)
|
|
528
|
+
ticks[ticks.length - 1].name = '';
|
|
528
529
|
}
|
|
529
530
|
var titleText = (0, axis_1.getAxisTitleText)(scale, axisOption);
|
|
530
531
|
var axisThemeCfg = (0, axis_1.getAxisThemeCfg)(this.view.getTheme(), constant_1.DIRECTION.CIRCLE);
|