protovis part 4: external data and animated labels

Edit the chart

Start by deleting everything but the data property. Type top (function() yScale(this.index)) Remember, this.index refers to each element in the data array.

Set the width using (function(d) total(d.White) exactly as it appears in the data file. This is important. . This function acts like a little machine that scans the data file and finds each race element. We're telling to program to find all the White race data in each element and use it to draw the bars. If we want to use the Asian data we would type d.Asian.

Set the height to (barWidth-gap). Set left to leftMargin and set fillStyle to steelblue.