1 | import { GeometryCfg } from './geometry/base';
|
2 | import { IInteractionContext } from './interface';
|
3 |
|
4 |
|
5 | import { registerTheme } from './core';
|
6 | import { antvDark } from './theme/style-sheet/dark';
|
7 | import { createThemeByStyleSheet } from './theme/util/create-by-style-sheet';
|
8 | registerTheme('dark', createThemeByStyleSheet(antvDark));
|
9 |
|
10 |
|
11 | import * as CanvasEngine from '@antv/g-canvas';
|
12 | import * as SVGEngine from '@antv/g-svg';
|
13 | import { registerEngine } from './core';
|
14 |
|
15 | registerEngine('canvas', CanvasEngine);
|
16 | registerEngine('svg', SVGEngine);
|
17 |
|
18 |
|
19 | import { registerGeometry } from './core';
|
20 | import Area, { AreaCfg } from './geometry/area';
|
21 | import Edge from './geometry/edge';
|
22 | import Heatmap from './geometry/heatmap';
|
23 | import Interval, { IntervalCfg } from './geometry/interval';
|
24 | import Line from './geometry/line';
|
25 | import Path, { PathCfg } from './geometry/path';
|
26 | import Point from './geometry/point';
|
27 | import Polygon from './geometry/polygon';
|
28 | import Schema from './geometry/schema';
|
29 | import Violin from './geometry/violin';
|
30 |
|
31 | registerGeometry('Polygon', Polygon);
|
32 | registerGeometry('Interval', Interval);
|
33 | registerGeometry('Schema', Schema);
|
34 | registerGeometry('Path', Path);
|
35 | registerGeometry('Point', Point);
|
36 | registerGeometry('Line', Line);
|
37 | registerGeometry('Area', Area);
|
38 | registerGeometry('Edge', Edge);
|
39 | registerGeometry('Heatmap', Heatmap);
|
40 | registerGeometry('Violin', Violin);
|
41 |
|
42 |
|
43 | import './geometry/shape/area/line';
|
44 | import './geometry/shape/area/smooth';
|
45 | import './geometry/shape/area/smooth-line';
|
46 |
|
47 | import './geometry/shape/edge/arc';
|
48 | import './geometry/shape/edge/smooth';
|
49 | import './geometry/shape/edge/vhv';
|
50 |
|
51 | import './geometry/shape/interval/funnel';
|
52 | import './geometry/shape/interval/hollow-rect';
|
53 | import './geometry/shape/interval/line';
|
54 | import './geometry/shape/interval/pyramid';
|
55 | import './geometry/shape/interval/tick';
|
56 |
|
57 | import './geometry/shape/line/step';
|
58 |
|
59 | import './geometry/shape/point/hollow';
|
60 | import './geometry/shape/point/image';
|
61 | import './geometry/shape/point/solid';
|
62 |
|
63 | import './geometry/shape/schema/box';
|
64 | import './geometry/shape/schema/candle';
|
65 |
|
66 | import './geometry/shape/polygon/square';
|
67 |
|
68 | import './geometry/shape/violin/smooth';
|
69 | import './geometry/shape/violin/hollow';
|
70 |
|
71 |
|
72 | import { registerGeometryLabel } from './core';
|
73 | import GeometryLabel from './geometry/label/base';
|
74 | import IntervalLabel from './geometry/label/interval';
|
75 | import PieLabel from './geometry/label/pie';
|
76 | import PolarLabel from './geometry/label/polar';
|
77 |
|
78 | registerGeometryLabel('base', GeometryLabel);
|
79 | registerGeometryLabel('interval', IntervalLabel);
|
80 | registerGeometryLabel('pie', PieLabel);
|
81 | registerGeometryLabel('polar', PolarLabel);
|
82 |
|
83 |
|
84 | import { registerGeometryLabelLayout } from './core';
|
85 | import { distribute } from './geometry/label/layout/pie/distribute';
|
86 | import { pieOuterLabelLayout } from './geometry/label/layout/pie/outer';
|
87 | import { pieSpiderLabelLayout } from './geometry/label/layout/pie/spider';
|
88 | import { limitInCanvas } from './geometry/label/layout/limit-in-canvas';
|
89 | import { limitInShape } from './geometry/label/layout/limit-in-shape';
|
90 | import { fixedOverlap, overlap } from './geometry/label/layout/overlap';
|
91 | import { hideOverlap } from './geometry/label/layout/hide-overlap';
|
92 | import { adjustColor } from './geometry/label/layout/adjust-color';
|
93 | import { intervalAdjustPosition } from './geometry/label/layout/interval/adjust-position';
|
94 | import { intervalHideOverlap } from './geometry/label/layout/interval/hide-overlap';
|
95 | import { pointAdjustPosition } from './geometry/label/layout/point/adjust-position';
|
96 | import { pathAdjustPosition } from './geometry/label/layout/path/adjust-position';
|
97 | import { limitInPlot } from './geometry/label/layout/limit-in-plot';
|
98 |
|
99 | registerGeometryLabelLayout('overlap', overlap);
|
100 | registerGeometryLabelLayout('distribute', distribute);
|
101 | registerGeometryLabelLayout('fixed-overlap', fixedOverlap);
|
102 | registerGeometryLabelLayout('hide-overlap', hideOverlap);
|
103 | registerGeometryLabelLayout('limit-in-shape', limitInShape);
|
104 | registerGeometryLabelLayout('limit-in-canvas', limitInCanvas);
|
105 | registerGeometryLabelLayout('limit-in-plot', limitInPlot);
|
106 | registerGeometryLabelLayout('pie-outer', pieOuterLabelLayout);
|
107 | registerGeometryLabelLayout('adjust-color', adjustColor);
|
108 | registerGeometryLabelLayout('interval-adjust-position', intervalAdjustPosition);
|
109 | registerGeometryLabelLayout('interval-hide-overlap', intervalHideOverlap);
|
110 | registerGeometryLabelLayout('point-adjust-position', pointAdjustPosition);
|
111 | registerGeometryLabelLayout('pie-spider', pieSpiderLabelLayout);
|
112 | registerGeometryLabelLayout('path-adjust-position', pathAdjustPosition);
|
113 |
|
114 |
|
115 | import { fadeIn, fadeOut } from './animate/animation/fade';
|
116 | import { growInX, growInXY, growInY } from './animate/animation/grow-in';
|
117 | import { pathIn } from './animate/animation/path-in';
|
118 | import { positionUpdate } from './animate/animation/position-update';
|
119 | import { scaleInX, scaleInY } from './animate/animation/scale-in';
|
120 | import { sectorPathUpdate } from './animate/animation/sector-path-update';
|
121 | import { waveIn } from './animate/animation/wave-in';
|
122 | import { zoomIn, zoomOut } from './animate/animation/zoom';
|
123 | import { registerAnimation } from './core';
|
124 |
|
125 | registerAnimation('fade-in', fadeIn);
|
126 | registerAnimation('fade-out', fadeOut);
|
127 | registerAnimation('grow-in-x', growInX);
|
128 | registerAnimation('grow-in-xy', growInXY);
|
129 | registerAnimation('grow-in-y', growInY);
|
130 | registerAnimation('scale-in-x', scaleInX);
|
131 | registerAnimation('scale-in-y', scaleInY);
|
132 | registerAnimation('wave-in', waveIn);
|
133 | registerAnimation('zoom-in', zoomIn);
|
134 | registerAnimation('zoom-out', zoomOut);
|
135 | registerAnimation('position-update', positionUpdate);
|
136 | registerAnimation('sector-path-update', sectorPathUpdate);
|
137 | registerAnimation('path-in', pathIn);
|
138 |
|
139 |
|
140 | import { registerFacet } from './core';
|
141 | import Circle from './facet/circle';
|
142 | import List from './facet/list';
|
143 | import Matrix from './facet/matrix';
|
144 | import Mirror from './facet/mirror';
|
145 | import Rect from './facet/rect';
|
146 | import Tree from './facet/tree';
|
147 |
|
148 | registerFacet('rect', Rect);
|
149 | registerFacet('mirror', Mirror);
|
150 | registerFacet('list', List);
|
151 | registerFacet('matrix', Matrix);
|
152 | registerFacet('circle', Circle);
|
153 | registerFacet('tree', Tree);
|
154 |
|
155 |
|
156 | import { registerComponentController } from './core';
|
157 |
|
158 | import Annotation from './chart/controller/annotation';
|
159 | import Axis from './chart/controller/axis';
|
160 | import Legend from './chart/controller/legend';
|
161 | import Slider from './chart/controller/slider';
|
162 | import Tooltip from './chart/controller/tooltip';
|
163 | import Scrollbar from './chart/controller/scrollbar';
|
164 |
|
165 |
|
166 | registerComponentController('axis', Axis);
|
167 | registerComponentController('legend', Legend);
|
168 | registerComponentController('tooltip', Tooltip);
|
169 | registerComponentController('annotation', Annotation);
|
170 | registerComponentController('slider', Slider);
|
171 | registerComponentController('scrollbar', Scrollbar);
|
172 |
|
173 |
|
174 | import { registerAction } from './core';
|
175 | import ActiveRegion from './interaction/action/active-region';
|
176 | import SiblingTooltip from './interaction/action/component/tooltip/sibling';
|
177 | import TooltipAction from './interaction/action/component/tooltip/geometry';
|
178 | import EllipsisTextAction from './interaction/action/component/tooltip/ellipsis-text';
|
179 |
|
180 | import ElementActive from './interaction/action/element/active';
|
181 | import ElementLinkByColor from './interaction/action/element/link-by-color';
|
182 | import ElementRangeActive from './interaction/action/element/range-active';
|
183 | import ElementSingleActive from './interaction/action/element/single-active';
|
184 |
|
185 | import ElementHighlight from './interaction/action/element/highlight';
|
186 | import ElementHighlightByColor from './interaction/action/element/highlight-by-color';
|
187 | import ElementHighlightByX from './interaction/action/element/highlight-by-x';
|
188 |
|
189 | import ElementRangeHighlight, { ELEMENT_RANGE_HIGHLIGHT_EVENTS } from './interaction/action/element/range-highlight';
|
190 | import ElementSingleHighlight from './interaction/action/element/single-highlight';
|
191 |
|
192 | import ElementRangeSelected from './interaction/action/element/range-selected';
|
193 | import ElementSelected from './interaction/action/element/selected';
|
194 | import ElementSingleSelected from './interaction/action/element/single-selected';
|
195 |
|
196 | import ListActive from './interaction/action/component/list-active';
|
197 | import ListHighlight from './interaction/action/component/list-highlight';
|
198 | import ListSelected from './interaction/action/component/list-selected';
|
199 | import ListUnchecked from './interaction/action/component/list-unchecked';
|
200 | import ListChecked from './interaction/action/component/list-checked';
|
201 | import ListFocus from './interaction/action/component/list-focus';
|
202 | import ListRadio from './interaction/action/component/list-radio';
|
203 |
|
204 | import CircleMask from './interaction/action/mask/circle';
|
205 | import DimMask from './interaction/action/mask/dim-rect';
|
206 | import PathMask from './interaction/action/mask/path';
|
207 | import RectMask from './interaction/action/mask/rect';
|
208 | import SmoothPathMask from './interaction/action/mask/smooth-path';
|
209 |
|
210 | import CursorAction from './interaction/action/cursor';
|
211 | import DataFilter from './interaction/action/data/filter';
|
212 | import DataRangeFilter, { BRUSH_FILTER_EVENTS } from './interaction/action/data/range-filter';
|
213 | import SiblingFilter from './interaction/action/data/sibling-filter';
|
214 |
|
215 | import ElementFilter from './interaction/action/element/filter';
|
216 | import ElementSiblingFilter from './interaction/action/element/sibling-filter';
|
217 | import ButtonAction from './interaction/action/view/button';
|
218 | import ViewDrag from './interaction/action/view/drag';
|
219 | import ViewMove from './interaction/action/view/move';
|
220 | import ScaleTranslate from './interaction/action/view/scale-translate';
|
221 | import ScaleZoom from './interaction/action/view/scale-zoom';
|
222 | import MousewheelScroll from './interaction/action/view/mousewheel-scroll';
|
223 | import AxisDescription from './interaction/action/component/axis/axis-description'
|
224 |
|
225 | registerAction('tooltip', TooltipAction);
|
226 | registerAction('sibling-tooltip', SiblingTooltip);
|
227 | registerAction('ellipsis-text', EllipsisTextAction);
|
228 | registerAction('element-active', ElementActive);
|
229 | registerAction('element-single-active', ElementSingleActive);
|
230 | registerAction('element-range-active', ElementRangeActive);
|
231 |
|
232 | registerAction('element-highlight', ElementHighlight);
|
233 | registerAction('element-highlight-by-x', ElementHighlightByX);
|
234 | registerAction('element-highlight-by-color', ElementHighlightByColor);
|
235 |
|
236 | registerAction('element-single-highlight', ElementSingleHighlight);
|
237 | registerAction('element-range-highlight', ElementRangeHighlight);
|
238 | registerAction('element-sibling-highlight', ElementRangeHighlight, {
|
239 | effectSiblings: true,
|
240 | effectByRecord: true,
|
241 | });
|
242 |
|
243 | registerAction('element-selected', ElementSelected);
|
244 | registerAction('element-single-selected', ElementSingleSelected);
|
245 | registerAction('element-range-selected', ElementRangeSelected);
|
246 | registerAction('element-link-by-color', ElementLinkByColor);
|
247 |
|
248 | registerAction('active-region', ActiveRegion);
|
249 | registerAction('list-active', ListActive);
|
250 | registerAction('list-selected', ListSelected);
|
251 | registerAction('list-highlight', ListHighlight);
|
252 | registerAction('list-unchecked', ListUnchecked);
|
253 | registerAction('list-checked', ListChecked);
|
254 | registerAction('list-focus', ListFocus);
|
255 | registerAction('list-radio', ListRadio);
|
256 |
|
257 | registerAction('legend-item-highlight', ListHighlight, {
|
258 | componentNames: ['legend'],
|
259 | });
|
260 |
|
261 | registerAction('axis-label-highlight', ListHighlight, {
|
262 | componentNames: ['axis'],
|
263 | });
|
264 | registerAction('axis-description', AxisDescription)
|
265 |
|
266 | registerAction('rect-mask', RectMask);
|
267 | registerAction('x-rect-mask', DimMask, { dim: 'x' });
|
268 | registerAction('y-rect-mask', DimMask, { dim: 'y' });
|
269 | registerAction('circle-mask', CircleMask);
|
270 | registerAction('path-mask', PathMask);
|
271 | registerAction('smooth-path-mask', SmoothPathMask);
|
272 |
|
273 | registerAction('cursor', CursorAction);
|
274 | registerAction('data-filter', DataFilter);
|
275 |
|
276 | registerAction('brush', DataRangeFilter);
|
277 | registerAction('brush-x', DataRangeFilter, { dims: ['x'] });
|
278 | registerAction('brush-y', DataRangeFilter, { dims: ['y'] });
|
279 | registerAction('sibling-filter', SiblingFilter);
|
280 | registerAction('sibling-x-filter', SiblingFilter);
|
281 | registerAction('sibling-y-filter', SiblingFilter);
|
282 |
|
283 | registerAction('element-filter', ElementFilter);
|
284 | registerAction('element-sibling-filter', ElementSiblingFilter);
|
285 | registerAction('element-sibling-filter-record', ElementSiblingFilter, { byRecord: true });
|
286 |
|
287 | registerAction('view-drag', ViewDrag);
|
288 | registerAction('view-move', ViewMove);
|
289 |
|
290 | registerAction('scale-translate', ScaleTranslate);
|
291 | registerAction('scale-zoom', ScaleZoom);
|
292 | registerAction('reset-button', ButtonAction, {
|
293 | name: 'reset-button',
|
294 | text: 'reset',
|
295 | });
|
296 |
|
297 | registerAction('mousewheel-scroll', MousewheelScroll);
|
298 |
|
299 |
|
300 | import { registerInteraction } from './core';
|
301 |
|
302 | function isPointInView(context: IInteractionContext) {
|
303 | return context.isInPlot();
|
304 | }
|
305 |
|
306 |
|
307 | registerInteraction('tooltip', {
|
308 | start: [
|
309 | { trigger: 'plot:mousemove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } },
|
310 | { trigger: 'plot:touchmove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } },
|
311 | ],
|
312 | end: [
|
313 | { trigger: 'plot:mouseleave', action: 'tooltip:hide' },
|
314 | { trigger: 'plot:leave', action: 'tooltip:hide' },
|
315 | { trigger: 'plot:touchend', action: 'tooltip:hide' },
|
316 | ],
|
317 | });
|
318 |
|
319 | registerInteraction('ellipsis-text', {
|
320 | start: [
|
321 | {
|
322 | trigger: 'legend-item-name:mousemove',
|
323 | action: 'ellipsis-text:show',
|
324 | throttle: { wait: 50, leading: true, trailing: false },
|
325 | },
|
326 | {
|
327 | trigger: 'legend-item-name:touchstart',
|
328 | action: 'ellipsis-text:show',
|
329 | throttle: { wait: 50, leading: true, trailing: false },
|
330 | },
|
331 | {
|
332 | trigger: 'axis-label:mousemove',
|
333 | action: 'ellipsis-text:show',
|
334 | throttle: { wait: 50, leading: true, trailing: false },
|
335 | },
|
336 | {
|
337 | trigger: 'axis-label:touchstart',
|
338 | action: 'ellipsis-text:show',
|
339 | throttle: { wait: 50, leading: true, trailing: false },
|
340 | },
|
341 | ],
|
342 | end: [
|
343 | { trigger: 'legend-item-name:mouseleave', action: 'ellipsis-text:hide' },
|
344 | { trigger: 'legend-item-name:touchend', action: 'ellipsis-text:hide' },
|
345 | { trigger: 'axis-label:mouseleave', action: 'ellipsis-text:hide' },
|
346 | { trigger: 'axis-label:mouseout', action: 'ellipsis-text:hide' },
|
347 | { trigger: 'axis-label:touchend', action: 'ellipsis-text:hide' },
|
348 | ],
|
349 | });
|
350 |
|
351 |
|
352 | registerInteraction('element-active', {
|
353 | start: [{ trigger: 'element:mouseenter', action: 'element-active:active' }],
|
354 | end: [{ trigger: 'element:mouseleave', action: 'element-active:reset' }],
|
355 | });
|
356 |
|
357 |
|
358 | registerInteraction('element-selected', {
|
359 | start: [{ trigger: 'element:click', action: 'element-selected:toggle' }],
|
360 | });
|
361 |
|
362 |
|
363 | registerInteraction('element-highlight', {
|
364 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight:highlight' }],
|
365 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight:reset' }],
|
366 | });
|
367 |
|
368 |
|
369 | registerInteraction('element-highlight-by-x', {
|
370 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight-by-x:highlight' }],
|
371 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight-by-x:reset' }],
|
372 | });
|
373 |
|
374 |
|
375 | registerInteraction('element-highlight-by-color', {
|
376 | start: [{ trigger: 'element:mouseenter', action: 'element-highlight-by-color:highlight' }],
|
377 | end: [{ trigger: 'element:mouseleave', action: 'element-highlight-by-color:reset' }],
|
378 | });
|
379 |
|
380 |
|
381 | registerInteraction('legend-active', {
|
382 | start: [{ trigger: 'legend-item:mouseenter', action: ['list-active:active', 'element-active:active'] }],
|
383 | end: [{ trigger: 'legend-item:mouseleave', action: ['list-active:reset', 'element-active:reset'] }],
|
384 | });
|
385 |
|
386 |
|
387 | registerInteraction('legend-highlight', {
|
388 | start: [
|
389 | { trigger: 'legend-item:mouseenter', action: ['legend-item-highlight:highlight', 'element-highlight:highlight'] },
|
390 | ],
|
391 | end: [{ trigger: 'legend-item:mouseleave', action: ['legend-item-highlight:reset', 'element-highlight:reset'] }],
|
392 | });
|
393 |
|
394 |
|
395 | registerInteraction('axis-label-highlight', {
|
396 | start: [
|
397 | { trigger: 'axis-label:mouseenter', action: ['axis-label-highlight:highlight', 'element-highlight:highlight'] },
|
398 | ],
|
399 | end: [{ trigger: 'axis-label:mouseleave', action: ['axis-label-highlight:reset', 'element-highlight:reset'] }],
|
400 | });
|
401 |
|
402 |
|
403 | registerInteraction('element-list-highlight', {
|
404 | start: [{ trigger: 'element:mouseenter', action: ['list-highlight:highlight', 'element-highlight:highlight'] }],
|
405 | end: [{ trigger: 'element:mouseleave', action: ['list-highlight:reset', 'element-highlight:reset'] }],
|
406 | });
|
407 |
|
408 |
|
409 | registerInteraction('element-range-highlight', {
|
410 | showEnable: [
|
411 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
412 | { trigger: 'mask:mouseenter', action: 'cursor:move' },
|
413 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
414 | { trigger: 'mask:mouseleave', action: 'cursor:crosshair' },
|
415 | ],
|
416 | start: [
|
417 | {
|
418 | trigger: 'plot:mousedown',
|
419 | isEnable(context) {
|
420 |
|
421 | return !context.isInShape('mask');
|
422 | },
|
423 | action: ['rect-mask:start', 'rect-mask:show'],
|
424 | },
|
425 | {
|
426 | trigger: 'mask:dragstart',
|
427 | action: ['rect-mask:moveStart'],
|
428 | },
|
429 | ],
|
430 | processing: [
|
431 | {
|
432 | trigger: 'plot:mousemove',
|
433 | action: ['rect-mask:resize'],
|
434 | },
|
435 | {
|
436 | trigger: 'mask:drag',
|
437 | action: ['rect-mask:move'],
|
438 | },
|
439 | {
|
440 | trigger: 'mask:change',
|
441 | action: ['element-range-highlight:highlight'],
|
442 | },
|
443 | ],
|
444 | end: [
|
445 | { trigger: 'plot:mouseup', action: ['rect-mask:end'] },
|
446 | { trigger: 'mask:dragend', action: ['rect-mask:moveEnd'] },
|
447 | {
|
448 | trigger: 'document:mouseup',
|
449 | isEnable(context) {
|
450 | return !context.isInPlot();
|
451 | },
|
452 | action: ['element-range-highlight:clear', 'rect-mask:end', 'rect-mask:hide'],
|
453 | },
|
454 | ],
|
455 | rollback: [{ trigger: 'dblclick', action: ['element-range-highlight:clear', 'rect-mask:hide'] }],
|
456 | });
|
457 |
|
458 | registerInteraction('brush', {
|
459 | showEnable: [
|
460 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
461 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
462 | ],
|
463 | start: [
|
464 | {
|
465 | trigger: 'mousedown',
|
466 | isEnable: isPointInView,
|
467 | action: ['brush:start', 'rect-mask:start', 'rect-mask:show'],
|
468 | },
|
469 | ],
|
470 | processing: [
|
471 | {
|
472 | trigger: 'mousemove',
|
473 | isEnable: isPointInView,
|
474 | action: ['rect-mask:resize'],
|
475 | },
|
476 | ],
|
477 | end: [
|
478 | {
|
479 | trigger: 'mouseup',
|
480 | isEnable: isPointInView,
|
481 | action: ['brush:filter', 'brush:end', 'rect-mask:end', 'rect-mask:hide', 'reset-button:show'],
|
482 | },
|
483 | ],
|
484 | rollback: [{ trigger: 'reset-button:click', action: ['brush:reset', 'reset-button:hide', 'cursor:crosshair'] }],
|
485 | });
|
486 |
|
487 | registerInteraction('brush-visible', {
|
488 | showEnable: [
|
489 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
490 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
491 | ],
|
492 | start: [
|
493 | {
|
494 | trigger: 'plot:mousedown',
|
495 | action: ['rect-mask:start', 'rect-mask:show'],
|
496 | },
|
497 | ],
|
498 | processing: [
|
499 | {
|
500 | trigger: 'plot:mousemove',
|
501 | action: ['rect-mask:resize'],
|
502 | },
|
503 | { trigger: 'mask:change', action: ['element-range-highlight:highlight'] },
|
504 | ],
|
505 | end: [
|
506 | {
|
507 | trigger: 'plot:mouseup',
|
508 | action: ['rect-mask:end', 'rect-mask:hide', 'element-filter:filter', 'element-range-highlight:clear'],
|
509 | },
|
510 | ],
|
511 | rollback: [
|
512 | {
|
513 | trigger: 'dblclick',
|
514 | action: ['element-filter:clear'],
|
515 | },
|
516 | ],
|
517 | });
|
518 |
|
519 | registerInteraction('brush-x', {
|
520 | showEnable: [
|
521 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
522 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
523 | ],
|
524 | start: [
|
525 | {
|
526 | trigger: 'mousedown',
|
527 | isEnable: isPointInView,
|
528 | action: ['brush-x:start', 'x-rect-mask:start', 'x-rect-mask:show'],
|
529 | },
|
530 | ],
|
531 | processing: [
|
532 | {
|
533 | trigger: 'mousemove',
|
534 | isEnable: isPointInView,
|
535 | action: ['x-rect-mask:resize'],
|
536 | },
|
537 | ],
|
538 | end: [
|
539 | {
|
540 | trigger: 'mouseup',
|
541 | isEnable: isPointInView,
|
542 | action: ['brush-x:filter', 'brush-x:end', 'x-rect-mask:end', 'x-rect-mask:hide'],
|
543 | },
|
544 | ],
|
545 | rollback: [{ trigger: 'dblclick', action: ['brush-x:reset'] }],
|
546 | });
|
547 |
|
548 | registerInteraction('element-path-highlight', {
|
549 | showEnable: [
|
550 | { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
|
551 | { trigger: 'plot:mouseleave', action: 'cursor:default' },
|
552 | ],
|
553 | start: [
|
554 | { trigger: 'mousedown', isEnable: isPointInView, action: 'path-mask:start' },
|
555 | { trigger: 'mousedown', isEnable: isPointInView, action: 'path-mask:show' },
|
556 | ],
|
557 | processing: [{ trigger: 'mousemove', action: 'path-mask:addPoint' }],
|
558 | end: [{ trigger: 'mouseup', action: 'path-mask:end' }],
|
559 | rollback: [{ trigger: 'dblclick', action: 'path-mask:hide' }],
|
560 | });
|
561 |
|
562 |
|
563 | registerInteraction('element-single-selected', {
|
564 | start: [{ trigger: 'element:click', action: 'element-single-selected:toggle' }],
|
565 | });
|
566 |
|
567 |
|
568 | registerInteraction('legend-filter', {
|
569 | showEnable: [
|
570 | { trigger: 'legend-item:mouseenter', action: ['cursor:pointer', 'list-radio:show'] },
|
571 | { trigger: 'legend-item:mouseleave', action: ['cursor:default', 'list-radio:hide'] },
|
572 | ],
|
573 | start: [
|
574 | {
|
575 | trigger: 'legend-item:click',
|
576 | isEnable: (context) => {
|
577 | return !context.isInShape('legend-item-radio');
|
578 | },
|
579 | action: ['list-unchecked:toggle', 'data-filter:filter', 'list-radio:show'],
|
580 | },
|
581 |
|
582 | {
|
583 | trigger: 'legend-item-radio:mouseenter',
|
584 | action: ['list-radio:showTip'],
|
585 | },
|
586 | {
|
587 | trigger: 'legend-item-radio:mouseleave',
|
588 | action: ['list-radio:hideTip'],
|
589 | },
|
590 | {
|
591 | trigger: 'legend-item-radio:click',
|
592 | action: ['list-focus:toggle', 'data-filter:filter', 'list-radio:show'],
|
593 | },
|
594 | ],
|
595 | });
|
596 |
|
597 |
|
598 | registerInteraction('continuous-filter', {
|
599 | start: [{ trigger: 'legend:valuechanged', action: 'data-filter:filter' }],
|
600 | });
|
601 |
|
602 | registerInteraction('continuous-visible-filter', {
|
603 | start: [{ trigger: 'legend:valuechanged', action: 'element-filter:filter' }],
|
604 | });
|
605 |
|
606 |
|
607 | registerInteraction('legend-visible-filter', {
|
608 | showEnable: [
|
609 | { trigger: 'legend-item:mouseenter', action: 'cursor:pointer' },
|
610 | { trigger: 'legend-item:mouseleave', action: 'cursor:default' },
|
611 | ],
|
612 | start: [{ trigger: 'legend-item:click', action: ['list-unchecked:toggle', 'element-filter:filter'] }],
|
613 | });
|
614 |
|
615 |
|
616 | registerInteraction('active-region', {
|
617 | start: [{ trigger: 'plot:mousemove', action: 'active-region:show' }],
|
618 | end: [{ trigger: 'plot:mouseleave', action: 'active-region:hide' }],
|
619 | });
|
620 |
|
621 |
|
622 | registerInteraction('axis-description', {
|
623 | start: [{ trigger: 'axis-description:mousemove', action: 'axis-description:show' }],
|
624 | end: [{ trigger: 'axis-description:mouseleave', action: 'axis-description:hide' }]
|
625 | })
|
626 |
|
627 | function isWheelDown(event) {
|
628 | event.gEvent.preventDefault();
|
629 | return event.gEvent.originalEvent.deltaY > 0;
|
630 | }
|
631 | registerInteraction('view-zoom', {
|
632 | start: [
|
633 | {
|
634 | trigger: 'plot:mousewheel',
|
635 | isEnable(context) {
|
636 | return isWheelDown(context.event);
|
637 | },
|
638 | action: 'scale-zoom:zoomOut',
|
639 | throttle: { wait: 100, leading: true, trailing: false },
|
640 | },
|
641 | {
|
642 | trigger: 'plot:mousewheel',
|
643 | isEnable(context) {
|
644 | return !isWheelDown(context.event);
|
645 | },
|
646 | action: 'scale-zoom:zoomIn',
|
647 | throttle: { wait: 100, leading: true, trailing: false },
|
648 | },
|
649 | ],
|
650 | });
|
651 |
|
652 | registerInteraction('sibling-tooltip', {
|
653 | start: [{ trigger: 'plot:mousemove', action: 'sibling-tooltip:show' }],
|
654 | end: [{ trigger: 'plot:mouseleave', action: 'sibling-tooltip:hide' }],
|
655 | });
|
656 |
|
657 | registerInteraction('plot-mousewheel-scroll', {
|
658 | start: [{ trigger: 'plot:mousewheel', action: 'mousewheel-scroll:scroll' }],
|
659 | });
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 | declare module './chart/view' {
|
669 | interface View {
|
670 | |
671 |
|
672 |
|
673 |
|
674 |
|
675 | polygon(cfg?: Partial<GeometryCfg>): Polygon;
|
676 | |
677 |
|
678 |
|
679 |
|
680 |
|
681 | point(cfg?: Partial<GeometryCfg>): Point;
|
682 | |
683 |
|
684 |
|
685 |
|
686 |
|
687 | interval(cfg?: Partial<IntervalCfg>): Interval;
|
688 | |
689 |
|
690 |
|
691 |
|
692 |
|
693 | schema(cfg?: Partial<GeometryCfg>): Schema;
|
694 | |
695 |
|
696 |
|
697 |
|
698 |
|
699 | path(cfg?: Partial<PathCfg>): Path;
|
700 | |
701 |
|
702 |
|
703 |
|
704 |
|
705 | line(cfg?: Partial<PathCfg>): Line;
|
706 | |
707 |
|
708 |
|
709 |
|
710 |
|
711 | area(cfg?: Partial<AreaCfg>): Area;
|
712 | |
713 |
|
714 |
|
715 |
|
716 |
|
717 | edge(cfg?: Partial<GeometryCfg>): Edge;
|
718 | |
719 |
|
720 |
|
721 |
|
722 |
|
723 | heatmap(cfg?: Partial<GeometryCfg>): Heatmap;
|
724 | |
725 |
|
726 |
|
727 |
|
728 |
|
729 | violin(cfg?: Partial<GeometryCfg>): Violin;
|
730 | }
|
731 | }
|
732 |
|
733 |
|
734 | export { VIEW_LIFE_CIRCLE } from './constant';
|
735 |
|
736 | export { BRUSH_FILTER_EVENTS, ELEMENT_RANGE_HIGHLIGHT_EVENTS };
|
737 |
|
738 | export * from './core';
|