D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
ngopal
Full window
Github gist
Visualization of a specialized "look and say" sequence
<!DOCTYPE html> <meta charset="utf-8"> <style> body { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } .dot { stroke: #000; } .h1 { font-size: 30; font-family: "Futura"; color: red; text-align: center; } </style> <body> <center><h1>Look and Say 25</h1></center> <script src="https://d3js.org/d3.v3.min.js"></script> <script> var margin = {top: 20, right: 20, bottom: 30, left: 40}, width = 960 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; var x = d3.scale.linear() .range([0, width]); var y = d3.scale.linear() .range([height, 0]); var color = d3.scale.category10(); var xAxis = d3.svg.axis() .scale(x) .orient("bottom"); var yAxis = d3.svg.axis() .scale(y) .orient("left"); var svg = d3.select("body").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); d3.tsv("data3.tsv", function(error, data) { data.forEach(function(d) { d.Xco = +d.Xco; d.Yco = +d.Yco; }); x.domain(d3.extent(data, function(d) { return d.Xco; })).nice(); y.domain(d3.extent(data, function(d) { return d.Yco; })).nice(); svg.selectAll(".dot") .data(data) .enter().append("circle") .attr("class", "dot") .attr("r", 3.5) .attr("cx", function(d) { return x(d.Xco); }) .attr("cy", function(d) { return y(d.Yco); }); }); </script>
Modified
http://d3js.org/d3.v3.min.js
to a secure url
https://d3js.org/d3.v3.min.js