Choropleth Map application graphed in D3.js.
This project is based on FreeCodeCamp Project 4
Source Code
1
I need the TopoJSON library to work with geographic data.
Each County and State is a path.
2
How do I access the result of all the Promises in:
Promise.all(promises).then(main);
The solution is:
function main(data){ var dataset = data[0]; var dataset2 = data[1]; ... }
3
Problem:
The tooltip sometimes did not appear when I moved it to adjacent counties.
This was because on mouseout, the tooltip opacity is set to 0 but tooltip was still there but not visible.
This interfered with displaying the subsequent tooltip.
Solution:
Move tooltip above and away from the cursor pointer.
//tooltip appears above cursor tooltipDiv.html(tooltipData) .style("left", d3.event.pageX + "px") .style("top", d3.event.pageY - 50 + "px");