Sha256: 4efefd15f0b28067c2fe88aec4c7e8849693c632eafb8b4ebf3d183435174e2c

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

<!DOCTYPE html>
<html>
  <head>
    <script type="text/javascript" src="../../protovis-d3.3.js"></script>
    <script type="text/javascript" src="../jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="jquery.tipsy.js"></script>
    <script type="text/javascript" src="tipsy.js"></script>
    <link type="text/css" href="tipsy.css" rel="stylesheet"/>
    <title>Tipsy Bar</title>
    <style type="text/css">

body {
  font: 10px sans-serif;
}

    </style>
  </head>
  <body>
    <script type="text/javascript+protovis">

var data = pv.range(10).map(Math.random),
    w = 400,
    h = 250,
    x = pv.Scale.linear(0, 1).range(0, w),
    y = pv.Scale.ordinal(pv.range(10)).splitBanded(0, h, 4/5);

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

var bar = vis.add(pv.Bar)
    .data(data)
    .top(function() y(this.index))
    .height(y.range().band)
    .left(0)
    .width(x)
    .title(function(d) d.toFixed(1))
    .event("mouseover", pv.Behavior.tipsy({gravity: "w", fade: true}));

bar.anchor("left").add(pv.Label)
    .textMargin(5)
    .textAlign("right")
    .text(function() "ABCDEFGHIJK".charAt(this.index));

vis.add(pv.Rule)
    .data(x.ticks())
    .left(function(d) Math.round(x(d)) - .5)
    .strokeStyle(function(d) d ? "rgba(255,255,255,.3)" : "#000")
  .add(pv.Rule)
    .bottom(0)
    .height(5)
    .strokeStyle("#000")
  .anchor("bottom").add(pv.Label)
    .text(function(d) d.toFixed(1));

vis.render();

    </script>
    <div id="example"></div>
  </body>
</html>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyvis-0.1.1 vendor/examples/tipsy/tipsy-bar.html