Sha256: 2fe6972b1f09b96174d491e8d829495b26d58accffaadbeea4100bb76c23cd8a

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

<html>
  <head>
    <title>Area Chart - Cardinal</title>
    <script type="text/javascript" src="../../protovis-d3.3.js"></script>
  </head>
  <body>
    <script type="text/javascript+protovis">

var data = pv.range(0, 10.1).map(function(x) {
        return {x: x, y: Math.sin(x) + Math.random() * .5 + 2};
      }),
    w = 400,
    h = 200,
    x = pv.Scale.linear(data, function(d) d.x).range(0, w),
    y = pv.Scale.linear(0, 4).range(0, h);

var vis = new pv.Panel()
    .width(w)
    .height(h)
    .bottom(20)
    .left(20)
    .right(10)
    .top(5)
    .strokeStyle("#ccc");

vis.add(pv.Rule)
    .data(y.ticks())
    .visible(function() !(this.index % 2))
    .bottom(function(d) Math.round(y(d)) - .5)
    .strokeStyle("#eee")
  .anchor("left").add(pv.Label)
    .text(function(d) d.toFixed(1));

vis.add(pv.Rule)
    .data(x.ticks())
    .visible(function(d) d > 0)
    .left(function(d) Math.round(x(d)) - .5)
    .strokeStyle("#eee")
  .anchor("bottom").add(pv.Label)
    .text(function(d) d.toFixed());

vis.add(pv.Area)
    .data(data)
    .left(function(d) x(d.x))
    .bottom(0)
    .height(function(d) y(d.y))
    .fillStyle("rgba(31,119,180,.6)")
    .interpolate("cardinal")
    .tension(.6)
  .anchor("top").add(pv.Line)
    .lineWidth(3);

vis.render();

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyvis-0.1.1 vendor/tests/mark/area-cardinal.html