Colors via function
Instead of passing `keyToColor` you can pass a function `keyToColorFn`.
You also have to pass `key` or `key_alt` (see basic props for an examplation of these)
Note that if you pass both `keyToColor` and `keyToColorFn`, `keyToColor` takes precedence.
Also note that if the value returned by `keyToColorFn` is falsy the fallback is `defaultFill` (which defaults to `white`).
Usage
<ChoroplethG {height} {keyToColorFn} {width} key='iso_a2' topojson={world_110m_iso_a2} topojsonId='countries' />
Props
key
- "iso_a2"
keyToColorFn
- ƒ scale(d)
- length: 1
- name: "scale"
- prototype: { constructor: ƒ }
- [[Function]]: function scale(d) { let i = index.get(d); if (i === undefined) { if (unknown !== implicit) return unknown; index.set(d, i = domain.push(d) - 1); } return range[i % range.length]; }
- [[Prototype]]: ƒ ()
topojson
- { type: "Topology" ,objects: {…} ,arcs: Array(595) ,bbox: Array(4) ,transform: {…} }
- type: "Topology"
- objects: { countries: {…} ,land: {…} }
- arcs: (595) [ Array(9) ,Array(11) ,Array(5) ,Array(11) ,Array(9) , … ]
- bbox: (4) [ -180 ,-85.60903777459771 ,180 ,83.64513000000001 ]
- transform: { scale: Array(2) ,translate: Array(2) }
topojsonId
- "countries"