I am making a choropleth map of population estimate by counties in United States. I am almost done but the problem is a few counties have population count in seven figures and they are the ones that are not being filled. Can somebody help me fix that? I think something's wrong with this part of the code.

var color = d3.scaleThreshold()
.domain(d3.range(2,10).map(function(d) { return d * 1000; }))

Here's a link to my Gist on Github https://gist.github.com/sabeehtaqi/3c680626970a66ad63058b08f2a042a4

  • Disclaimer, I don't know d3 or javascript, but just looking at your block of code, my guess is that you need to change the part of the code that multiplies d by 1000. Change it to: return d * 10000 or return d * 100000. That might include the counties with the larger populations. – Fezter May 22 '17 at 0:44
  • Thanks for the quick response @Fezter but that just changes the color range of the population, that still doesnt include those counties. – user97648 May 22 '17 at 0:55
  • Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format. Here you've added a comment in the space reserved for answers to the question. Please respond to comments either in comments, or, if you are providing more information, as an edit to your question. – Midavalo May 22 '17 at 0:57
  • I have converted your non-answer to a comment. – Midavalo May 22 '17 at 0:58
  • What about this part of your code? var x = d3.scaleLinear() .domain([0, 10000]) .rangeRound([650, 1000]); on lines 16-18? Is the domain large enough? – Fezter May 22 '17 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.