UNPKG

2.35 kBTypeScriptView Raw
1import { AllLegendsOptions } from '../../interface';
2import View from '../view';
3import { Controller } from './base';
4/**
5 * @ignore
6 * legend Controller
7 */
8export default class Legend extends Controller<AllLegendsOptions> {
9 /** the draw group of axis */
10 private container;
11 /** 用于多个 legend 布局的 bbox */
12 private layoutBBox;
13 constructor(view: View);
14 get name(): string;
15 init(): void;
16 /**
17 * render the legend component by legend options
18 */
19 render(): void;
20 /**
21 * layout legend
22 * 计算出 legend 的 direction 位置 x, y
23 */
24 layout(): void;
25 /**
26 * legend 的更新逻辑
27 */
28 update(): void;
29 clear(): void;
30 destroy(): void;
31 /**
32 * 递归获取所有的 Geometry
33 */
34 private getGeometries;
35 /**
36 * 遍历 Geometry,处理 legend 逻辑
37 * @param doEach 每个 loop 中的处理方法
38 */
39 private loopLegends;
40 /**
41 * 创建一个 legend
42 * @param geometry
43 * @param attr
44 * @param scale
45 */
46 private createFieldLegend;
47 /**
48 * 自定义图例使用 category 图例去渲染
49 * @param geometry
50 * @param attr
51 * @param scale
52 * @param legendOption
53 */
54 private createCustomLegend;
55 /**
56 * 创建连续图例
57 * @param geometry
58 * @param attr
59 * @param scale
60 * @param legendOption
61 */
62 private createContinuousLegend;
63 /**
64 * 创建分类图例
65 * @param geometry
66 * @param attr
67 * @param scale
68 * @param legendOption
69 */
70 private createCategoryLegend;
71 /**
72 * 获得连续图例的配置
73 * @param geometry
74 * @param attr
75 * @param scale
76 * @param legendOption
77 */
78 private getContinuousCfg;
79 /**
80 * 获取分类图例的配置项
81 * @param geometry
82 * @param attr
83 * @param scale
84 * @param custom
85 * @param legendOption
86 */
87 private getCategoryCfg;
88 /**
89 * get legend config, use option > suggestion > theme
90 * @param baseCfg
91 * @param legendOption
92 * @param direction
93 */
94 private mergeLegendCfg;
95 /**
96 * 生成 id
97 * @param key
98 */
99 private getId;
100 /**
101 * 根据 id 来获取组件
102 * @param id
103 */
104 private getComponentById;
105 private getCategoryLegendSizeCfg;
106}