Last active
August 29, 2015 13:59
-
-
Save scjody/10949239 to your computer and use it in GitHub Desktop.
That moment when you realize that, despite its numerous warts, it's possible to love JavaScript. This straghtforward construct just saved me 80 lines of cut and pasted code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var default_value = parseInt(details.default_value); | |
function bar_class(d) { | |
if (default_value >= d.x && default_value < d.x + d.dx) { | |
return "default"; | |
} else if (median >= d.x && median < d.x + d.dx) { | |
return "median"; | |
} | |
return "standard"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment