Created
July 4, 2012 06:21
-
-
Save ptvans/3045703 to your computer and use it in GitHub Desktop.
just another inlet to tributary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x_scale = d3.scale.linear().domain([0,100]).range([0,500]); | |
//bar height | |
var h=30; | |
//x-origin | |
var ox=30; | |
//y-origin | |
var oy=30; | |
var color = d3.scale.category10(); | |
var array = [16,25,9,12,38]; | |
var group = g.append('g').attr('id','barsGroup') | |
var selection = group.selectAll('rect') | |
.data(array) | |
.enter() | |
.append('rect') | |
.attr('class','bars') | |
.attr('fill',function(d,i){return color(i)}) | |
.attr('height',h) | |
.attr('width',function(d,i){ | |
return x_scale(d); | |
}) | |
.attr('x',function(d,i){ | |
var cw = x_scale(d); | |
var temp = ox; | |
ox = ox + cw | |
return temp; | |
}) | |
.attr('y',function(d,i){ | |
var temp1 = h*i*1.15 + oy; | |
return temp1; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment