Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. var bardata = [20,52,36, 5, 45, 12,43,21,63,24,7,31,18];
  2.  
  3. var height = 200,
  4. width = 600,
  5. barWidth = 20,
  6. barOffset = 5;
  7.  
  8. d3.select('#chart').append('svg')
  9. .attr('width', width)
  10. .attr('height', height)
  11. .style('background', 'beige')
  12.  
  13. .selectAll('rect').data(bardata)
  14. .enter().append('rect')
  15. .style('fill', '#C61C6F')
  16. .attr('width', barWidth)
  17. .attr('height',function(d) {return d;})
  18. .attr('x', function(d,i) {
  19. return i * (barWidth + barOffset);
  20. })
  21. .attr('y', function(d){ return height - d;})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement