mirror of https://gitee.com/antv-l7/antv-l7
Feat layer legend (#954)
* feat: add cluster demo * fix(baselayer): 聚合图共用source 时数据不更新问题 layer 增加cluster zoom 标识符' * fix(source): lint error * fix: 聚合图缩放等级范围设置 * fix: demo * fix: demo lint * fix(layer): getlengenditem
This commit is contained in:
parent
c92a6af563
commit
652acf58ec
|
@ -52,7 +52,6 @@ import { normalizePasses } from '../plugins/MultiPassRendererPlugin';
|
|||
import { BlendTypes } from '../utils/blend';
|
||||
import { handleStyleDataMapping } from '../utils/dataMappingStyle';
|
||||
import { updateShape } from '../utils/updateShape';
|
||||
import baseLayerSchema from './schema';
|
||||
/**
|
||||
* 分配 layer id
|
||||
*/
|
||||
|
@ -895,6 +894,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|||
const scale = this.styleAttributeService.getLayerAttributeScale(name);
|
||||
if (scale) {
|
||||
if (scale.ticks) {
|
||||
// 连续分段类型
|
||||
const items = scale.ticks().map((item: any) => {
|
||||
return {
|
||||
value: item,
|
||||
|
@ -903,6 +903,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|||
});
|
||||
return items;
|
||||
} else if (scale.invertExtent) {
|
||||
// 连续类型
|
||||
const items = scale.range().map((item: any) => {
|
||||
return {
|
||||
value: scale.invertExtent(item),
|
||||
|
@ -910,6 +911,16 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|||
};
|
||||
});
|
||||
return items;
|
||||
} else if (scale?.domain) {
|
||||
// 枚举类型
|
||||
const items = scale.domain().map((item: string | number) => {
|
||||
return {
|
||||
// @ts-ignore
|
||||
value: item || '无',
|
||||
color: scale(item),
|
||||
};
|
||||
});
|
||||
return items;
|
||||
}
|
||||
} else {
|
||||
return [];
|
||||
|
|
Loading…
Reference in New Issue