Skip to content

Commit

Permalink
fix: 图例问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
yxh01132861 committed Jan 31, 2024
1 parent 4016d26 commit e55517a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ export const parserLegendData = (layer: Layer) => {
.map((label, index) => ({ label, color: colors[index] }))
.sort((a, b) => a.label.localeCompare(b.label, 'zh-CN'));
// string 文本自定义的情况,需要展示出其他分类
const unknownItem = { label: '其他', color: layer.options.fillColor.scale.unknown };
// 线图层 layer.options.color 其他图层 layer.options.fillColor
const unknownItem = {
label: '其他',
color: layer.options.fillColor?.scale.unknown || layer.options.color?.scale.unknown,
};
const _labels = unknownItem.color
? [...catData.map((item) => item.label), unknownItem.label]
: catData.map((item) => item.label);
Expand All @@ -144,6 +148,8 @@ export const parserLegendData = (layer: Layer) => {
},
};

console.log(data, 'data');

return data;
} else if (['linear', 'quantile', 'quantize', 'threshold'].includes(type as string)) {
const data: LegendRampData = {
Expand Down

0 comments on commit e55517a

Please sign in to comment.