1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| const map = $('#map').vectorMap('get', 'mapObject') let colorRelation = { '#fefcd9': ['110000', '150000', '330000', '370000', '420000', '440000', '530000'], '#c6e2d4': ['120000', '140000', '230000', '340000', '520000', '620000', '710000', '810000'], '#f9c8dd': ['130000', '220000', '320000', '360000', '450000', '540000', '610000'], '#fae0be': ['310000', '350000', '410000', '430000', '460000', '510000', '640000', '650000', '820000'], '#c8cce7': ['210000', '500000', '630000'], } let colorsData = {} for (const key in colorRelation) { colorRelation[key].map(area => { colorsData[area] = key }) }
map.series.regions[0].setValues(colorsData)
|