Skip to content

Commit

Permalink
fix: change world map color scheme (apache#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophlingg authored and zhaoyongjie committed Nov 25, 2021
1 parent 6346b11 commit 4bb0fd2
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ function WorldMap(element, props) {
.domain([extRadius[0], extRadius[1]])
.range([1, maxBubbleSize]);

// color gradient based on http://colorbrewer2.org/#type=sequential&scheme=Greens&n=9
const colorScale = d3.scale
.linear()
.domain([ext[0], ext[1]])
.range(['#FFF', 'black']);
.range(['#c7e9c0', '#00441b']);

const processedData = filteredData.map(d => ({
...d,
Expand All @@ -81,31 +82,31 @@ function WorldMap(element, props) {
element,
data: processedData,
fills: {
defaultFill: '#ddd',
defaultFill: '#eee',
},
geographyConfig: {
popupOnHover: true,
highlightOnHover: true,
borderWidth: 1,
borderColor: '#fff',
highlightBorderColor: '#fff',
highlightFillColor: '#005a63',
borderColor: '#feffff',
highlightBorderColor: '#feffff',
highlightFillColor: '#00749A',
highlightBorderWidth: 1,
popupTemplate: (geo, d) =>
`<div class="hoverinfo"><strong>${d.name}</strong><br>${formatter(d.m1)}</div>`,
},
bubblesConfig: {
borderWidth: 1,
borderOpacity: 1,
borderColor: '#005a63',
borderColor: '#00749A',
popupOnHover: true,
radius: null,
popupTemplate: (geo, d) =>
`<div class="hoverinfo"><strong>${d.name}</strong><br>${formatter(d.m2)}</div>`,
fillOpacity: 0.5,
animate: true,
highlightOnHover: true,
highlightFillColor: '#005a63',
highlightFillColor: '#00749A',
highlightBorderColor: 'black',
highlightBorderWidth: 2,
highlightBorderOpacity: 1,
Expand All @@ -119,7 +120,7 @@ function WorldMap(element, props) {

if (showBubbles) {
map.bubbles(processedData);
div.selectAll('circle.datamaps-bubble').style('fill', '#005a63');
div.selectAll('circle.datamaps-bubble').style('fill', '#00749A');
}
}

Expand Down

0 comments on commit 4bb0fd2

Please sign in to comment.