Monday, 24 March 2014

D3 Video 4 - Binding data...

Keep the canvas element

create data

var dataArray = [20, 40, 50]

visualise this with a simple bar chart

var bars = canvas.selectAll("rect")
                            .data(dataArray)
                            .enter()
                                 .append("rect")
                                 .attr("width", function(d) (return d;))
                                 .attr("height", 50)
                                 .attr("y", function(d, i)  (return i*100))


So I just put this into Word and loaded it into Google Chrome and it made the bars.

Great!!

Very happy.

I need to commend the video maker.



No comments:

Post a Comment