D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
phoebebright
Full window
Github gist
D3 axis scale simple example
<html> <head> <title>D3 Axis Example</title> <script src="https://d3js.org/d3.v2.js"></script> </head> <body> <script> var width = 400, height = 400, padding = 30; // create an svg container var vis = d3.select("body"). append("svg:svg") .attr("width", width) .attr("height", height); // define the scale var xScale = d3.scale.linear() .domain([0, 100]) // values between 0 and 100 .range([padding, width - padding * 2]); // map these the the chart width = total width minus padding at both sides // define the axis var xAxis = d3.svg.axis() .scale(xScale); // draw it and move to the bottom of the chart area vis.append("g") .attr("transform", "translate(0," + (height - padding) + ")") .call(xAxis); </script> </body> </html>
Modified
http://d3js.org/d3.v2.js
to a secure url
https://d3js.org/d3.v2.js