Skip to content

Commit 09f61eb

Browse files
fix: usage page make it work with graphColorMapping flag (#4195)
1 parent 7230015 commit 09f61eb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/visualization/utils/colorMappingUtils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,14 @@ export const generateSeriesToColorHex = (
159159
const cgMap = {...columnGroupMap}
160160
cgMap.mappings.forEach((graphLine, colorIndex) => {
161161
const id = getSeriesId(graphLine, columnGroupMap.columnKeys)
162-
const colors = properties.colors ?? DEFAULT_LINE_COLORS
162+
let colors
163+
if (Array.isArray(properties.colors) && properties.colors.length) {
164+
// takes care of when properties.colors is NOT undefined, and NOT an empty array
165+
colors = properties.colors
166+
} else {
167+
// when array is undefined or array IS empty.
168+
colors = DEFAULT_LINE_COLORS
169+
}
163170
const colorsHexArray = colors.map(value => value.hex)
164171
const fillScale = getNominalColorScale(columnGroupMap, colorsHexArray)
165172
seriesToColorHex[id] = fillScale(colorIndex)

0 commit comments

Comments
 (0)