Created
August 29, 2012 19:11
Lazy Scale Domain
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
// Create a scale, but don't set the domain until the data is known. | |
var x = d3.scale.linear() | |
.range([0, width]); | |
// Load the data. | |
d3.json("data.json", function(data) { | |
// Now we can compute the domain and update the scale. | |
x.domain([0, d3.max(data)]); | |
// And here's where we'd visualize the data… | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment