Change color gamut project 2 aufgabe 3
This commit is contained in:
parent
181033cade
commit
d49cc6db97
@ -32,28 +32,26 @@ const aufgabe3 = async () => {
|
||||
return [].concat(...apiData)
|
||||
}
|
||||
|
||||
const levels = [0, 50, 80, 85, 90, 95, 99, 100]
|
||||
const levels = [0, 50.0, 80.0, 85.0, 90.0, 95.0, 99.0, 99.9]
|
||||
|
||||
const getColor = percentage => {
|
||||
switch (true) {
|
||||
case percentage > levels[7]:
|
||||
return '#800026'
|
||||
return '#00FF00'
|
||||
case percentage > levels[6]:
|
||||
return '#BD0026'
|
||||
return '#33CC00'
|
||||
case percentage > levels[5]:
|
||||
return '#E31A1C'
|
||||
return '#4DB300'
|
||||
case percentage > levels[4]:
|
||||
return '#FC4E2A'
|
||||
return '#808000'
|
||||
case percentage > levels[3]:
|
||||
return '#FD8D3C'
|
||||
return '#996600'
|
||||
case percentage > levels[2]:
|
||||
return '#FEB24C'
|
||||
return '#B34D00'
|
||||
case percentage > levels[1]:
|
||||
return '#FED976'
|
||||
return '#CC3300'
|
||||
case percentage > levels[0]:
|
||||
return '#FFEDA0'
|
||||
default:
|
||||
return '#ffdea1'
|
||||
return '#FF0000'
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +83,7 @@ const aufgabe3 = async () => {
|
||||
|
||||
for (let i = 0; i < levels.length; i++) {
|
||||
labels.push(
|
||||
'<i style="background:' + getColor(levels[i] + 1) + '"></i> '
|
||||
'<i style="background:' + getColor(levels[i] + 0.1) + '"></i> '
|
||||
+ levels[i] + (levels[i + 1] ? '–' + levels[i + 1] : '+')
|
||||
)
|
||||
}
|
||||
@ -166,7 +164,6 @@ const aufgabe3 = async () => {
|
||||
}
|
||||
|
||||
L.control.layers(layers, null).addTo(map)
|
||||
|
||||
}
|
||||
|
||||
aufgabe3()
|
||||
|
Loading…
Reference in New Issue
Block a user