/
HomeChoroplethDemo.tsx
35 lines (33 loc) · 1.21 KB
/
HomeChoroplethDemo.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React, { useMemo } from 'react'
import { Choropleth } from '@nivo/geo'
import { useHomeTheme } from './theme'
import { dimensions } from './dimensions'
import { generateChoroplethData } from '../../data/components/geo/generator'
import countries from '../../data/components/geo/world_countries'
export const HomeChoroplethDemo = () => {
const data = useMemo(() => generateChoroplethData(), [])
const { colors, nivoTheme } = useHomeTheme()
return (
<div id="choropleth">
<Choropleth
width={dimensions.width}
height={dimensions.height}
margin={dimensions.margin}
data={data}
features={countries.features}
colors={colors}
domain={[0, 1000000]}
unknownColor={`${colors[0]}44`}
borderWidth={1}
borderColor={colors[3]}
isInteractive={false}
animate={false}
theme={nivoTheme}
projectionType="mercator"
projectionScale={100}
projectionTranslation={[0.5, 0.6]}
projectionRotation={[0, 0, 0]}
/>
</div>
)
}