On 8 Sep 2010, at 11:51, OliverM wrote:
> var w = 150, h =150;
> var tempScale = pv.Scale.linear(0, 12).range(0, h);
> var tempVis = new pv.Panel()
> .width(w)
> .height(h)
> .add(pv.Line)
> .data([1, 1, 2, 3, 4, 2, 5, 7, 11])
> .left(function() this.index * w/9)
> .bottom(function(datum) tempScale(datum))
> ;
> tempVis.add(pv.Rule)
> .bottom(0);
>
> tempVis.render();
Note that tempVis refers to the pv.Line mark added to the panel, hence 'tempVis.add(pv.Rule)' will inherit the properties of the pv.Line mark, and so will inherit its 'data' property too and will show for every datum. It also inherits the 'left' property, which is why vertical rules are showing rather than a horizontal one. To fix this you probably want something like:
var tempVis = new pv.Panel()
.width(w)
.height(h);
tempVis.add(pv.Line)
.data([1, 1, 2, 3, 4, 2, 5, 7, 11])
.left(function() this.index * w/9)
.bottom(function(datum) tempScale(datum));
tempVis.add(pv.Rule)
.bottom(0);
tempVis.render();
--
Jason Davies