Skip to content

Commit

Permalink
getColor function colorMap fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhamShakyawal committed Oct 3, 2024
1 parent b8f594e commit 1c172c2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export function getColor(d: Data, store: Store) {
index = index - colorMap.length;
}
return colorMap[index];
} else {
if (colorMap[currentValue]) {
return colorMap[currentValue];
} else if (typeof colorMap === 'object' && colorMap !== null) {
// Check if colorMap is an object
if (currentValue in colorMap) {
// Check if currentValue is a valid key
return colorMap[currentValue]; // Safely access the property
}
}
}
Expand Down

0 comments on commit 1c172c2

Please sign in to comment.