d3.js - Error: Invalid value for <rect> attribute width="NaN" -
i'm new d3. ive have completed quite few charts , examples "interactive data visualization web" scott murray , had few problems. first attempt @ using large data-set not contained within code.
d3.csv("historical_weather.csv", function(error,data) {
dataset = data.map(function(d){ return [ parseint(+d.cloudcover),parseint(+ d.maxtemp) ]; }) console.log(dataset); var svg = d3.select("body") .append("svg") .attr("height",500) .attr("width",500); d3.select("svg") .selectall("rect") .data("dataset") .enter() .append("rect") .attr("height",50) .attr("width", function(d){return d.maxtemp*10;}); });
the data loads , visible in console array, can see expected values when digging array. console shows :
error: invalid value attribute width="nan"
seems have typo. line says .data("dataset")
should instead .data(dataset)
no quotation marks. i.e., should submitting dataset
variable, not string containing its' name.
Comments
Post a Comment