D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
razvantomegea
Full window
Github gist
Graph starter
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } </style> </head> <body> <script src="graph.js"></script> <script> let dataLength = 5, random = d3.randomUniform(1000), data = d3.range(dataLength).map(random); // Scales let xScale = d3.scaleLinear().domain([0, d3.max(data)]).range([0, domainWidth]), yScale = d3.scaleLinear().domain([1, d3.max(data)]).range([domainHeight, 0]); // Axes graph.append('g') .classed('axis', true) .attr('transform', `translate(0, ${domainHeight})`) .call(d3.axisBottom(xScale)); graph.append('g') .classed('axis', true) .call(d3.axisLeft(yScale)); </script> </body>
https://d3js.org/d3.v4.min.js