Skip to content

Commit

Permalink
fix: legend round value
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei committed Mar 6, 2024
1 parent 8b7d6e0 commit 722db37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/l7plot/src/layers/dot-layer/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ type LegendItemTick = { value: number | string; color: string };
type LegendItemExtent = { value: [number, number]; color: string };

const isLegendItemI = (
legendItems: ILegendSegmentItem[] | ILegendClassificaItem[]
legendItems: ILegendSegmentItem[] | ILegendClassificaItem[],
): legendItems is LegendItemTick[] => {
return !Array.isArray(legendItems[0].value);
};

export const getColorLegendItems = (
legendItems: ILegendSegmentItem[] | ILegendClassificaItem[]
legendItems: ILegendSegmentItem[] | ILegendClassificaItem[],
): CategoryLegendListItem[] => {
if (isLegendItemI(legendItems)) {
return legendItems;
Expand All @@ -21,7 +21,7 @@ export const getColorLegendItems = (
// TODO: scale nice
const items: LegendItemExtent[] = legendItems.map((item) => ({
...item,
value: [round(item.value[0], 2), round(item.value[1], 2)],
value: [round(item.value[0], 4), round(item.value[1], 4)],
}));

return items;
Expand Down

0 comments on commit 722db37

Please sign in to comment.