Skip to content

Commit

Permalink
Merge pull request #39 from Stassi/feature/choropleth-nested-ternary-…
Browse files Browse the repository at this point in the history
…removal

feature/choropleth-nested-ternary-removal
  • Loading branch information
Stassi authored Oct 4, 2024
2 parents 071aab0 + d0426e8 commit c091d7e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stassi/leaf",
"version": "0.0.38",
"version": "0.0.39",
"description": "Leaflet adapter.",
"keywords": [
"cartography",
Expand Down
25 changes: 8 additions & 17 deletions public/tutorial/choropleth/script/choropleth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-nested-ternary -- copied from tutorial */

import DOMPurify from '../../../dompurify/purify.es.mjs'
import { DomUtility } from '../../../leaflet-adapter/document-object-model/dom-utility.js'
import { control } from '../../../leaflet-adapter/control/control.js'
Expand All @@ -24,21 +22,14 @@ tileLayer({
})

function getColor(density) {
return density > grades[7]
? '#800026'
: density > grades[6]
? '#BD0026'
: density > grades[5]
? '#E31A1C'
: density > grades[4]
? '#FC4E2A'
: density > grades[3]
? '#FD8D3C'
: density > grades[2]
? '#FEB24C'
: density > grades[1]
? '#FED976'
: '#FFEDA0'
if (density > grades[7]) return '#800026'
else if (density > grades[6]) return '#BD0026'
else if (density > grades[5]) return '#E31A1C'
else if (density > grades[4]) return '#FC4E2A'
else if (density > grades[3]) return '#FD8D3C'
else if (density > grades[2]) return '#FEB24C'
else if (density > grades[1]) return '#FED976'
return '#FFEDA0'
}

control({
Expand Down

0 comments on commit c091d7e

Please sign in to comment.