diff --git a/packages/core/types/Legend.ts b/packages/core/types/Legend.ts
index 07a1e728f7..947d494230 100644
--- a/packages/core/types/Legend.ts
+++ b/packages/core/types/Legend.ts
@@ -15,4 +15,5 @@ export type Legend = {
singleRow: boolean
type: string
verticalSorted: boolean
+ groupBy: string
}
diff --git a/packages/map/examples/default-hex.json b/packages/map/examples/default-hex.json
index f77d65e45f..827ac8d1e0 100644
--- a/packages/map/examples/default-hex.json
+++ b/packages/map/examples/default-hex.json
@@ -138,10 +138,7 @@
"showBubbleZeros": false
},
"mapPosition": {
- "coordinates": [
- 0,
- 30
- ],
+ "coordinates": [0, 30],
"zoom": 1
},
"map": {
@@ -569,4 +566,4 @@
},
"usingWidgetLoader": true,
"validated": 4.23
-}
\ No newline at end of file
+}
diff --git a/packages/map/index.html b/packages/map/index.html
index e07e937eb1..009e235bdf 100644
--- a/packages/map/index.html
+++ b/packages/map/index.html
@@ -30,8 +30,8 @@
-
-
+
@@ -59,7 +59,7 @@
-
+
diff --git a/packages/map/src/CdcMap.tsx b/packages/map/src/CdcMap.tsx
index e4a757a9e5..7f52859faf 100644
--- a/packages/map/src/CdcMap.tsx
+++ b/packages/map/src/CdcMap.tsx
@@ -353,6 +353,7 @@ const CdcMap = ({
// Legend - Update when runtimeData does
const legend = generateRuntimeLegend(state, runtimeData, hashLegend)
+
setRuntimeLegend(legend)
}, [
runtimeData,
diff --git a/packages/map/src/_stories/CdcMap.Legend.stories.tsx b/packages/map/src/_stories/CdcMap.Legend.stories.tsx
index c05bd6529b..23fceb6cb8 100644
--- a/packages/map/src/_stories/CdcMap.Legend.stories.tsx
+++ b/packages/map/src/_stories/CdcMap.Legend.stories.tsx
@@ -38,3 +38,12 @@ export const Legend_Bottom_Single_Row: Story = {
])
}
}
+export const Legend_Grouped: Story = {
+ args: {
+ config: editConfigKeys(WastewaterMap, [
+ { path: ['legend', 'position'], value: 'side' },
+ { path: ['legend', 'style'], value: 'boxes' },
+ { path: ['legend', 'groupBy'], value: 'pathogen' }
+ ])
+ }
+}
diff --git a/packages/map/src/components/EditorPanel/components/EditorPanel.tsx b/packages/map/src/components/EditorPanel/components/EditorPanel.tsx
index a38849a0a8..0dfc559b84 100644
--- a/packages/map/src/components/EditorPanel/components/EditorPanel.tsx
+++ b/packages/map/src/components/EditorPanel/components/EditorPanel.tsx
@@ -368,6 +368,15 @@ const EditorPanel = () => {
}
})
break
+ case 'legendGroupBy':
+ setState({
+ ...state,
+ legend: {
+ ...state.legend,
+ groupBy: value
+ }
+ })
+ break
case 'legendSubStyle':
setState({
...state,
@@ -2315,6 +2324,17 @@ const EditorPanel = () => {
}}
/>
)}
+
+ {'navigation' !== state.general.type && state.legend.type === 'category' && (
+