UNPKG

24.7 kBPlain TextView Raw
1import { GeometryCfg } from './geometry/base';
2import { PathCfg } from './geometry/path';
3import { IInteractionContext } from './interface';
4
5// 注册黑暗主题
6import { registerTheme } from './core';
7import { antvDark } from './theme/style-sheet/dark';
8import { createThemeByStyleSheet } from './theme/util/create-by-style-sheet';
9registerTheme('dark', createThemeByStyleSheet(antvDark));
10
11// 注册 G 渲染引擎
12import * as CanvasEngine from '@antv/g-canvas';
13import * as SVGEngine from '@antv/g-svg';
14import { registerEngine } from './core';
15
16registerEngine('canvas', CanvasEngine);
17registerEngine('svg', SVGEngine);
18
19// 注册 G2 内置的 geometry
20import { registerGeometry } from './core';
21import Area, { AreaCfg } from './geometry/area';
22import Edge from './geometry/edge';
23import Heatmap from './geometry/heatmap';
24import Interval from './geometry/interval';
25import Line from './geometry/line';
26import Path from './geometry/path';
27import Point from './geometry/point';
28import Polygon from './geometry/polygon';
29import Schema from './geometry/schema';
30
31registerGeometry('Polygon', Polygon);
32registerGeometry('Interval', Interval);
33registerGeometry('Schema', Schema);
34registerGeometry('Path', Path);
35registerGeometry('Point', Point);
36registerGeometry('Line', Line);
37registerGeometry('Area', Area);
38registerGeometry('Edge', Edge);
39registerGeometry('Heatmap', Heatmap);
40
41// 引入所有内置的 shapes
42import './geometry/shape/area/line';
43import './geometry/shape/area/smooth';
44import './geometry/shape/area/smooth-line';
45
46import './geometry/shape/edge/arc';
47import './geometry/shape/edge/smooth';
48import './geometry/shape/edge/vhv';
49
50import './geometry/shape/interval/funnel';
51import './geometry/shape/interval/hollow-rect';
52import './geometry/shape/interval/line';
53import './geometry/shape/interval/pyramid';
54import './geometry/shape/interval/tick';
55
56import './geometry/shape/line/step';
57
58import './geometry/shape/point/hollow';
59import './geometry/shape/point/image';
60import './geometry/shape/point/solid';
61
62import './geometry/shape/schema/box';
63import './geometry/shape/schema/candle';
64
65import './geometry/shape/polygon/square';
66
67// 注册 Geometry 内置的 label
68import { registerGeometryLabel } from './core';
69import GeometryLabel from './geometry/label/base';
70import IntervalLabel from './geometry/label/interval';
71import PieLabel from './geometry/label/pie';
72import PolarLabel from './geometry/label/polar';
73
74registerGeometryLabel('base', GeometryLabel);
75registerGeometryLabel('interval', IntervalLabel);
76registerGeometryLabel('pie', PieLabel);
77registerGeometryLabel('polar', PolarLabel);
78
79// 注册 Geometry label 内置的布局函数
80import { registerGeometryLabelLayout } from './core';
81import { distribute } from './geometry/label/layout/pie/distribute';
82import { pieOuterLabelLayout } from './geometry/label/layout/pie/outer';
83import { pieSpiderLabelLayout } from './geometry/label/layout/pie/spider';
84import { limitInCanvas } from './geometry/label/layout/limit-in-canvas';
85import { limitInShape } from './geometry/label/layout/limit-in-shape';
86import { fixedOverlap, overlap } from './geometry/label/layout/overlap';
87import { hideOverlap } from './geometry/label/layout/hide-overlap';
88import { adjustColor } from './geometry/label/layout/adjust-color';
89import { intervalAdjustPosition } from './geometry/label/layout/interval/adjust-position';
90import { intervalHideOverlap } from './geometry/label/layout/interval/hide-overlap';
91import { pointAdjustPosition } from './geometry/label/layout/point/adjust-position';
92import { pathAdjustPosition } from './geometry/label/layout/path/adjust-position';
93import { limitInPlot } from './geometry/label/layout/limit-in-plot';
94
95registerGeometryLabelLayout('overlap', overlap);
96registerGeometryLabelLayout('distribute', distribute);
97registerGeometryLabelLayout('fixed-overlap', fixedOverlap);
98registerGeometryLabelLayout('hide-overlap', hideOverlap);
99registerGeometryLabelLayout('limit-in-shape', limitInShape);
100registerGeometryLabelLayout('limit-in-canvas', limitInCanvas);
101registerGeometryLabelLayout('limit-in-plot', limitInPlot);
102registerGeometryLabelLayout('pie-outer', pieOuterLabelLayout);
103registerGeometryLabelLayout('adjust-color', adjustColor);
104registerGeometryLabelLayout('interval-adjust-position', intervalAdjustPosition);
105registerGeometryLabelLayout('interval-hide-overlap', intervalHideOverlap);
106registerGeometryLabelLayout('point-adjust-position', pointAdjustPosition);
107registerGeometryLabelLayout('pie-spider', pieSpiderLabelLayout);
108registerGeometryLabelLayout('path-adjust-position', pathAdjustPosition);
109
110// 注册需要的动画执行函数
111import { fadeIn, fadeOut } from './animate/animation/fade';
112import { growInX, growInXY, growInY } from './animate/animation/grow-in';
113import { pathIn } from './animate/animation/path-in';
114import { positionUpdate } from './animate/animation/position-update';
115import { scaleInX, scaleInY } from './animate/animation/scale-in';
116import { sectorPathUpdate } from './animate/animation/sector-path-update';
117import { waveIn } from './animate/animation/wave-in';
118import { zoomIn, zoomOut } from './animate/animation/zoom';
119import { registerAnimation } from './core';
120
121registerAnimation('fade-in', fadeIn);
122registerAnimation('fade-out', fadeOut);
123registerAnimation('grow-in-x', growInX);
124registerAnimation('grow-in-xy', growInXY);
125registerAnimation('grow-in-y', growInY);
126registerAnimation('scale-in-x', scaleInX);
127registerAnimation('scale-in-y', scaleInY);
128registerAnimation('wave-in', waveIn);
129registerAnimation('zoom-in', zoomIn);
130registerAnimation('zoom-out', zoomOut);
131registerAnimation('position-update', positionUpdate);
132registerAnimation('sector-path-update', sectorPathUpdate);
133registerAnimation('path-in', pathIn);
134
135// 注册内置的 Facet
136import { registerFacet } from './core';
137import Circle from './facet/circle';
138import List from './facet/list';
139import Matrix from './facet/matrix';
140import Mirror from './facet/mirror';
141import Rect from './facet/rect';
142import Tree from './facet/tree';
143
144registerFacet('rect', Rect);
145registerFacet('mirror', Mirror);
146registerFacet('list', List);
147registerFacet('matrix', Matrix);
148registerFacet('circle', Circle);
149registerFacet('tree', Tree);
150
151// 注册内置的 Component
152import { registerComponentController } from './core';
153
154import Annotation from './chart/controller/annotation';
155import Axis from './chart/controller/axis';
156import Legend from './chart/controller/legend';
157import Slider from './chart/controller/slider';
158import Tooltip from './chart/controller/tooltip';
159import Scrollbar from './chart/controller/scrollbar';
160
161// register build-in components
162registerComponentController('axis', Axis);
163registerComponentController('legend', Legend);
164registerComponentController('tooltip', Tooltip);
165registerComponentController('annotation', Annotation);
166registerComponentController('slider', Slider);
167registerComponentController('scrollbar', Scrollbar);
168
169// 注册 Interaction Action
170import { registerAction } from './core';
171import ActiveRegion from './interaction/action/active-region';
172import SiblingTooltip from './interaction/action/component/tooltip/sibling';
173import TooltipAction from './interaction/action/component/tooltip/geometry';
174import EllipsisTextAction from './interaction/action/component/tooltip/ellipsis-text';
175
176import ElmentActive from './interaction/action/element/active';
177import ElementLinkByColor from './interaction/action/element/link-by-color';
178import ElmentRangeActive from './interaction/action/element/range-active';
179import ElmentSingleActive from './interaction/action/element/single-active';
180
181import ElmentHighlight from './interaction/action/element/highlight';
182import ElmentHighlightByColor from './interaction/action/element/highlight-by-color';
183import ElmentHighlightByX from './interaction/action/element/highlight-by-x';
184
185import ElmentRangeHighlight from './interaction/action/element/range-highlight';
186import ElmentSingleHighlight from './interaction/action/element/single-highlight';
187
188import ElementRangeSelected from './interaction/action/element/range-selected';
189import ElementSelected from './interaction/action/element/selected';
190import ElementSingleSelected from './interaction/action/element/single-selected';
191
192import ListActive from './interaction/action/component/list-active';
193import ListHighlight from './interaction/action/component/list-highlight';
194import ListSelected from './interaction/action/component/list-selected';
195import ListUnchecked from './interaction/action/component/list-unchecked';
196
197import CircleMask from './interaction/action/mask/circle';
198import DimMask from './interaction/action/mask/dim-rect';
199import PathMask from './interaction/action/mask/path';
200import RectMask from './interaction/action/mask/rect';
201import SmoothPathMask from './interaction/action/mask/smooth-path';
202
203import CursorAction from './interaction/action/cursor';
204import DataFilter from './interaction/action/data/filter';
205import DataRangeFilter from './interaction/action/data/range-filter';
206import SiblingFilter from './interaction/action/data/sibling-filter';
207
208import ElementFilter from './interaction/action/element/filter';
209import ElementSiblingFilter from './interaction/action/element/sibling-filter';
210import ButtonAction from './interaction/action/view/button';
211import ViewDrag from './interaction/action/view/drag';
212import ViewMove from './interaction/action/view/move';
213import ScaleTranslate from './interaction/action/view/scale-translate';
214import ScaleZoom from './interaction/action/view/scale-zoom';
215
216registerAction('tooltip', TooltipAction);
217registerAction('sibling-tooltip', SiblingTooltip);
218registerAction('ellipsis-text', EllipsisTextAction);
219registerAction('element-active', ElmentActive);
220registerAction('element-single-active', ElmentSingleActive);
221registerAction('element-range-active', ElmentRangeActive);
222
223registerAction('element-highlight', ElmentHighlight);
224registerAction('element-highlight-by-x', ElmentHighlightByX);
225registerAction('element-highlight-by-color', ElmentHighlightByColor);
226
227registerAction('element-single-highlight', ElmentSingleHighlight);
228registerAction('element-range-highlight', ElmentRangeHighlight);
229registerAction('element-sibling-highlight', ElmentRangeHighlight, {
230 effectSiblings: true,
231 effectByRecord: true,
232});
233
234registerAction('element-selected', ElementSelected);
235registerAction('element-single-selected', ElementSingleSelected);
236registerAction('element-range-selected', ElementRangeSelected);
237registerAction('element-link-by-color', ElementLinkByColor);
238
239registerAction('active-region', ActiveRegion);
240registerAction('list-active', ListActive);
241registerAction('list-selected', ListSelected);
242registerAction('list-highlight', ListHighlight);
243registerAction('list-unchecked', ListUnchecked);
244
245registerAction('legend-item-highlight', ListHighlight, {
246 componentNames: ['legend'],
247});
248
249registerAction('axis-label-highlight', ListHighlight, {
250 componentNames: ['axis'],
251});
252
253registerAction('rect-mask', RectMask);
254registerAction('x-rect-mask', DimMask, { dim: 'x' });
255registerAction('y-rect-mask', DimMask, { dim: 'y' });
256registerAction('circle-mask', CircleMask);
257registerAction('path-mask', PathMask);
258registerAction('smooth-path-mask', SmoothPathMask);
259
260registerAction('cursor', CursorAction);
261registerAction('data-filter', DataFilter);
262
263registerAction('brush', DataRangeFilter);
264registerAction('brush-x', DataRangeFilter, { dims: ['x'] });
265registerAction('brush-y', DataRangeFilter, { dims: ['y'] });
266registerAction('sibling-filter', SiblingFilter);
267registerAction('sibling-x-filter', SiblingFilter);
268registerAction('sibling-y-filter', SiblingFilter);
269
270registerAction('element-filter', ElementFilter);
271registerAction('element-sibling-filter', ElementSiblingFilter);
272registerAction('element-sibling-filter-record', ElementSiblingFilter, { byRecord: true });
273
274registerAction('view-drag', ViewDrag);
275registerAction('view-move', ViewMove);
276
277registerAction('scale-translate', ScaleTranslate);
278registerAction('scale-zoom', ScaleZoom);
279registerAction('reset-button', ButtonAction, {
280 name: 'reset-button',
281 text: 'reset',
282});
283
284// 注册默认的 Interaction 交互行为
285import { registerInteraction } from './core';
286
287function isPointInView(context: IInteractionContext) {
288 return context.isInPlot();
289}
290
291// 注册 tooltip 的 interaction
292registerInteraction('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
304registerInteraction('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// 移动到 element 上 active
336registerInteraction('element-active', {
337 start: [{ trigger: 'element:mouseenter', action: 'element-active:active' }],
338 end: [{ trigger: 'element:mouseleave', action: 'element-active:reset' }],
339});
340
341// 点击选中,允许取消
342registerInteraction('element-selected', {
343 start: [{ trigger: 'element:click', action: 'element-selected:toggle' }],
344});
345
346// hover highlight,允许取消
347registerInteraction('element-highlight', {
348 start: [{ trigger: 'element:mouseenter', action: 'element-highlight:highlight' }],
349 end: [{ trigger: 'element:mouseleave', action: 'element-highlight:reset' }],
350});
351
352// hover highlight by x,允许取消
353registerInteraction('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// hover highlight by y,允许取消
359registerInteraction('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// legend hover,element active
365registerInteraction('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// legend hover,element active
371registerInteraction('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// legend hover,element active
379registerInteraction('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// legend hover,element active
387registerInteraction('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// 框选
393registerInteraction('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 // 不要点击在 mask 上重新开始
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
442registerInteraction('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
471registerInteraction('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
503registerInteraction('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
532registerInteraction('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// 点击选中,允许取消
547registerInteraction('element-single-selected', {
548 start: [{ trigger: 'element:click', action: 'element-single-selected:toggle' }],
549});
550
551// 筛选数据
552registerInteraction('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// 筛选数据
561registerInteraction('continuous-filter', {
562 start: [{ trigger: 'legend:valuechanged', action: 'data-filter:filter' }],
563});
564// 筛选数据
565registerInteraction('continuous-visible-filter', {
566 start: [{ trigger: 'legend:valuechanged', action: 'element-filter:filter' }],
567});
568
569// 筛选图形
570registerInteraction('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// 出现背景框
579registerInteraction('active-region', {
580 start: [{ trigger: 'plot:mousemove', action: 'active-region:show' }],
581 end: [{ trigger: 'plot:mouseleave', action: 'active-region:hide' }],
582});
583
584function isWheelDown(event) {
585 event.gEvent.preventDefault();
586 return event.gEvent.originalEvent.deltaY > 0;
587}
588registerInteraction('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
609registerInteraction('sibling-tooltip', {
610 start: [{ trigger: 'plot:mousemove', action: 'sibling-tooltip:show' }],
611 end: [{ trigger: 'plot:mouseleave', action: 'sibling-tooltip:hide' }],
612});
613
614// 让 TS 支持 View 原型上添加的创建 Geometry 方法的智能提示
615/**
616 * 往 View 原型上添加的创建 Geometry 的方法
617 *
618 * Tips:
619 * view module augmentation, detail: http://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
620 */
621declare module './chart/view' {
622 interface View {
623 /**
624 * 创建 Polygon 几何标记。
625 * @param [cfg] 传入 Polygon 构造函数的配置。
626 * @returns polygon 返回 Polygon 实例。
627 */
628 polygon(cfg?: Partial<GeometryCfg>): Polygon;
629 /**
630 * 创建 Point 几何标记。
631 * @param [cfg] 传入 Point 构造函数的配置。
632 * @returns point 返回 Point 实例。
633 */
634 point(cfg?: Partial<GeometryCfg>): Point;
635 /**
636 * 创建 Interval 几何标记。
637 * @param [cfg] 传入 Interval 构造函数的配置。
638 * @returns interval 返回 Interval 实例。
639 */
640 interval(cfg?: Partial<GeometryCfg>): Interval;
641 /**
642 * 创建 Schema 几何标记。
643 * @param [cfg] 传入 Schema 构造函数的配置。
644 * @returns schema 返回 Schema 实例。
645 */
646 schema(cfg?: Partial<GeometryCfg>): Schema;
647 /**
648 * 创建 Path 几何标记。
649 * @param [cfg] 传入 Path 构造函数的配置。
650 * @returns path 返回 Path 实例。
651 */
652 path(cfg?: Partial<PathCfg>): Path;
653 /**
654 * 创建 Line 几何标记。
655 * @param [cfg] 传入 Line 构造函数的配置。
656 * @returns line 返回 Line 实例。
657 */
658 line(cfg?: Partial<PathCfg>): Line;
659 /**
660 * 创建 Area 几何标记。
661 * @param [cfg] 传入 Area 构造函数的配置。
662 * @returns area 返回 Area 实例。
663 */
664 area(cfg?: Partial<AreaCfg>): Area;
665 /**
666 * 创建 Edge 几何标记。
667 * @param [cfg] 传入 Edge 构造函数的配置。
668 * @returns schema 返回 Edge 实例。
669 */
670 edge(cfg?: Partial<GeometryCfg>): Edge;
671 /**
672 * 创建 Heatmap 几何标记。
673 * @param [cfg] 传入 Heatmap 构造函数的配置。
674 * @returns heatmap 返回 Heatmap 实例。
675 */
676 heatmap(cfg?: Partial<GeometryCfg>): Heatmap;
677 }
678}
679
680export * from './core';