Skip to content

Commit

Permalink
fixed single value continuous bug, e.g. Maine 'count of traps'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobular committed May 19, 2023
1 parent 5148ada commit 34272f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function getDefaultOverlayConfig(
entityId: overlayEntity.id,
};

if (overlayVariable.vocabulary) {
if (overlayVariable.dataShape === 'categorical') {
// categorical
const overlayValues = await getMostFrequentValues({
studyId: studyId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,14 @@ export function useStandaloneMapMarkers(
overlayType === 'categorical'
? ColorPaletteDefault[vocabulary.indexOf(binLabel)]
: gradientSequentialColorscaleMap(
vocabulary.indexOf(binLabel) / (vocabulary.length - 1)
vocabulary.length > 1
? vocabulary.indexOf(binLabel) /
(vocabulary.length - 1)
: 0.5
),
}))
: [];

console.log({ donutData, overlayType, vocabulary });
// TO DO: address diverging colorscale (especially if there are use-cases)

// now reorder the data, adding zeroes if necessary.
Expand Down Expand Up @@ -382,7 +385,9 @@ export function useStandaloneMapMarkers(
? ColorPaletteDefault[vocabulary.indexOf(label)]
: overlayType === 'continuous'
? gradientSequentialColorscaleMap(
vocabulary.indexOf(label) / (vocabulary.length - 1)
vocabulary.length > 1
? vocabulary.indexOf(label) / (vocabulary.length - 1)
: 0.5
)
: undefined,
// has any geo-facet got an array of overlay data
Expand Down

0 comments on commit 34272f0

Please sign in to comment.