Home
<html> <head> <script src="https://d3js.org/d3.v4.min.js"></script> </head> <body> <script> var width = 400, height = 400; var data = [10, 15, 20, 25, 30]; var svg = d3.select("body") .append("svg") .attr("width", width) .attr("height", height); var scale = d3.scaleLinear() .domain([d3.min(data), d3.max(data)]) .range([height/2, 0]); var y_axis = d3.axisLeft() .scale(scale); svg.append("g") .attr("transform", "translate(50, 10)") .call(y_axis); </script> </body> </html>
Result: