Add image on top of bar chart

41 views
Skip to first unread message

ravi prakash

unread,
Mar 28, 2012, 8:11:59 AM3/28/12
to protovis
Hi,

I am trying to image on top each bar in the bar chart. Here is my
code



var brIm = new Array();
brIm.push("http://vis.stanford.edu/protovis/ex/stanford.png");
brIm.push("http://vis.stanford.edu/protovis/ex/stanford.png");
brIm.push("http://vis.stanford.edu/protovis/ex/stanford.png");
brIm.push("http://vis.stanford.edu/protovis/ex/stanford.png");
brIm.push("http://vis.stanford.edu/protovis/ex/stanford.png");
//alert(brIm)
var vis = new
pv.Panel().width(350).height(550).canvas('influencersbar');
vis.add(pv.Panel)
.data([1, 1.2, 1.7, 1.5, .7, .3]) .left(function() this.index
* 25)
.add(pv.Bar).width(20).bottom(0)
.height(function(d) d * 80)
.add(pv.Image).url(function() { return
brIm[this.index]; } ).imageWidth(30).imageHeight(30)
.bottom(function(d) { return (d * 80 + 30)})
.anchor("top").add(pv.Label)
vis.render();

Here i am drawing a new panel for each data. Also the images are
appearing on top of each bar.
But each image is inheriting width and height of the bar on top of
which it is drawn. I tried to specify image width and height using
properties
imageWidth and imageHeight. But still, image is not accepting
specified parameters.

Please provide me the solution for this.

Thanks
Reply all
Reply to author
Forward
0 new messages