Make the scale match the map
This commit is contained in:
parent
f1f7ff1976
commit
a5f5acd6d5
|
@ -33,8 +33,9 @@ export function colormapToScale(colormap, value, min, max) {
|
|||
export const viridis = simplifyColormap(viridisBase.map(rgbArrayToColor), 20)
|
||||
export const grayscale = ['#FFFFFF', '#000000']
|
||||
export const reds = [
|
||||
['rgba', 255, 0, 0, 0],
|
||||
['rgba', 255, 0, 0, 1],
|
||||
'rgba( 255, 0, 0, 0)',
|
||||
'rgba( 255, 0, 0, 255)',
|
||||
]
|
||||
]
|
||||
|
||||
export function colorByCount(attribute = 'event_count', maxCount, colormap = viridis) {
|
||||
|
|
|
@ -81,6 +81,7 @@ function LayerSidebar({
|
|||
/>
|
||||
</List.Item>
|
||||
{attribute.endsWith('_count') ? (
|
||||
<>
|
||||
<List.Item>
|
||||
<List.Header>Maximum value</List.Header>
|
||||
<Input
|
||||
|
@ -90,14 +91,15 @@ function LayerSidebar({
|
|||
onChange={(_e, {value}) => setMapConfigFlag('obsRoads.maxCount', value)}
|
||||
/>
|
||||
</List.Item>
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
{showRoads && (
|
||||
<>
|
||||
<List.Item>
|
||||
<ColorMapLegend map={_.chunk(colorByCount('obsRoads.maxCount',mapConfig.obsRoads.maxCount, reds).slice(3), 2)} />
|
||||
</List.Item></>
|
||||
) :
|
||||
(
|
||||
<List.Item>
|
||||
<ColorMapLegend map={_.chunk(colorByDistance('distance_overtaker')[3].slice(3), 2)} />
|
||||
</List.Item>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<Divider />
|
||||
|
|
Loading…
Reference in a new issue