D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
noblemillie
Full window
Github gist
hzAxis_percentage
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 type="text/javascript"> var height = 500, width = 500, margin = 25, axisWidth = width - 2 * margin; var svg = d3.select("body").append("svg") .attr("class", "axis") .attr("width", width) .attr("height", height); var scale = d3.scaleLinear() .domain([0, 1]).range([0, axisWidth]); var axis = d3.axisBottom() .scale(scale) .ticks(10) .tickSize(12) .tickPadding(10) .tickFormat(d3.format(".0%")); svg.append("g") .attr("transform", function(){ return "translate(" + margin + "," + margin + ")"; }) .call(axis); </script> </body>
https://d3js.org/d3.v4.min.js