Sha256: be0c379a5fe085c8a1edcac35e43dee3b020d39e0ca1020f46ebfa85e21aba9f
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
<html> <head> <title>Histogram</title> <script type="text/javascript" src="../../protovis-d3.3.js"></script> </head> <body> <script type="text/javascript+protovis"> /* Generate an Irwin-Hall distribution. */ var n = 100, // number of trials m = 10, // number of random variables data = pv.range(n).map(function() pv.sum(pv.range(m), Math.random)); var w = 230, h = 400, x = pv.Scale.linear(0, m).range(0, w), bins = pv.histogram(data).bins(x.ticks(20)); var vis = new pv.Panel() .width(w) .height(h) .margin(29.5) .top(14.5); vis.add(pv.Panel) .data(bins) .left(function(d) x(d.x)) .add(pv.Dot) .data(function(d) d.sort()) .shapeRadius(5) .bottom(function(d) this.index * 11.5 + 6.5) .fillStyle(pv.ramp("brown", "steelblue").by(function(d, b) (d - b.x) / b.dx)) .strokeStyle(function() this.fillStyle().darker()); vis.add(pv.Rule) .data(x.ticks()) .left(x) .bottom(-5) .height(5) .anchor("bottom").add(pv.Label) .text(function(d) x.tickFormat(d)); vis.add(pv.Rule) .bottom(0); vis.render(); </script> </body> </html>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyvis-0.1.1 | vendor/tests/data/histogram-discrete.html |