Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Countries color getting to be black if you have value more than 1000 #138

Closed
meladawy opened this issue Nov 30, 2014 · 2 comments
Closed

Comments

@meladawy
Copy link

You will get an error in calculating the color scale if you have values in each country that exceed 1000, which result in a fill color grade of each country = "#000NaN" (Which is black)
.
Solution for this in setValues function.

If you have a value that exceed 1000 (E.g 1200) you should remove the comma from max variable

// line 576 replace 
  for (var cc in values) {
        val = parseFloat(values[cc]);
        if (val > max) {
          max = values[cc];
        }
        if (val && val < min) {
          min = val;
        }
      }

// with 
  for (var cc in values) {
        val = parseFloat(values[cc]);
        if (val > max) {
          max = values[cc];
          max = parseInt(max.replace(/,/g, ''), 10) ;  // Remove comma from the number 1,200 => 1200
        }
        if (val && val < min) {
          min = val;
        }
      }



// line 582 replace
      for (cc in values) {
        val = parseFloat(values[cc]);
// with
      for (cc in values) {
        val = parseFloat(parseInt(values[cc].replace(/,/g, ''), 10));

I'll try to upload patch for this...

@uvisgrinfelds
Copy link

Thank you, this worked. Was a bit puzzled before what was happening.

@fmonclus
Copy link

fmonclus commented Jun 4, 2018

Thank you, this worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants