Sha256: e81e5675bb1e264bea721d5d657b2a2c9e079943e2a2ab81ee34b6bbcd0f4b3b

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

<html>
  <head>
    <title>Ordinal Split Banded</title>
    <script type="text/javascript" src="../../protovis-d3.3.js"></script>
  </head>
  <body>
    <script type="text/javascript+protovis">

var categories = "ABCDEFGHIJK".split(""),
    data = categories.map(function(c) ({x:c, y:Math.random()})),
    w = 480,
    h = 400,
    x = pv.Scale.ordinal(categories).splitBanded(0, w, -38),
    y = pv.Scale.linear(0, 1).range(0, h),
    c = pv.Colors.category19(categories);

var vis = new pv.Panel()
    .width(w)
    .height(h)
    .margin(19.5)
    .strokeStyle("#ccc");

vis.add(pv.Bar)
    .data(data)
    .left(function(d) x(d.x))
    .width(x.range().band)
    .bottom(0)
    .height(function(d) y(d.y))
    .fillStyle(function(d) c(d.x))
  .anchor("bottom").add(pv.Label)
    .textBaseline("top")
    .text(function(d) d.x);

vis.add(pv.Rule)
    .data(y.ticks())
    .bottom(y)
    .strokeStyle("rgba(255, 255, 255, .5)")
  .anchor("right").add(pv.Label)
    .text(y.tickFormat);

vis.render();

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyvis-0.1.1 vendor/tests/data/ordinal-split-banded2.html