-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EES-5542 fix maps rendering with right boundary data
- Loading branch information
1 parent
c0c6c08
commit 92835aa
Showing
3 changed files
with
22 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ation-statistics-common/src/modules/charts/components/utils/getMapInitialBoundaryLevel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Chart } from '@common/services/types/blocks'; | ||
import isEqual from 'lodash/isEqual'; | ||
import sortBy from 'lodash/sortBy'; | ||
|
||
export default function getMapInitialBoundaryLevel( | ||
chart: Chart, | ||
): number | undefined { | ||
if (chart.type !== 'map') return undefined; | ||
|
||
// data set options are ordered alphabetically based on their label text | ||
const firstDataSet = sortBy(chart.legend.items, 'label')[0].dataSet; | ||
const firstDataSetConfig = chart.map?.dataSetConfigs.find(({ dataSet }) => { | ||
return isEqual(dataSet, firstDataSet); | ||
}); | ||
|
||
return firstDataSetConfig?.boundaryLevel ?? chart.boundaryLevel; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters