1 | import { Adjust } from '@antv/adjust';
|
2 | import { Attribute } from '@antv/attr';
|
3 | import Base from '../base';
|
4 | import { BBox, Coordinate, IGroup, IShape, Scale } from '../dependents';
|
5 | import { AdjustOption, AnimateOption, AttributeOption, ColorAttrCallback, Data, Datum, GeometryLabelCfg, GeometryTooltipOption, LabelCallback, LabelOption, LooseObject, MappingDatum, ScaleOption, ShapeAttrCallback, ShapeFactory, ShapeInfo, ShapeMarkerCfg, ShapeMarkerAttrs, ShapePoint, SizeAttrCallback, StateOption, StyleCallback, StyleOption, TooltipCallback, CustomOption } from '../interface';
|
6 | import Element from './element';
|
7 |
|
8 | export interface InitCfg {
|
9 |
|
10 | coordinate?: Coordinate;
|
11 |
|
12 | data?: Data;
|
13 |
|
14 | theme?: LooseObject;
|
15 |
|
16 | scaleDefs?: Record<string, ScaleOption>;
|
17 |
|
18 | isDataChanged?: boolean;
|
19 | isCoordinateChanged?: boolean;
|
20 | }
|
21 |
|
22 | export interface GeometryCfg {
|
23 |
|
24 | container: IGroup;
|
25 |
|
26 | coordinate?: Coordinate;
|
27 |
|
28 | data?: Data;
|
29 |
|
30 | scales?: Record<string, Scale>;
|
31 |
|
32 | scaleDefs?: Record<string, ScaleOption>;
|
33 |
|
34 | labelsContainer?: IGroup;
|
35 |
|
36 | sortable?: boolean;
|
37 |
|
38 | zIndexReversed?: boolean;
|
39 |
|
40 | visible?: boolean;
|
41 |
|
42 | theme?: LooseObject;
|
43 |
|
44 | intervalPadding?: number;
|
45 |
|
46 | dodgePadding?: number;
|
47 |
|
48 | maxColumnWidth?: number;
|
49 |
|
50 | minColumnWidth?: number;
|
51 |
|
52 | columnWidthRatio?: number;
|
53 |
|
54 | roseWidthRatio?: number;
|
55 |
|
56 | multiplePieWidthRatio?: number;
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 | export default class Geometry<S extends ShapePoint = ShapePoint> extends Base {
|
62 |
|
63 | readonly type: string;
|
64 |
|
65 | readonly shapeType: string;
|
66 |
|
67 | coordinate: Coordinate;
|
68 |
|
69 | data: Data;
|
70 |
|
71 | readonly container: IGroup;
|
72 |
|
73 | readonly labelsContainer: IGroup;
|
74 |
|
75 | sortable: boolean;
|
76 |
|
77 | theme: LooseObject;
|
78 |
|
79 | scales: Record<string, Scale>;
|
80 |
|
81 | scaleDefs: Record<string, ScaleOption>;
|
82 |
|
83 | canvasRegion: BBox;
|
84 |
|
85 | attributes: Record<string, Attribute>;
|
86 |
|
87 | elements: Element[];
|
88 | |
89 |
|
90 |
|
91 |
|
92 |
|
93 | dataArray: MappingDatum[][];
|
94 |
|
95 | tooltipOption: GeometryTooltipOption | boolean;
|
96 |
|
97 | labelOption: LabelOption | false;
|
98 |
|
99 | stateOption: StateOption;
|
100 |
|
101 | elementsMap: Record<string, Element>;
|
102 |
|
103 | animateOption: AnimateOption | boolean;
|
104 |
|
105 | protected attributeOption: Record<string, AttributeOption>;
|
106 |
|
107 | protected adjustOption: AdjustOption[];
|
108 |
|
109 | protected styleOption: StyleOption;
|
110 |
|
111 | protected customOption: CustomOption;
|
112 |
|
113 | protected shapeFactory: ShapeFactory;
|
114 |
|
115 | protected lastElementsMap: Record<string, Element>;
|
116 |
|
117 | protected generatePoints: boolean;
|
118 |
|
119 | protected beforeMappingData: Data[];
|
120 |
|
121 | protected defaultSize: number;
|
122 | private userTheme;
|
123 | private adjusts;
|
124 | private lastAttributeOption;
|
125 | private idFields;
|
126 | private geometryLabel;
|
127 |
|
128 | protected intervalPadding: number;
|
129 |
|
130 | protected dodgePadding: number;
|
131 |
|
132 | protected maxColumnWidth: number;
|
133 |
|
134 | protected minColumnWidth: number;
|
135 |
|
136 | protected columnWidthRatio: number;
|
137 |
|
138 | protected roseWidthRatio: number;
|
139 |
|
140 | protected multiplePieWidthRatio: number;
|
141 |
|
142 | protected zIndexReversed?: boolean;
|
143 |
|
144 | private offscreenGroup;
|
145 | private groupScales;
|
146 | private hasSorted;
|
147 | protected isCoordinateChanged: boolean;
|
148 | |
149 |
|
150 |
|
151 |
|
152 | constructor(cfg: GeometryCfg);
|
153 | /**
|
154 | * 配置 position 通道映射规则。
|
155 | *
|
156 | * @example
|
157 | * ```typescript
|
158 | * // 数据结构: [{ x: 'A', y: 10, color: 'red' }]
|
159 | * geometry.position('x*y');
|
160 | * geometry.position([ 'x', 'y' ]);
|
161 | * geometry.position({
|
162 | * fields: [ 'x', 'y' ],
|
163 | * });
|
164 | * ```
|
165 | *
|
166 | * @param cfg 映射规则
|
167 | * @returns
|
168 | */
|
169 | position(cfg: string | string[] | AttributeOption): Geometry;
|
170 | /**
|
171 | * 配置 color 通道映射规则。
|
172 | *
|
173 | * @example
|
174 | * ```typescript
|
175 | *
|
176 | * geometry.color({
|
177 | * fields: [ 'x' ],
|
178 | * values: [ '#1890ff', '#5AD8A6' ],
|
179 | * });
|
180 | * ```
|
181 | *
|
182 | * @param field 映射规则
|
183 | * @returns
|
184 | */
|
185 | color(field: AttributeOption): Geometry;
|
186 | /**
|
187 | * @example
|
188 | * ```typescript
|
189 | *
|
190 | *
|
191 | *
|
192 | * geometry.color('#1890ff');
|
193 | *
|
194 | *
|
195 | * geometry.color('x');
|
196 | *
|
197 | *
|
198 | * geometry.color('x', [ '#1890ff', '#5AD8A6' ]);
|
199 | *
|
200 | *
|
201 | * geometry.color('x', (xVal) => {
|
202 | * if (xVal === 'a') {
|
203 | * return 'red';
|
204 | * }
|
205 | * return 'blue';
|
206 | * });
|
207 | *
|
208 | *
|
209 | * geometry.color('x', '#BAE7FF-#1890FF-#0050B3');
|
210 | * ```
|
211 | *
|
212 | * @param field 参与颜色映射的数据字段,多个字段使用 '*' 连接符进行连接。
|
213 | * @param cfg Optional, color 映射规则。
|
214 | * @returns
|
215 | */
|
216 | color(field: string, cfg?: string | string[] | ColorAttrCallback): Geometry;
|
217 | /**
|
218 | * 配置 shape 通道映射规则。
|
219 | *
|
220 | * @example
|
221 | *
|
222 | * ```typescript
|
223 | *
|
224 | * geometry.shape({
|
225 | * fields: [ 'x' ],
|
226 | * });
|
227 | * ```
|
228 | *
|
229 | * @param field 映射规则配置。
|
230 | * @returns
|
231 | */
|
232 | shape(field: AttributeOption): Geometry;
|
233 | /**
|
234 | *
|
235 | * @example
|
236 | * ```typescript
|
237 | *
|
238 | *
|
239 | *
|
240 | * geometry.shape('circle');
|
241 | *
|
242 | *
|
243 | * geometry.shape('x');
|
244 | *
|
245 | *
|
246 | * geometry.shape('x', [ 'circle', 'diamond', 'square' ]);
|
247 | *
|
248 | *
|
249 | * geometry.shape('x', (xVal) => {
|
250 | * if (xVal === 'a') {
|
251 | * return 'circle';
|
252 | * }
|
253 | * return 'diamond';
|
254 | * });
|
255 | * ```
|
256 | *
|
257 | * @param field 参与 shape 映射的数据字段,多个字段使用 '*' 连接符进行连接。
|
258 | * @param cfg Optional, shape 映射规则。
|
259 | * @returns
|
260 | */
|
261 | shape(field: string, cfg?: string[] | ShapeAttrCallback): Geometry;
|
262 | /**
|
263 | * 配置 size 通道映射规则。
|
264 | *
|
265 | * @example
|
266 | * ```typescript
|
267 | *
|
268 | * geometry.size({
|
269 | * values: [ 10 ],
|
270 | * })
|
271 | * ```
|
272 | *
|
273 | * @param field 映射规则。
|
274 | * @returns
|
275 | */
|
276 | size(field: AttributeOption): Geometry;
|
277 | /**
|
278 | *
|
279 | * @example
|
280 | * ```typescript
|
281 | *
|
282 | *
|
283 | *
|
284 | * geometry.size(10);
|
285 | *
|
286 | *
|
287 | * geometry.size('x');
|
288 | *
|
289 | *
|
290 | * geometry.size('x', [ 5, 30 ]);
|
291 | *
|
292 | *
|
293 | * geometry.size('x', (xVal) => {
|
294 | * if (xVal === 'a') {
|
295 | * return 10;
|
296 | * }
|
297 | * return 5;
|
298 | * });
|
299 | * ```
|
300 | *
|
301 | * @param field 参与 size 映射的数据字段,多个字段使用 '*' 连接符进行连接。
|
302 | * @param cfg Optional, size 映射规则
|
303 | * @returns
|
304 | */
|
305 | size(field: number | string, cfg?: [number, number] | SizeAttrCallback): Geometry;
|
306 | /**
|
307 | * 设置数据调整方式。G2 目前内置了四种类型:
|
308 | * 1. dodge
|
309 | * 2. stack
|
310 | * 3. symmetric
|
311 | * 4. jitter
|
312 | *
|
313 | *
|
314 | * **Tip**
|
315 | * + 对于 'dodge' 类型,可以额外进行如下属性的配置:
|
316 | * ```typescript
|
317 | * geometry.adjust('dodge', {
|
318 | * marginRatio: 0,
|
319 | * dodgeBy: 'x',
|
320 | * });
|
321 | * ```
|
322 | *
|
323 | * + 对于 'stack' 类型,可以额外进行如下属性的配置:
|
324 | * ```typescript
|
325 | * geometry.adjust('stack', {
|
326 | * reverseOrder: false,
|
327 | * });
|
328 | * ```
|
329 | *
|
330 | * @example
|
331 | * ```typescript
|
332 | * geometry.adjust('stack');
|
333 | *
|
334 | * geometry.adjust({
|
335 | * type: 'stack',
|
336 | * reverseOrder: false,
|
337 | * });
|
338 | *
|
339 | *
|
340 | * geometry.adjust([ 'stack', 'dodge' ]);
|
341 | *
|
342 | * geometry.adjust([
|
343 | * { type: 'stack' },
|
344 | * { type: 'dodge', dodgeBy: 'x' },
|
345 | * ]);
|
346 | * ```
|
347 | *
|
348 | * @param adjustCfg 数据调整配置
|
349 | * @returns
|
350 | */
|
351 | adjust(adjustCfg: string | string[] | AdjustOption | AdjustOption[]): Geometry;
|
352 | /**
|
353 | * 图形样式配置。
|
354 | *
|
355 | * @example
|
356 | * ```typescript
|
357 | *
|
358 | * style({
|
359 | * lineWidth: 2,
|
360 | * stroke: '#1890ff',
|
361 | * });
|
362 | *
|
363 | *
|
364 | * style({
|
365 | * fields: [ 'x', 'y' ],
|
366 | * callback: (xVal, yVal) => {
|
367 | * const style = { lineWidth: 2, stroke: '#1890ff' };
|
368 | * if (xVal === 'a') {
|
369 | * style.lineDash = [ 2, 2 ];
|
370 | * }
|
371 | * return style;
|
372 | * },
|
373 | * });
|
374 | * ```
|
375 | *
|
376 | * @param field 配置样式属性或者样式规则。
|
377 | * @returns
|
378 | */
|
379 | style(field: StyleOption | LooseObject): Geometry;
|
380 | /**
|
381 | * @example
|
382 | * ```typescript
|
383 | * style('x*y', (xVal, yVal) => {
|
384 | * const style = { lineWidth: 2, stroke: '#1890ff' };
|
385 | * if (xVal === 'a') {
|
386 | * style.lineDash = [ 2, 2 ];
|
387 | * }
|
388 | * return style;
|
389 | * });
|
390 | * ```
|
391 | *
|
392 | * @param field 数据字段或者样式配置规则。
|
393 | * @param styleFunc Optional, 样式配置回调函数。
|
394 | * @returns
|
395 | */
|
396 | style(field: string, styleFunc: StyleCallback): Geometry;
|
397 | /**
|
398 | * 配置 Geometry 显示的 tooltip 内容。
|
399 | *
|
400 | * `tooltip(false)` 代表关闭 tooltip。
|
401 | * `tooltip(true)` 代表开启 tooltip。
|
402 | *
|
403 | * Geometry 默认允许 tooltip 展示,我们可以使用以下方法对 tooltip 的展示内容进行配置:
|
404 | *
|
405 | * @example
|
406 | * ```typescript
|
407 | *
|
408 | * tooltip({
|
409 | * fields: [ 'x' ],
|
410 | * });
|
411 | * ```
|
412 | * ![](https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*268uQ50if60AAAAAAAAAAABkARQnAQ)
|
413 | *
|
414 | * ```typescript
|
415 | * tooltip({
|
416 | * fields: [ 'x', 'y' ],
|
417 | * });
|
418 | * ```
|
419 | * ![](https://gw.alipayobjects.com/mdn/rms_2274c3/afts/img/A*A_ujSa8QhtcAAAAAAAAAAABkARQnAQ)
|
420 | *
|
421 | * tooltip() 方法同样支持数据映射及回调用法:
|
422 | *
|
423 | * @example
|
424 | * ```typescript
|
425 | * chart.tooltip({
|
426 | * itemTpl: '<li>{x}: {y}</li>',
|
427 | * });
|
428 | *
|
429 | * chart.line()
|
430 | * .position('x*y')
|
431 | * .tooltip({
|
432 | * fields: [ 'x', 'y' ],
|
433 | * callback: (x, y) => {
|
434 | * return {
|
435 | * x,
|
436 | * y,
|
437 | * };
|
438 | * },
|
439 | * });
|
440 | * ```
|
441 | *
|
442 | * 其返回的值必须为对象,该值中的属性同 chart.tooltip() 的 itemTpl 模板相对应,返回的变量可用于 itemTpl 的字符串模板。
|
443 | *
|
444 | * @param field tooltip 配置信息。
|
445 | * @returns
|
446 | */
|
447 | tooltip(field: GeometryTooltipOption | boolean): Geometry;
|
448 | /**
|
449 | * @example
|
450 | * ```typescript
|
451 | *
|
452 | *
|
453 | *
|
454 | * tooltip('x');
|
455 | *
|
456 | *
|
457 | * tooltip('x*y');
|
458 | *
|
459 | *
|
460 | * tooltip('x*y', (x, y) => {
|
461 | * return {
|
462 | * x,
|
463 | * y,
|
464 | * };
|
465 | * });
|
466 | * ```
|
467 | *
|
468 | * @param field 参与映射的字段。
|
469 | * @param cfg Optional, 回调函数
|
470 | * @returns
|
471 | */
|
472 | tooltip(field: string, cfg?: TooltipCallback): Geometry;
|
473 | /**
|
474 | * Geometry 动画配置。
|
475 | *
|
476 | * + `animate(false)` 关闭动画
|
477 | * + `animate(true)` 开启动画,默认开启。
|
478 | *
|
479 | * 我们将动画分为四个场景:
|
480 | * 1. appear: 图表第一次加载时的入场动画;
|
481 | * 2. enter: 图表绘制完成,发生更新后,产生的新图形的进场动画;
|
482 | * 3. update: 图表绘制完成,数据发生变更后,有状态变更的图形的更新动画;
|
483 | * 4. leave: 图表绘制完成,数据发生变更后,被销毁图形的销毁动画。
|
484 | *
|
485 | * @example
|
486 | * ```typescript
|
487 | * animate({
|
488 | * enter: {
|
489 | * duration: 1000,
|
490 | * },
|
491 | * leave: false,
|
492 | * });
|
493 | * ```
|
494 | *
|
495 | * @param cfg 动画配置
|
496 | * @returns
|
497 | */
|
498 | animate(cfg: AnimateOption | boolean): Geometry;
|
499 | /**
|
500 | * Geometry label 配置。
|
501 | *
|
502 | * @example
|
503 | * ```ts
|
504 | *
|
505 | *
|
506 | * label({
|
507 | * fields: [ 'z' ]
|
508 | * });
|
509 | *
|
510 | * label(false);
|
511 | *
|
512 | *
|
513 | * label('x', {
|
514 | * style: {
|
515 | * fill: 'red',
|
516 | * },
|
517 | * })
|
518 | *
|
519 | *
|
520 | * label('x', (xValue) => {
|
521 | * return {
|
522 | * content: xValue + '%',
|
523 | * };
|
524 | * }, {
|
525 | * type: 'base'
|
526 | * })
|
527 | * ```
|
528 | *
|
529 | * @param field
|
530 | * @returns label
|
531 | */
|
532 | label(field: LabelOption | false | string): Geometry;
|
533 | label(field: string, secondParam: GeometryLabelCfg | LabelCallback): Geometry;
|
534 | label(field: string, secondParam: LabelCallback, thirdParam: GeometryLabelCfg): Geometry;
|
535 | /**
|
536 | * 设置状态对应的样式。
|
537 | *
|
538 | * @example
|
539 | * ```ts
|
540 | * chart.interval().state({
|
541 | * selected: {
|
542 | * animate: { duration: 100, easing: 'easeLinear' },
|
543 | * style: {
|
544 | * lineWidth: 2,
|
545 | * stroke: '#000',
|
546 | * },
|
547 | * },
|
548 | * });
|
549 | * ```
|
550 | *
|
551 | * 如果图形 shape 是由多个 shape 组成,即为一个 G.Group 对象,那么针对 group 中的每个 shape,我们需要使用下列方式进行状态样式设置:
|
552 | * 如果我们为 group 中的每个 shape 设置了 'name' 属性(shape.set('name', 'xx')),则以 'name' 作为 key,否则默认以索引值(即 shape 的 添加顺序)为 key。
|
553 | *
|
554 | * ```ts
|
555 | * chart.interval().shape('groupShape').state({
|
556 | * selected: {
|
557 | * style: {
|
558 | * 0: { lineWidth: 2 },
|
559 | * 1: { fillOpacity: 1 },
|
560 | * }
|
561 | * }
|
562 | * });
|
563 | * ```
|
564 | *
|
565 | * @param cfg 状态样式
|
566 | */
|
567 | state(cfg: StateOption): this;
|
568 | /**
|
569 | * 用于向 shape 中传入自定义的数据。目前可能仅仅可能用于在自定义 shape 的时候,像自定义 shape 中传入自定义的数据,方便实现自定义 shape 的配置能力。
|
570 | *
|
571 | * @example
|
572 | * ```ts
|
573 | * chart.interval().customInfo({ yourData: 'hello, g2!' });
|
574 | * ```
|
575 | *
|
576 | * 然后在自定义 shape 的时候,可以拿到这个信息。
|
577 | *
|
578 | * ```ts
|
579 | * registerShape('interval', 'your-shape', {
|
580 | * draw(shapeInfo, container) {
|
581 | * const { customInfo } = shapeInfo;
|
582 | * console.log(customInfo);
|
583 | * }
|
584 | * });
|
585 | * ```
|
586 | *
|
587 | * @param cfg
|
588 | */
|
589 | customInfo(cfg: any): this;
|
590 | /**
|
591 | * 初始化 Geomtry 实例:
|
592 | * 创建 [[Attribute]] and [[Scale]] 实例,进行数据处理,包括分组、数值化以及数据调整。
|
593 | */
|
594 | init(cfg?: InitCfg): void;
|
595 | /**
|
596 | * Geometry 更新。
|
597 | * @param [cfg] 更新的配置
|
598 | */
|
599 | update(cfg?: InitCfg): void;
|
600 | /**
|
601 | * 将原始数据映射至图形空间,同时创建图形对象。
|
602 | */
|
603 | paint(isUpdate?: boolean): void;
|
604 | /**
|
605 | * 清空当前 Geometry,配置项仍保留,但是内部创建的对象全部清空。
|
606 | * @override
|
607 | */
|
608 | clear(): void;
|
609 | /**
|
610 | * 销毁 Geometry 实例。
|
611 | */
|
612 | destroy(): void;
|
613 | /**
|
614 | * 获取决定分组的图形属性对应的 scale 实例。
|
615 | * @returns
|
616 | */
|
617 | getGroupScales(): Scale[];
|
618 | /**
|
619 | * 根据名字获取图形属性实例。
|
620 | */
|
621 | getAttribute(name: string): Attribute;
|
622 | /** 获取 x 轴对应的 scale 实例。 */
|
623 | getXScale(): Scale;
|
624 | /** 获取 y 轴对应的 scale 实例。 */
|
625 | getYScale(): Scale;
|
626 | /**
|
627 | * 获取决定分组的图形属性实例。
|
628 | */
|
629 | getGroupAttributes(): Attribute[];
|
630 | /** 获取图形属性默认的映射值。 */
|
631 | getDefaultValue(attrName: string): any;
|
632 | /**
|
633 | * 获取该数据发生图形映射后对应的 Attribute 图形空间数据。
|
634 | * @param attr Attribute 图形属性实例。
|
635 | * @param obj 需要进行映射的原始数据。
|
636 | * @returns
|
637 | */
|
638 | getAttributeValues(attr: Attribute, obj: Datum): any[];
|
639 | getAdjust(adjustType: string): Adjust;
|
640 | /**
|
641 | * 获取 shape 对应的 marker 样式。
|
642 | * @param shapeName shape 具体名字
|
643 | * @param cfg marker 信息
|
644 | * @returns
|
645 | */
|
646 | getShapeMarker(shapeName: string, cfg: ShapeMarkerCfg): ShapeMarkerAttrs;
|
647 | /**
|
648 | * 根据一定的规则查找 Geometry 的 Elements。
|
649 | *
|
650 | * ```typescript
|
651 | * getElementsBy((element) => {
|
652 | * const data = element.getData();
|
653 | *
|
654 | * return data.a === 'a';
|
655 | * });
|
656 | * ```
|
657 | *
|
658 | * @param condition 定义查找规则的回调函数。
|
659 | * @returns
|
660 | */
|
661 | getElementsBy(condition: (element: Element) => boolean): Element[];
|
662 | /**
|
663 | * 获取数据对应的唯一 id。
|
664 | * @param data Element 对应的绘制数据
|
665 | * @returns
|
666 | */
|
667 | getElementId(data: MappingDatum | MappingDatum[]): any;
|
668 | /**
|
669 | * 获取所有需要创建 scale 的字段名称。
|
670 | */
|
671 | getScaleFields(): string[];
|
672 | /**
|
673 | * 显示或者隐藏 geometry。
|
674 | * @param visible
|
675 | */
|
676 | changeVisible(visible: boolean): void;
|
677 | /**
|
678 | * 获取当前配置中的所有分组 & 分类的字段。
|
679 | * @return fields string[]
|
680 | */
|
681 | getGroupFields(): string[];
|
682 | /**
|
683 | * 获得图形的 x y 字段。
|
684 | */
|
685 | getXYFields(): string[];
|
686 | /**
|
687 | * 获取该 Geometry 下所有生成的 shapes。
|
688 | * @returns shapes
|
689 | */
|
690 | getShapes(): (IShape | IGroup)[];
|
691 | /**
|
692 | * 获取虚拟 Group。
|
693 | * @returns
|
694 | */
|
695 | getOffscreenGroup(): IGroup;
|
696 | sort(mappingArray: Data[]): void;
|
697 | /**
|
698 | * 调整度量范围。主要针对发生层叠以及一些特殊需求的 Geometry,比如 Interval 下的柱状图 Y 轴默认从 0 开始。
|
699 | */
|
700 | protected adjustScale(): void;
|
701 | /**
|
702 | * 获取当前 Geometry 对应的 Shape 工厂实例。
|
703 | */
|
704 | protected getShapeFactory(): ShapeFactory;
|
705 | /**
|
706 | * 获取每个 Shape 对应的关键点数据。
|
707 | * @param obj 经过分组 -> 数字化 -> adjust 调整后的数据记录
|
708 | * @returns
|
709 | */
|
710 | protected createShapePointsCfg(obj: Datum): S;
|
711 | /**
|
712 | * 创建 Element 实例。
|
713 | * @param mappingDatum Element 对应的绘制数据
|
714 | * @param [isUpdate] 是否处于更新阶段
|
715 | * @returns element 返回创建的 Element 实例
|
716 | */
|
717 | protected createElement(mappingDatum: MappingDatum, isUpdate?: boolean): Element;
|
718 | /**
|
719 | * 获取每条数据对应的图形绘制数据。
|
720 | * @param mappingDatum 映射后的数据
|
721 | * @returns draw cfg
|
722 | */
|
723 | protected getDrawCfg(mappingDatum: MappingDatum): ShapeInfo;
|
724 | /**
|
725 | * 创建所有的 Elements。
|
726 | * @param mappingData
|
727 | * @param [isUpdate]
|
728 | * @returns elements
|
729 | */
|
730 | protected createElements(mappingData: MappingDatum[], index: number, isUpdate?: boolean): Element[];
|
731 | /**
|
732 | * 获取渲染的 label 类型。
|
733 | */
|
734 | protected getLabelType(): string;
|
735 | /**
|
736 | * 获取 Y 轴上的最小值。
|
737 | */
|
738 | protected getYMinValue(): number;
|
739 | private createAttrOption;
|
740 | protected initAttributes(): void;
|
741 | private processData;
|
742 | private adjustData;
|
743 | private groupData;
|
744 | private updateStackRange;
|
745 | private beforeMapping;
|
746 | private generateShapePoints;
|
747 | private normalizeValues;
|
748 | private mapping;
|
749 | private convertPoint;
|
750 | private getStyleCfg;
|
751 | private setCfg;
|
752 | private renderLabels;
|
753 | /**
|
754 | * 是否需要进行群组入场动画
|
755 | * 规则:
|
756 | * 1. 如果发生更新,则不进行
|
757 | * 2. 如果用户关闭 geometry 动画,则不进行
|
758 | * 3. 如果用户关闭了 appear 动画,则不进行
|
759 | * 4. 如果用户配置了 appear.animation,则不进行
|
760 | */
|
761 | private canDoGroupAnimation;
|
762 | }
|
763 |
|
\ | No newline at end of file |