D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
aaizemberg
Full window
Github gist
Plottable (bars) - minimal working example
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Plottable</title> <link rel="stylesheet" href="./plottable.css" charset="utf-8"> <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script> <script src="./plottable.js"></script> </head> <body> <svg id="bars" height="500"></svg> <script> var data = [{ x: 1, y: 1 }, { x: 2, y: 3 }, { x: 3, y: 2 }, { x: 4, y: 4 }, { x: 5, y: 3 }, { x: 6, y: 5 }]; var xScale = new Plottable.Scales.Linear(); var yScale = new Plottable.Scales.Linear(); var plot = new Plottable.Plots.Bar() .addDataset(new Plottable.Dataset(data)) .x(function(d) { return d.x; }, xScale) .y(function(d) { return d.y; }, yScale) .animated(true) .renderTo("svg#bars"); window.addEventListener("resize", function() { plot.redraw(); }); </script> </body> </html>
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js