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