Sha256: 65cf9edcc83dfae2c3ee56f298f95fe009d5106fb13e6cbe9e877b8b1d297ea4

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 KB

Contents

<html>
  <head>
    <title>Test: Segmented line with interpolation </title>
    <script type="text/javascript" src="protovis-r3.3.js"></script>
  </head>
  <body>
  <h1>Test: Segmented line with interpolation</h1>
    <script type="text/javascript">

data = pv.range(0, 10, 0.2).map(function(x) {
  return {x:x, y:Math.sin(x) + 2};
});


p_w=200
p_h=150
w = 20+p_w*2
h = 20+p_h*4

x = pv.Scale.linear(data, function(d) {return d.x;}).range(0, p_w-30)


y = pv.Scale.linear(data, function(d) {return d.y;}).range(0, p_h-20);

interpolations=["linear","step-before","step-after","polar","polar-reverse", "basis", "cardinal","monotone"]


vis = new pv.Panel()
  .width(w)
  .height(h)
  .bottom(20)
  .left(20)
  .right(10)
  .top(5)

for(var i=0; i<interpolations.length;i++) {
var inter=interpolations[i];
  n=i%2
  m=Math.floor(i/2)
  panel=vis.add(pv.Panel).
  left(n*(p_w+10)).
  top(m*(p_h+10)).
  width(p_w).
  height(p_h)
  
  panel.anchor('top').add(pv.Label).text(inter)
  
  panel.add(pv.Line).data(data).
  segmented(true).
  lineWidth(function(d) {return d.y * 2+this.index*0.5}).
  left(function(d){return x(d.x)}).
  bottom(function(d){ return y(d.y)}).
  interpolate(inter);
  }
  
  
     

vis.render()



</script>
    </body>
    </html>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rubyvis-0.7.0 spec/fixtures/line_interpolation_segmented.html
rubyvis-0.6.1 spec/fixtures/line_interpolation_segmented.html
rubyvis-0.6.0 spec/fixtures/line_interpolation_segmented.html
rubyvis-0.5.2 spec/fixtures/line_interpolation_segmented.html
rubyvis-0.5.1 spec/fixtures/line_interpolation_segmented.html
rubyvis-0.5.0 spec/fixtures/line_interpolation_segmented.html
rubyvis-0.4.1 spec/fixtures/line_interpolation_segmented.html
rubyvis-0.4.0 spec/fixtures/line_interpolation_segmented.html