<script type="text/javascript+protovis">
var data1 = [1, 1.2, 1.7, 1.5, .7];
var data2 = [1.2, 1.1, 1.5, 1.7, .9];
var width = 25;
var barspace = 35;
var labeldata = ["a", "b", "c", "d", "e"];
var panel = new pv.Panel()
.width(500)
.height(150);
var bar = panel.add(pv.Bar)
.data(data1)
.bottom(0)
.width(width)
.height(function(d) d * 80)
.left(function() this.index * (width + barspace));
var bar2 = panel.add(pv.Bar)
.data(data2)
.bottom(0)
.width(width)
.fillStyle("red")
.height(function(d) d * 80)
.left(function() this.index * (width + barspace) + width);
bar.add(pv.Label)
.data(labeldata)
.top(function() bar.top())
.left(function() bar.left()+3);
bar.add(pv.Label)
.textStyle("white");
bar2.add(pv.Label)
.data(labeldata)
.top(function() bar2.top())
.left(function() bar2.left()+3);
bar2.add(pv.Label)
.textStyle("white");
panel.render();
</script>
var data1 = [1, 1.2, 1.7, 1.5, .7];
var data2 = [1.2, 1.1, 1.5, 1.7, .9];
var width = 25;
var barspace = 35;
var labeldata = ["a", "b", "c", "d", "e"];
var panel = new pv.Panel()
.width(500)
.height(150);
var bar = panel.add(pv.Bar)
.data(data1)
.bottom(0)
.width(width)
.height(function(d) d * 80)
.left(function() this.index * (width + barspace));
var bar2 = panel.add(pv.Bar)
.data(data2)
.bottom(0)
.width(width)
.fillStyle("red")
.height(function(d) d * 80)
.left(function() this.index * (width + barspace) + width);
bar.add(pv.Label)
.data(labeldata)
.top(function() bar.top())
.left(function() bar.left()+3);
bar.add(pv.Label)
.textStyle("white");
bar2.add(pv.Label)
.data(labeldata)
.top(function() bar2.top())
.left(function() bar2.left()+3);
bar2.add(pv.Label)
.textStyle("white");
panel.render();
</script>
No comments:
Post a Comment