scale.linear() is returning NaN
d3.js
Solution
Well, `w_bar` is Not a Number, and the `width` attribute needs to be a number. Hence, NaN.
If you want your `width` attribute to scale based on the `v` attribute in your `myJSON` object, you should say `.attr("width",function (d) {return w_bar(d.v)})`.
This is how scales work in `d3`, they are a function which takes in an argument (some value within the `domain` of the scale) and returns that value transformed to fit into the `range` of your scale.
Updated jsFiddle here.
Problem
Im running a simple bar chart using d3.scale.linear() and hardcoding he domain range for this example I can see in firebug that when aplying attr of width to my div, w_bar appears to be NaN. Why is that? ``` var w_bar = d3.scale.linear() .domain([0, 107525233]) //harcoded .range(["0px", "290px"]); var theList = d3.select("#list").selectAll("div") .data(myJSON); theList.enter().append("div") .text(function (d) { return d.v; }) .transition() .duration(1000) .attr("width", w_bar); // Why NaN? theList.exit() .remove(); ``` Here's the jsfiddle: http://jsfiddle.net/NAhD9/5/