@visactor/vchart-types 1.15.5-alpha.8 → 2.0.0-alpha.0

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.
Files changed (197) hide show
  1. package/package.json +3 -3
  2. package/tsconfig.tsbuildinfo +1 -1
  3. package/types/animation/animate-manager.d.ts +2 -4
  4. package/types/animation/interface.d.ts +86 -2
  5. package/types/animation/spec.d.ts +27 -3
  6. package/types/animation/utils.d.ts +3 -4
  7. package/types/chart/base/base-chart.d.ts +10 -7
  8. package/types/chart/funnel/util.d.ts +2 -0
  9. package/types/chart/interface/chart.d.ts +3 -4
  10. package/types/chart/interface/common.d.ts +2 -9
  11. package/types/chart/sankey/sankey.d.ts +1 -1
  12. package/types/compile/compilable-base.d.ts +1 -1
  13. package/types/compile/compiler.d.ts +35 -25
  14. package/types/compile/data/compilable-data.d.ts +7 -7
  15. package/types/compile/data/interface.d.ts +4 -1
  16. package/types/compile/grammar-item.d.ts +7 -13
  17. package/types/compile/interface/compilable-item.d.ts +22 -28
  18. package/types/compile/interface/compiler.d.ts +13 -4
  19. package/types/compile/mark/index.d.ts +0 -1
  20. package/types/compile/mark/interface.d.ts +42 -33
  21. package/types/compile/mark/mark-state-manager.d.ts +11 -13
  22. package/types/compile/mark/util.d.ts +1 -1
  23. package/types/compile/state-manager.d.ts +11 -0
  24. package/types/compile/util.d.ts +14 -0
  25. package/types/component/axis/base-axis.d.ts +5 -3
  26. package/types/component/axis/cartesian/axis.d.ts +1 -1
  27. package/types/component/axis/cartesian/time-axis.d.ts +1 -0
  28. package/types/component/axis/interface/common.d.ts +8 -0
  29. package/types/component/base/base-component.d.ts +1 -2
  30. package/types/component/brush/brush.d.ts +12 -10
  31. package/types/component/crosshair/base.d.ts +25 -36
  32. package/types/component/crosshair/cartesian.d.ts +5 -28
  33. package/types/component/crosshair/interface/common.d.ts +67 -2
  34. package/types/component/crosshair/interface/index.d.ts +0 -2
  35. package/types/component/crosshair/interface/spec.d.ts +8 -4
  36. package/types/component/crosshair/polar.d.ts +6 -22
  37. package/types/component/crosshair/utils/cartesian.d.ts +5 -26
  38. package/types/component/crosshair/utils/polar.d.ts +18 -11
  39. package/types/component/data-zoom/data-filter-base-component.d.ts +4 -4
  40. package/types/component/data-zoom/data-zoom/data-zoom.d.ts +1 -1
  41. package/types/component/data-zoom/interface.d.ts +11 -0
  42. package/types/component/data-zoom/scroll-bar/scroll-bar.d.ts +1 -2
  43. package/types/component/geo/geo-coordinate.d.ts +2 -2
  44. package/types/component/geo/interface.d.ts +1 -1
  45. package/types/component/label/base-label.d.ts +5 -0
  46. package/types/component/label/interface.d.ts +4 -3
  47. package/types/component/label/label.d.ts +5 -3
  48. package/types/component/label/util.d.ts +9 -10
  49. package/types/component/legend/util.d.ts +3 -3
  50. package/types/component/marker/base-marker.d.ts +1 -1
  51. package/types/component/tooltip/processor/interface.d.ts +1 -1
  52. package/types/component/tooltip/processor/util.d.ts +1 -1
  53. package/types/component/tooltip/tooltip.d.ts +3 -3
  54. package/types/constant/data.d.ts +1 -0
  55. package/types/constant/event.d.ts +53 -2
  56. package/types/core/factory.d.ts +28 -3
  57. package/types/core/index.d.ts +2 -1
  58. package/types/core/interface.d.ts +13 -4
  59. package/types/core/vchart.d.ts +6 -6
  60. package/types/data/transforms/treemap.d.ts +5 -6
  61. package/types/data/transforms/venn.d.ts +10 -0
  62. package/types/data/transforms/waterfall.d.ts +1 -0
  63. package/types/event/events/base.d.ts +1 -2
  64. package/types/event/index.d.ts +1 -0
  65. package/types/event/interface.d.ts +6 -9
  66. package/types/index-harmony-simple.d.ts +2 -1
  67. package/types/index.d.ts +0 -1
  68. package/types/interaction/config.d.ts +13 -0
  69. package/types/interaction/index.d.ts +9 -1
  70. package/types/interaction/interaction.d.ts +17 -25
  71. package/types/interaction/interface/common.d.ts +22 -0
  72. package/types/interaction/interface/spec.d.ts +53 -0
  73. package/types/interaction/interface/trigger.d.ts +87 -0
  74. package/types/interaction/triggers/base.d.ts +28 -0
  75. package/types/interaction/triggers/dimension-hover.d.ts +22 -0
  76. package/types/interaction/triggers/element-active-by-legend.d.ts +21 -0
  77. package/types/interaction/triggers/element-active.d.ts +20 -0
  78. package/types/interaction/triggers/element-highlight-by-graphic-name.d.ts +13 -0
  79. package/types/interaction/triggers/element-highlight-by-group.d.ts +23 -0
  80. package/types/interaction/triggers/element-highlight-by-key.d.ts +9 -0
  81. package/types/interaction/triggers/element-highlight-by-legend.d.ts +22 -0
  82. package/types/interaction/triggers/element-highlight-by-name.d.ts +24 -0
  83. package/types/interaction/triggers/element-highlight.d.ts +25 -0
  84. package/types/interaction/triggers/element-select-by-graphic-name.d.ts +8 -0
  85. package/types/interaction/triggers/element-select.d.ts +24 -0
  86. package/types/interaction/triggers/enum.d.ts +8 -0
  87. package/types/interaction/triggers/util.d.ts +12 -0
  88. package/types/interaction/zoom/zoomable.d.ts +1 -0
  89. package/types/layout/interface.d.ts +2 -2
  90. package/types/layout/layout-item.d.ts +2 -3
  91. package/types/mark/arc.d.ts +2 -2
  92. package/types/mark/area.d.ts +2 -0
  93. package/types/mark/base/base-line.d.ts +16 -2
  94. package/types/mark/base/base-mark.d.ts +131 -13
  95. package/types/mark/box-plot.d.ts +11 -5
  96. package/types/mark/cell.d.ts +5 -2
  97. package/types/mark/component.d.ts +11 -3
  98. package/types/mark/glyph.d.ts +29 -0
  99. package/types/mark/group.d.ts +10 -6
  100. package/types/mark/index.d.ts +3 -1
  101. package/types/mark/interface/common.d.ts +61 -9
  102. package/types/mark/interface/enum.d.ts +6 -0
  103. package/types/mark/interface/index.d.ts +1 -0
  104. package/types/mark/interface/mark.d.ts +18 -1
  105. package/types/mark/interface/type.d.ts +1 -0
  106. package/types/mark/label.d.ts +4 -3
  107. package/types/mark/link-path.d.ts +35 -5
  108. package/types/mark/liquid.d.ts +47 -5
  109. package/types/mark/ripple.d.ts +39 -4
  110. package/types/mark/rule.d.ts +3 -0
  111. package/types/mark/symbol.d.ts +4 -4
  112. package/types/mark/text.d.ts +4 -2
  113. package/types/mark/transform/data-sampling.d.ts +10 -0
  114. package/types/mark/transform/filter.d.ts +1 -0
  115. package/types/mark/transform/map.d.ts +1 -0
  116. package/types/mark/transform/symbol-overlap.d.ts +14 -0
  117. package/types/mark/utils/common.d.ts +4 -0
  118. package/types/mark/utils/glyph.d.ts +2 -0
  119. package/types/mark/utils/index.d.ts +2 -0
  120. package/types/mark/utils/line.d.ts +3 -0
  121. package/types/model/base-model.d.ts +8 -8
  122. package/types/model/interface.d.ts +4 -8
  123. package/types/model/layout-model.d.ts +2 -2
  124. package/types/plugin/components/tooltip-handler/base.d.ts +2 -2
  125. package/types/plugin/components/tooltip-handler/utils/position.d.ts +2 -4
  126. package/types/plugin/other.d.ts +3 -3
  127. package/types/region/interface.d.ts +0 -2
  128. package/types/region/region.d.ts +3 -9
  129. package/types/series/area/animation.d.ts +1 -1
  130. package/types/series/area/area.d.ts +1 -1
  131. package/types/series/bar/animation.d.ts +1 -1
  132. package/types/series/bar/bar.d.ts +3 -3
  133. package/types/series/base/base-series.d.ts +26 -42
  134. package/types/series/base/tooltip-helper.d.ts +1 -2
  135. package/types/series/box-plot/box-plot.d.ts +3 -3
  136. package/types/series/cartesian/cartesian.d.ts +1 -1
  137. package/types/series/circle-packing/animation.d.ts +1 -1
  138. package/types/series/circle-packing/circle-packing.d.ts +1 -1
  139. package/types/series/correlation/animation.d.ts +1 -1
  140. package/types/series/correlation/correlation.d.ts +3 -4
  141. package/types/series/dot/dot.d.ts +2 -2
  142. package/types/series/funnel/funnel.d.ts +3 -2
  143. package/types/series/funnel/tooltip-helper.d.ts +1 -1
  144. package/types/series/gauge/animation.d.ts +1 -1
  145. package/types/series/gauge/gauge-pointer.d.ts +4 -1
  146. package/types/series/gauge/gauge.d.ts +2 -2
  147. package/types/series/geo/geo.d.ts +2 -2
  148. package/types/series/heatmap/animation.d.ts +1 -1
  149. package/types/series/heatmap/heatmap.d.ts +4 -1
  150. package/types/series/interface/common.d.ts +1 -4
  151. package/types/series/interface/series.d.ts +6 -1
  152. package/types/series/line/animation.d.ts +1 -1
  153. package/types/series/line/line.d.ts +1 -1
  154. package/types/series/link/link.d.ts +5 -2
  155. package/types/series/liquid/animation.d.ts +1 -1
  156. package/types/series/liquid/liquid.d.ts +4 -1
  157. package/types/series/map/interface.d.ts +10 -0
  158. package/types/series/mixin/line-mixin.d.ts +5 -5
  159. package/types/series/pictogram/pictogram.d.ts +15 -19
  160. package/types/series/pie/animation/animation.d.ts +4 -3
  161. package/types/series/pie/animation/centerOffset.d.ts +1 -1
  162. package/types/series/pie/interface.d.ts +2 -2
  163. package/types/series/pie/pie.d.ts +8 -6
  164. package/types/series/polar/progress-like/animation.d.ts +1 -1
  165. package/types/series/polar/progress-like/progress-like.d.ts +1 -2
  166. package/types/series/progress/circular/circular.d.ts +4 -1
  167. package/types/series/progress/linear/animation.d.ts +1 -1
  168. package/types/series/progress/linear/linear.d.ts +4 -1
  169. package/types/series/radar/animation.d.ts +11 -9
  170. package/types/series/radar/radar.d.ts +2 -2
  171. package/types/series/range-column/animation.d.ts +1 -1
  172. package/types/series/rose/animation.d.ts +1 -1
  173. package/types/series/sankey/animation.d.ts +1 -1
  174. package/types/series/sankey/sankey.d.ts +11 -12
  175. package/types/series/sankey/tooltip-helper.d.ts +1 -1
  176. package/types/series/scatter/animation.d.ts +1 -1
  177. package/types/series/sunburst/animation/enter.d.ts +1 -1
  178. package/types/series/sunburst/animation/exit.d.ts +1 -1
  179. package/types/series/sunburst/animation/preset.d.ts +1 -1
  180. package/types/series/sunburst/animation/utils.d.ts +2 -2
  181. package/types/series/sunburst/sunburst.d.ts +1 -1
  182. package/types/series/treemap/animation.d.ts +1 -1
  183. package/types/series/treemap/treemap.d.ts +1 -2
  184. package/types/series/venn/animation.d.ts +1 -1
  185. package/types/series/venn/venn.d.ts +2 -1
  186. package/types/series/waterfall/animation.d.ts +1 -1
  187. package/types/series/waterfall/waterfall.d.ts +2 -2
  188. package/types/series/word-cloud/animation.d.ts +1 -1
  189. package/types/series/word-cloud/base.d.ts +1 -1
  190. package/types/series/word-cloud/interface.d.ts +1 -1
  191. package/types/typings/common.d.ts +13 -0
  192. package/types/typings/spec/common.d.ts +37 -36
  193. package/types/typings/visual.d.ts +9 -2
  194. package/types/util/array.d.ts +1 -0
  195. package/types/util/index.d.ts +1 -0
  196. package/types/util/mark.d.ts +5 -0
  197. package/types/util/math.d.ts +1 -1
@@ -1,20 +1,38 @@
1
- import type { IMarkStateStyle, MarkType } from '../../mark/interface';
1
+ import type { IMark, IMarkStateStyle, MarkType } from '../../mark/interface';
2
2
  import type { IModel } from '../../model/interface';
3
3
  import type { GrammarItemCompileOption, GrammarItemInitOption, IGrammarItem } from '../interface';
4
4
  import type { DataView } from '@visactor/vdataset';
5
- import type { IAnimate, IAnimateArranger, IElement, IGroupMark, IMark, IMarkConfig, MarkAnimationSpec, Nil, TransformSpec } from '@visactor/vgrammar-core';
6
5
  import type { Maybe, Datum, StringOrNumber } from '../../typings';
7
6
  import type { IRegion } from '../../region/interface';
8
7
  import type { ICompilableData } from '../data/interface';
8
+ import type { ICustomPath2D, IGraphic, IGroup } from '@visactor/vrender-core';
9
+ import type { MarkAnimationSpec } from '../../animation/interface';
10
+ export interface IMarkConfig {
11
+ clipPath?: IGraphic[] | ((graphics: IGraphic[]) => IGraphic[]);
12
+ clip?: boolean;
13
+ zIndex?: number;
14
+ interactive?: boolean;
15
+ setCustomizedShape?: (datum: any[], attrs: any, path: ICustomPath2D) => ICustomPath2D;
16
+ large?: boolean;
17
+ largeThreshold?: number;
18
+ progressiveStep?: number;
19
+ progressiveThreshold?: number;
20
+ support3d?: boolean;
21
+ graphicName?: string | ((g: IMarkConfig) => string);
22
+ morph?: boolean;
23
+ morphKey?: string;
24
+ morphElementKey?: string;
25
+ overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';
26
+ skipTheme?: boolean;
27
+ }
9
28
  export interface IMarkStateManager {
10
29
  getStateInfoList: () => IStateInfo[];
11
30
  getStateInfo: (stateValue: StateValue) => IStateInfo;
12
31
  addStateInfo: (stateInfo: IStateInfo) => void;
13
32
  changeStateInfo: (stateInfo: Partial<IStateInfo>) => void;
14
33
  clearStateInfo: (stateValues: StateValue[]) => void;
15
- checkOneState: (renderNode: IElement, datum: Datum | Datum[], state: IStateInfo, isMultiMark?: boolean) => 'in' | 'out' | 'skip';
16
- checkState: (renderNode: IElement, datum: Datum | Datum[]) => StateValue[];
17
- updateLayoutState: (noRender?: boolean) => void;
34
+ checkOneState: (renderNode: IGraphic, datum: Datum[], state: IStateInfo) => 'in' | 'out' | 'skip';
35
+ checkState: (renderNode: IGraphic, datum: Datum[]) => StateValue[];
18
36
  }
19
37
  export interface IMarkData extends ICompilableData {
20
38
  setCompiledProductId: (name: string) => any;
@@ -33,48 +51,37 @@ export interface ICompilableMark extends IGrammarItem {
33
51
  readonly name: string;
34
52
  readonly key?: string | ((datum: Datum) => string);
35
53
  readonly model: IModel;
36
- getData: () => IMarkData | undefined;
37
- setData: (d: IMarkData) => void;
54
+ commit: (render?: boolean, recursion?: boolean) => void;
55
+ uncommit: () => void;
56
+ isCommited: () => boolean;
57
+ getData: () => ICompilableData | undefined;
58
+ setData: (d: ICompilableData) => void;
38
59
  getDataView: () => DataView | undefined;
39
- setDataView: (d?: DataView, productId?: string) => void;
60
+ setDataView: (d: DataView) => void;
40
61
  state: IMarkStateManager;
41
62
  readonly stateStyle: IMarkStateStyle<any>;
42
63
  hasState: (state: string) => boolean;
43
64
  getState: (state: string) => any;
44
65
  updateState: (newState: Record<string, unknown>) => void;
45
- updateStaticEncode: () => void;
46
66
  compileEncode: () => void;
47
- updateLayoutState: (noRender?: boolean, recursion?: boolean) => void;
48
- updateMarkState: (key: string) => void;
49
- setTransform: (transform: TransformSpec[] | Nil) => void;
50
67
  setAnimationConfig: (config: Partial<MarkAnimationSpec>) => void;
51
68
  getAnimationConfig: () => Partial<MarkAnimationSpec>;
52
69
  getVisible: () => boolean;
53
70
  setVisible: (visible: boolean) => void;
54
- getGroupKey: () => string | undefined;
55
71
  setGroupKey: (groupKey: string) => void;
56
72
  getUserId: () => StringOrNumber | undefined;
57
73
  setUserId: (id: StringOrNumber) => void;
58
74
  compile: (option?: IMarkCompileOption) => void;
59
- getProduct: () => Maybe<IMark>;
60
- getProductElements: () => Maybe<IMark['elements']>;
75
+ getProduct: () => Maybe<IGroup>;
61
76
  getMarks: () => ICompilableMark[];
62
77
  setSkipBeforeLayouted: (skip: boolean) => void;
63
- getSkipBeforeLayouted: () => boolean;
64
- setStateSortCallback: (stateSort: (stateA: string, stateB: string) => number) => void;
65
78
  getMarkConfig: () => IMarkConfig;
66
79
  setMarkConfig: (config: IMarkConfig) => void;
67
- runAnimationByState: (animationState?: string) => IAnimateArranger;
68
- stopAnimationByState: (animationState?: string) => IAnimate;
69
- pauseAnimationByState: (animationState: string) => IAnimate;
70
- resumeAnimationByState: (animationState: string) => IAnimate;
71
- }
72
- export interface IMarkDataInitOption extends ICompilableMarkOption {
73
- mark: ICompilableMark;
80
+ getContext: () => any;
81
+ layout: (layoutCallback: () => void) => void;
74
82
  }
75
83
  export interface IMarkCompileOption extends GrammarItemCompileOption {
76
- group?: string | IGroupMark;
77
- ignoreChildren?: boolean;
84
+ group?: IGroup;
78
85
  context?: any;
79
86
  }
80
87
  export interface IStateInfo {
@@ -83,7 +90,11 @@ export interface IStateInfo {
83
90
  datums?: any[] | null | undefined;
84
91
  datumKeys?: string[] | null | undefined;
85
92
  items?: any[] | null | undefined;
86
- filter?: ((datum: any, options: Record<string, any>) => boolean) | null | undefined;
93
+ filter?: ((datum: any, options: {
94
+ mark?: IMark;
95
+ type?: string;
96
+ renderNode?: IGraphic;
97
+ }) => boolean) | null | undefined;
87
98
  cache?: {
88
99
  [key: string]: {
89
100
  [key: string]: boolean;
@@ -116,7 +127,10 @@ export declare enum STATE_VALUE_ENUM {
116
127
  STATE_SELECTED = "selected",
117
128
  STATE_SELECTED_REVERSE = "selected_reverse",
118
129
  STATE_SANKEY_EMPHASIS = "selected",
119
- STATE_SANKEY_EMPHASIS_REVERSE = "blur"
130
+ STATE_SANKEY_EMPHASIS_REVERSE = "blur",
131
+ STATE_HIGHLIGHT = "highlight",
132
+ STATE_BLUR = "blur",
133
+ STATE_ACTIVE = "active"
120
134
  }
121
135
  export declare enum STATE_VALUE_ENUM_REVERSE {
122
136
  STATE_HOVER_REVERSE = "hover_reverse",
@@ -130,11 +144,6 @@ export type STATE_CUSTOM = string;
130
144
  export type StateValueNot = STATE_HOVER_REVERSE | STATE_CUSTOM;
131
145
  export type StateValue = STATE_NORMAL | STATE_HOVER | STATE_CUSTOM;
132
146
  export type StateValueType = StateValue | StateValueNot;
133
- export interface IAttributeOpt {
134
- element: IElement;
135
- mark: IElement['mark'];
136
- parent: IElement['mark']['group'];
137
- }
138
147
  export interface IModelMarkAttributeContext {
139
148
  [key: string]: unknown;
140
149
  }
@@ -1,26 +1,24 @@
1
- import type { IElement, IMark as IVGrammarMark } from '@visactor/vgrammar-core';
1
+ import type { IMark, IMarkGraphic } from '../../mark/interface';
2
2
  import type { Datum, StringOrNumber } from '../../typings';
3
- import type { IStateManagerOption } from '../signal/interface';
4
- import { StateManager } from '../signal/state-manager';
5
- import type { CompilableMark } from './compilable-mark';
6
3
  import type { IMarkStateManager, IStateInfo, StateValue } from './interface';
4
+ import type { ICompilableInitOption } from '../interface/compilable-item';
5
+ import { StateManager } from '../state-manager';
7
6
  export declare class MarkStateManager extends StateManager implements IMarkStateManager {
8
- protected _mark: CompilableMark;
7
+ protected _mark: IMark;
9
8
  private _stateInfoList;
10
9
  getStateInfoList(): IStateInfo[];
11
- constructor(option: IStateManagerOption, mark: CompilableMark);
10
+ constructor(options: ICompilableInitOption, mark: IMark);
12
11
  protected _getDefaultStateMap(): Record<string, unknown>;
13
12
  getStateInfo(stateValue: StateValue): IStateInfo;
14
13
  addStateInfo(stateInfo: IStateInfo): void;
15
14
  private _clearStateBeforeSet;
16
15
  changeStateInfo(stateInfo: Partial<IStateInfo>): void;
17
16
  clearStateInfo(stateValues: StateValue[]): void;
18
- checkOneState(renderNode: IElement, datum: Datum | Datum[], state: IStateInfo, isMultiMark?: boolean): 'in' | 'out' | 'skip';
19
- checkState(renderNode: IElement, datum: Datum | Datum[]): StateValue[];
20
- checkDatumState(state: IStateInfo, datum: Datum | Datum[], isMultiMark: boolean): boolean;
17
+ protected _isMultiMark(): boolean;
18
+ checkOneState(renderNode: IMarkGraphic, datum: Datum[], state: IStateInfo): 'in' | 'out' | 'skip';
19
+ checkState(renderNode: IMarkGraphic, datum: Datum[]): StateValue[];
20
+ checkDatumState(state: IStateInfo, datum: Datum[]): boolean;
21
21
  checkItemsState(state: IStateInfo, item: any): boolean | undefined;
22
- checkFieldsState(state: IStateInfo, datum: Datum | Datum[], item: any, isMultiMark: boolean): boolean;
23
- checkLinearFieldState(domain: StringOrNumber[], key: string, datum: any, item: any, isMultiMark: boolean): boolean;
24
- updateLayoutState(noRender?: boolean): void;
25
- compileState(product: IVGrammarMark, stateSort?: (stateA: string, stateB: string) => number): void;
22
+ checkFieldsState(state: IStateInfo, datum: Datum[], item: any): boolean;
23
+ checkLinearFieldState(domain: StringOrNumber[], key: string, datum: any, item: any): boolean;
26
24
  }
@@ -2,4 +2,4 @@ import type { IAttrs, IMarkStateStyle } from '../../mark/interface';
2
2
  export declare function isAttrChangeable<T>(key: string, stateStyle: IMarkStateStyle<T>): boolean;
3
3
  export declare function isStateAttrChangeable<T>(key: string, stateStyle: Partial<IAttrs<T>>, facetField: string): boolean;
4
4
  export declare function stateInDefaultEnum(state: string): boolean;
5
- export declare function stateToReverse(state: string): any;
5
+ export declare function stateToReverse(state: string): string;
@@ -0,0 +1,11 @@
1
+ import { CompilableBase } from './compilable-base';
2
+ import type { ICompilableInitOption, StateValueMap } from './interface/compilable-item';
3
+ export declare class StateManager extends CompilableBase {
4
+ compile(): void;
5
+ protected _stateMap: StateValueMap;
6
+ getStateMap(): StateValueMap;
7
+ protected _getDefaultStateMap(): StateValueMap;
8
+ constructor(options: ICompilableInitOption);
9
+ initStateMap(state?: StateValueMap): void;
10
+ updateState(newState: Partial<StateValueMap>, noRender?: boolean): void;
11
+ }
@@ -1,2 +1,16 @@
1
+ import type { IMorphConfig } from '../animation/spec';
2
+ import type { IMark } from '../mark/interface';
3
+ import type { DiffResult } from '../typings/common';
1
4
  import type { RenderMode } from '../typings/spec';
2
5
  export declare function toRenderMode(mode: RenderMode): any;
6
+ export declare function traverseGroupMark<T>(group: IMark, apply: (mark: IMark) => T, filter?: (mark: IMark) => boolean, leafFirst?: boolean, stop?: boolean): T | undefined;
7
+ export declare function findSimpleMarks(groups: IMark[]): IMark[];
8
+ export declare function diffUpdateByGroup(prev: IMark[], next: IMark[], prevKey: (datum: IMark) => string, nextKey: (datum: IMark) => string): {
9
+ prev: IMark[];
10
+ next: IMark[];
11
+ update: {
12
+ prev: IMark[];
13
+ next: IMark[];
14
+ }[];
15
+ };
16
+ export declare function diffMarks(prevMarks: IMark[], nextMarks: IMark[], runningConfig: IMorphConfig): DiffResult<IMark[], IMark[]>;
@@ -4,12 +4,13 @@ import type { IGraphic } from '@visactor/vrender-core';
4
4
  import type { IOrientType, IPolarOrientType, StringOrNumber, CoordinateType } from '../../typings';
5
5
  import { BaseComponent } from '../base/base-component';
6
6
  import { CompilableData } from '../../compile/data';
7
- import type { IAxis, ICommonAxisSpec, ITick } from './interface';
7
+ import { type IAxis, type ICommonAxisSpec, type ITick } from './interface';
8
8
  import { type IComponentOption } from '../interface';
9
9
  import type { ISeries } from '../../series/interface';
10
10
  import type { ITransformOptions } from '@visactor/vdataset';
11
11
  import { DataView } from '@visactor/vdataset';
12
12
  import type { IComponentMark } from '../../mark/interface/mark';
13
+ import type { ICompilableMark } from '../../compile/mark';
13
14
  export declare abstract class AxisComponent<T extends ICommonAxisSpec & Record<string, any> = any> extends BaseComponent<T> implements IAxis {
14
15
  static specKey: string;
15
16
  specKey: string;
@@ -50,7 +51,7 @@ export declare abstract class AxisComponent<T extends ICommonAxisSpec & Record<s
50
51
  getCoordinateType(): CoordinateType;
51
52
  constructor(spec: T, options: IComponentOption);
52
53
  protected _getNeedClearVRenderComponents(): IGraphic[];
53
- getVRenderComponents(): any[];
54
+ getVRenderComponents(): import("@visactor/vrender-core").IGroup[];
54
55
  created(): void;
55
56
  protected _shouldComputeTickData(): boolean;
56
57
  protected _initData(): void;
@@ -68,8 +69,9 @@ export declare abstract class AxisComponent<T extends ICommonAxisSpec & Record<s
68
69
  protected initEvent(): void;
69
70
  protected updateScaleDomain(): void;
70
71
  protected _clearRawDomain(): void;
71
- onLayoutEnd(ctx: any): void;
72
+ onLayoutEnd(): void;
72
73
  protected computeData(updateType?: 'domain' | 'range' | 'force'): void;
74
+ protected _updateTickDataMarks(m: ICompilableMark): void;
73
75
  protected initScales(): void;
74
76
  _compareSpec(spec: T, prevSpec: T): {
75
77
  change: boolean;
@@ -77,7 +77,7 @@ export declare abstract class CartesianAxis<T extends ICartesianAxisCommonSpec =
77
77
  protected updateScaleRange(): boolean;
78
78
  init(option: IModelInitOption): void;
79
79
  setAttrFromSpec(): void;
80
- onLayoutStart(layoutRect: IRect, viewRect: ILayoutRect, ctx: any): void;
80
+ onLayoutStart(layoutRect: IRect, viewRect: ILayoutRect): void;
81
81
  protected getSeriesStatisticsField(s: ICartesianSeries): string[];
82
82
  protected _tickTransformOption(): ICartesianTickDataOpt;
83
83
  protected axisHelper(): IAxisHelper;
@@ -16,6 +16,7 @@ export declare class CartesianTimeAxis<T extends ICartesianTimeAxisSpec = ICarte
16
16
  setAttrFromSpec(): void;
17
17
  protected _initData(): void;
18
18
  protected computeData(updateType?: 'range' | 'domain' | 'force'): void;
19
+ created(): void;
19
20
  protected _getLabelFormatMethod(): any;
20
21
  protected getLabelItems(length: number): any[];
21
22
  protected registerTicksTransform(): string;
@@ -48,3 +48,11 @@ export interface ITickCalculationCfg {
48
48
  export interface IBandAxisLayer extends Omit<ITickCalculationCfg, 'noDecimals' | 'tickMode'> {
49
49
  visible?: boolean;
50
50
  }
51
+ export declare enum AxisEnum {
52
+ lineAxis = "lineAxis",
53
+ circleAxis = "circleAxis"
54
+ }
55
+ export declare enum GridEnum {
56
+ lineAxisGrid = "lineAxisGrid",
57
+ circleAxisGrid = "circleAxisGrid"
58
+ }
@@ -3,7 +3,6 @@ import type { IRegion } from '../../region/interface';
3
3
  import type { IComponent, IComponentOption } from '../interface';
4
4
  import type { IComponentPluginService, IComponentPlugin } from '../../plugin/components/interface';
5
5
  import type { IBoundsLike } from '@visactor/vutils';
6
- import type { IGroupMark } from '@visactor/vgrammar-core';
7
6
  import type { IAnimate } from '../../animation/interface';
8
7
  import type { Datum, ILayoutRect } from '../../typings';
9
8
  import type { IComponentSpec } from './interface';
@@ -41,7 +40,7 @@ export declare class BaseComponent<T extends IComponentSpec = IComponentSpec> ex
41
40
  release(): void;
42
41
  clear(): void;
43
42
  compile(): void;
44
- compileMarks(group?: string | IGroupMark): void;
43
+ compileMarks(group?: IGroup): void;
45
44
  reAppendComponents(): void;
46
45
  protected _delegateEvent: (component: IGraphic, event: any, type: string, item?: any, datum?: Datum) => void;
47
46
  getBoundsInRect(rect: ILayoutRect, fullRect: ILayoutRect): IBoundsLike;
@@ -6,7 +6,7 @@ import type { IModelRenderOption, IModelSpecInfo } from '../../model/interface';
6
6
  import type { IRegion } from '../../region/interface';
7
7
  import type { IGraphic } from '@visactor/vrender-core';
8
8
  import type { ISeries } from '../../series/interface';
9
- import type { IElement } from '@visactor/vgrammar-core';
9
+ import type { IMarkGraphic } from '../../mark/interface';
10
10
  import type { BrushInteractiveRangeAttr, IBrush, IBrushSpec } from './interface';
11
11
  export declare class Brush<T extends IBrushSpec = IBrushSpec> extends BaseComponent<T> implements IBrush {
12
12
  layoutType: 'none';
@@ -23,19 +23,19 @@ export declare class Brush<T extends IBrushSpec = IBrushSpec> extends BaseCompon
23
23
  private _linkedItemMap;
24
24
  protected _inBrushElementsMap: {
25
25
  [brushName: string]: {
26
- [elementKey: string]: IElement;
26
+ [elementKey: string]: IMarkGraphic;
27
27
  };
28
28
  };
29
29
  protected _outOfBrushElementsMap: {
30
- [elementKey: string]: IElement;
30
+ [elementKey: string]: IMarkGraphic;
31
31
  };
32
32
  protected _linkedInBrushElementsMap: {
33
33
  [brushName: string]: {
34
- [elementKey: string]: IElement;
34
+ [elementKey: string]: IMarkGraphic;
35
35
  };
36
36
  };
37
37
  protected _linkedOutOfBrushElementsMap: {
38
- [elementKey: string]: IElement;
38
+ [elementKey: string]: IMarkGraphic;
39
39
  };
40
40
  private _needInitOutState;
41
41
  private _cacheInteractiveRangeAttrs;
@@ -49,12 +49,14 @@ export declare class Brush<T extends IBrushSpec = IBrushSpec> extends BaseCompon
49
49
  created(): void;
50
50
  protected _extendDataInBrush(elementsMap: {
51
51
  [brushName: string]: {
52
- [elementKey: string]: IElement;
52
+ [elementKey: string]: IMarkGraphic;
53
53
  };
54
- }): any[];
54
+ }): {
55
+ [x: string]: any;
56
+ }[];
55
57
  protected _extendDatumOutOfBrush(elementsMap: {
56
- [elementKey: string]: IElement;
57
- }): any[];
58
+ [elementKey: string]: IMarkGraphic;
59
+ }): import("../../typings").Datum[];
58
60
  protected _getBrushInteractiveAttr(region: IRegion): BrushInteractiveRangeAttr;
59
61
  protected _updateBrushComponent(region: IRegion, componentIndex: number): void;
60
62
  protected _createBrushComponent(region: IRegion, componentIndex: number): void;
@@ -83,7 +85,7 @@ export declare class Brush<T extends IBrushSpec = IBrushSpec> extends BaseCompon
83
85
  reSize: boolean;
84
86
  reCompile: boolean;
85
87
  };
86
- onLayoutEnd(ctx: any): void;
88
+ onLayoutEnd(): void;
87
89
  clearGraphic(): void;
88
90
  clear(): void;
89
91
  }
@@ -1,39 +1,13 @@
1
- import type { Dict, IBoundsLike } from '@visactor/vutils';
2
- import type { IModelLayoutOption, IModelRenderOption } from '../../model/interface';
1
+ import type { IBoundsLike } from '@visactor/vutils';
2
+ import { Tag } from '@visactor/vrender-components';
3
+ import type { IGraphic } from '@visactor/vrender-core';
4
+ import type { IModelRenderOption } from '../../model/interface';
3
5
  import type { IRegion } from '../../region/interface';
4
6
  import { BaseComponent } from '../base/base-component';
5
- import type { IPadding, StringOrNumber, TooltipActiveType, TooltipData } from '../../typings';
7
+ import type { IPoint, StringOrNumber, TooltipActiveType, TooltipData } from '../../typings';
6
8
  import type { IComponentOption } from '../interface';
7
- import type { ICrossHair, CrossHairTrigger, ICartesianCrosshairSpec, IPolarCrosshairSpec, ICrosshairCategoryFieldSpec } from './interface';
9
+ import type { ICrossHair, CrossHairTrigger, ICartesianCrosshairSpec, IPolarCrosshairSpec, ICrosshairCategoryFieldSpec, IAxisInfo, CrossHairStateByField } from './interface';
8
10
  import type { IAxis } from '../axis/interface';
9
- export type IBound = {
10
- x1: number;
11
- y1: number;
12
- x2: number;
13
- y2: number;
14
- };
15
- export type IAxisInfo<T> = Map<number, IBound & {
16
- axis: T;
17
- }>;
18
- export interface IHair {
19
- visible: boolean;
20
- type: 'rect' | 'line';
21
- style?: Dict<any>;
22
- label?: {
23
- visible: boolean;
24
- formatMethod?: (text: StringOrNumber | string[], position: string) => string | string[];
25
- formatter?: string | string[];
26
- textStyle?: Dict<any>;
27
- minWidth?: number;
28
- maxWidth?: number;
29
- padding?: IPadding | number | number[];
30
- panel?: Dict<any>;
31
- zIndex?: number;
32
- };
33
- }
34
- export interface IHairRadius extends IHair {
35
- smooth?: boolean;
36
- }
37
11
  export declare abstract class BaseCrossHair<T extends ICartesianCrosshairSpec | IPolarCrosshairSpec> extends BaseComponent<T> implements ICrossHair {
38
12
  static specKey: string;
39
13
  specKey: string;
@@ -44,6 +18,7 @@ export declare abstract class BaseCrossHair<T extends ICartesianCrosshairSpec |
44
18
  enable: boolean;
45
19
  showDefault: boolean;
46
20
  triggerOff: 'none' | number;
21
+ protected _stateByField: CrossHairStateByField;
47
22
  private _timer?;
48
23
  private _clickLock?;
49
24
  private _hasActive?;
@@ -51,11 +26,20 @@ export declare abstract class BaseCrossHair<T extends ICartesianCrosshairSpec |
51
26
  get enableRemain(): boolean;
52
27
  private _limitBounds;
53
28
  constructor(spec: T, options: IComponentOption);
54
- protected abstract _showDefaultCrosshairBySpec(): void;
55
29
  protected abstract _layoutCrosshair(x: number, y: number, tooltipData?: TooltipData, activeType?: TooltipActiveType): void;
56
- protected abstract _parseFieldInfo(): void;
57
- abstract hide(): void;
30
+ abstract setAxisValue(v: StringOrNumber, axis: IAxis): void;
31
+ abstract layoutByValue(v?: number): void;
32
+ protected abstract _getDatumAtPoint(axis: IAxis, point: IPoint): number | string;
33
+ protected _setAllAxisValues(axisMap: IAxisInfo<IAxis>, point: IPoint, field: string): boolean;
34
+ clearAxisValue(): void;
35
+ hideCrosshair(): void;
36
+ showCrosshair(dimInfo: {
37
+ axis: IAxis;
38
+ value: string | number;
39
+ }[]): void;
58
40
  protected _getLimitBounds(): IBoundsLike;
41
+ protected _showDefaultCrosshairBySpec(): void;
42
+ protected _updateVisibleCrosshair(): void;
59
43
  protected _showDefaultCrosshair(): void;
60
44
  setAttrFromSpec(): void;
61
45
  created(): void;
@@ -84,11 +68,16 @@ export declare abstract class BaseCrossHair<T extends ICartesianCrosshairSpec |
84
68
  private _handleTooltipHideOrRelease;
85
69
  protected _getAxisInfoByField<T = IAxis>(field: 'x' | 'y' | 'category' | 'value'): IAxisInfo<T>;
86
70
  changeRegions(regions: IRegion[]): void;
87
- onLayoutEnd(ctx: IModelLayoutOption): void;
71
+ onLayoutEnd(): void;
88
72
  onRender(ctx: IModelRenderOption): void;
89
73
  protected _releaseEvent(): void;
74
+ protected _parseFieldInfo(): void;
90
75
  protected _parseCrosshairSpec(): void;
91
76
  protected _parseField(field: ICrosshairCategoryFieldSpec, fieldName: string): any;
92
77
  protected _filterAxisByPoint<T>(axisMap: IAxisInfo<T>, relativeX: number, relativeY: number): IAxisInfo<T>;
78
+ protected _updateCrosshairLabel(label: Tag, labelAttrs: any, callback: (label: Tag) => void): void;
93
79
  protected clearOutEvent(): void;
80
+ protected _hideByField(field: string): void;
81
+ hide(): void;
82
+ protected _getNeedClearVRenderComponents(): IGraphic[];
94
83
  }
@@ -3,45 +3,22 @@ import type { IComponentOption } from '../interface';
3
3
  import { ComponentTypeEnum } from '../interface/type';
4
4
  import type { ICartesianCrosshairSpec } from './interface';
5
5
  import { BaseCrossHair } from './base';
6
- import type { IGraphic } from '@visactor/vrender-core';
7
6
  import type { IAxis } from '../axis/interface';
8
- import type { StringOrNumber, TooltipActiveType, TooltipData } from '../../typings';
7
+ import type { IPoint, StringOrNumber, TooltipActiveType, TooltipData } from '../../typings';
9
8
  import type { IModelSpecInfo } from '../../model/interface';
10
9
  export declare class CartesianCrossHair<T extends ICartesianCrosshairSpec = ICartesianCrosshairSpec> extends BaseCrossHair<T> {
11
10
  static specKey: string;
12
11
  static type: ComponentTypeEnum;
13
12
  type: ComponentTypeEnum;
14
13
  name: string;
15
- private _xHair;
16
- private _yHair;
17
- private _cacheXCrossHairInfo;
18
- private _cacheYCrossHairInfo;
19
- private _xCrosshair;
20
- private _xTopLabel;
21
- private _xBottomLabel;
22
- private _yCrosshair;
23
- private _yLeftLabel;
24
- private _yRightLabel;
25
- private _currValueX;
26
- private _currValueY;
27
14
  static getSpecInfo(chartSpec: any): Maybe<IModelSpecInfo[]>;
28
15
  constructor(spec: T, options: IComponentOption);
29
- protected _showDefaultCrosshairBySpec(): void;
30
- private _defaultCrosshair;
31
16
  private _findAllAxisContains;
32
- private _getValueAt;
33
- clearAxisValue(): void;
34
- setAxisValue(value: StringOrNumber, axis: IAxis): void;
35
- private _getAllAxisValues;
17
+ protected _getDatumAtPoint(axis: IAxis, point: IPoint): number | string;
18
+ setAxisValue(datum: StringOrNumber, axis: IAxis): void;
36
19
  protected _layoutCrosshair(relativeX: number, relativeY: number, tooltipData?: TooltipData, activeType?: TooltipActiveType): void;
37
- hide(): void;
38
20
  layoutByValue(tag?: number): void;
39
- private _layoutVertical;
40
- private _layoutHorizontal;
41
- protected _parseFieldInfo(): void;
42
- private _parseAndSetCrosshair;
43
- private _updateCrosshair;
44
- private _updateCrosshairLabel;
45
- protected _getNeedClearVRenderComponents(): IGraphic[];
21
+ private _layoutByField;
22
+ private _updateCrosshairByField;
46
23
  }
47
24
  export declare const registerCartesianCrossHair: () => void;
@@ -1,7 +1,72 @@
1
- import type { StringOrNumber } from '../../../typings';
1
+ import type { Dict } from '@visactor/vutils';
2
+ import type { IPadding, StringOrNumber } from '../../../typings';
2
3
  import type { IAxis } from '../../axis/interface';
4
+ import type { LineCrosshair, RectCrosshair, Tag } from '@visactor/vrender-components';
5
+ import type { IGroup, IRichTextGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
3
6
  export type AxisCurrentValueMap = Map<number, {
4
- value: StringOrNumber;
7
+ datum: StringOrNumber;
5
8
  axis: IAxis;
6
9
  [key: string]: any;
7
10
  }>;
11
+ export type IBound = {
12
+ x1: number;
13
+ y1: number;
14
+ x2: number;
15
+ y2: number;
16
+ };
17
+ export type IAxisInfo<T> = Map<number, IBound & {
18
+ axis: T;
19
+ }>;
20
+ export interface IHair {
21
+ visible: boolean;
22
+ type: 'rect' | 'line';
23
+ style?: Dict<any>;
24
+ label?: {
25
+ visible: boolean;
26
+ formatMethod?: (text: StringOrNumber | string[], position: string) => string | string[];
27
+ formatter?: string | string[];
28
+ textStyle?: Dict<any>;
29
+ minWidth?: number;
30
+ maxWidth?: number;
31
+ padding?: IPadding | number | number[];
32
+ panel?: Dict<any>;
33
+ zIndex?: number;
34
+ };
35
+ smooth?: boolean;
36
+ }
37
+ export interface IHairRadius extends IHair {
38
+ smooth?: boolean;
39
+ }
40
+ export interface ICrosshairLabelInfo {
41
+ visible: boolean;
42
+ text: StringOrNumber;
43
+ dx?: number;
44
+ dy?: number;
45
+ x?: number;
46
+ y?: number;
47
+ offset?: number;
48
+ defaultFormatter?: (value: StringOrNumber) => StringOrNumber;
49
+ }
50
+ export interface ICrosshairInfo {
51
+ coordRange: [number, number];
52
+ sizeRange: [number, number];
53
+ coord: number;
54
+ labels: Record<string, ICrosshairLabelInfo>;
55
+ labelsTextStyle?: Record<string, Partial<ITextGraphicAttribute> | Partial<IRichTextGraphicAttribute>>;
56
+ visible: boolean;
57
+ _isCache?: boolean;
58
+ axis: IAxis;
59
+ sides?: number;
60
+ }
61
+ export interface CrossHairStateItem {
62
+ coordKey: string;
63
+ anotherAxisKey: string;
64
+ currentValue: AxisCurrentValueMap;
65
+ attributes?: IHair | undefined;
66
+ cacheInfo?: ICrosshairInfo | undefined;
67
+ crosshairComp?: LineCrosshair | RectCrosshair | IGroup;
68
+ labelsComp?: Record<string, Tag>;
69
+ bandSize?: number;
70
+ offsetSize?: number;
71
+ }
72
+ export type CrossHairStateByField = Record<string, CrossHairStateItem>;
@@ -1,5 +1,3 @@
1
1
  export * from './spec';
2
2
  export * from './theme';
3
- export * from './cartesian';
4
- export * from './polar';
5
3
  export * from './common';
@@ -4,10 +4,14 @@ import type { IAxis } from '../../axis/interface';
4
4
  import type { IComponentSpec } from '../../base/interface';
5
5
  import type { IComponent } from '../../interface';
6
6
  export interface ICrossHair extends IComponent {
7
- clearAxisValue?: () => void;
8
- setAxisValue?: (v: StringOrNumber, axis: IAxis) => void;
9
- layoutByValue?: (v?: number) => void;
10
- hide?: () => void;
7
+ clearAxisValue: () => void;
8
+ setAxisValue: (v: StringOrNumber, axis: IAxis) => void;
9
+ layoutByValue: (v?: number) => void;
10
+ hideCrosshair: () => any;
11
+ showCrosshair: (dimInfo: {
12
+ axis: IAxis;
13
+ value: string | number;
14
+ }[]) => any;
11
15
  }
12
16
  export type CrossHairTrigger = 'click' | 'hover' | ['click', 'hover'];
13
17
  export interface ICommonCrosshairSpec extends IComponentSpec {