Currently, I am working with D3 and JSON data by using a function that looks like this:
d3.json("http://api.json", function(jsondata) {
var data = jsondata.map(function(d) { return d.number; });
After executing this, the value of the data becomes ["2", "5", "8", "12"]
However, when I try to find the maximum value using:
var x = d3.scale.linear()
.domain([0, d3.max(data)])
The maximum value returned is 8 instead of 12, which is the actual maximum value in the data. I understand that this is because 8 is greater than 1 in 12, but I am unsure how to resolve this issue. Any guidance would be greatly appreciated. Thank you!