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