mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(world-map): add fallback fill color when colorFn returns null (#38602)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit ba7271b4d8)
This commit is contained in:
committed by
Michael S. Molina
parent
4baedcc794
commit
aaaead02f1
@@ -150,14 +150,20 @@ function WorldMap(element: HTMLElement, props: WorldMapProps): void {
|
||||
fillColor: colorFn(d.name, sliceId),
|
||||
}));
|
||||
} else {
|
||||
colorFn = getSequentialSchemeRegistry()
|
||||
.get(linearColorScheme)
|
||||
.createLinearScale(d3Extent(filteredData, d => d.m1));
|
||||
const rawExtents = d3Extent(filteredData, d => d.m1);
|
||||
const extents: [number, number] =
|
||||
rawExtents[0] != null && rawExtents[1] != null
|
||||
? [rawExtents[0], rawExtents[1]]
|
||||
: [0, 1];
|
||||
const colorSchemeObj = getSequentialSchemeRegistry().get(linearColorScheme);
|
||||
colorFn = colorSchemeObj
|
||||
? colorSchemeObj.createLinearScale(extents)
|
||||
: () => theme.colorBorder;
|
||||
|
||||
processedData = filteredData.map(d => ({
|
||||
...d,
|
||||
radius: radiusScale(Math.sqrt(d.m2)),
|
||||
fillColor: colorFn(d.m1),
|
||||
fillColor: colorFn(d.m1) ?? theme.colorBorder,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user