showing results for - "what is x scale and y scale in d3 js"
Bautista
27 Jan 2019
1// create svg element
2var svg = d3.select("#res")
3  .append("svg")
4    .attr("width", 1000)
5
6// Create the scale
7var x = d3.scaleLinear()
8    .domain([0, 100])         // This is what is written on the Axis: from 0 to 100
9    .range([100, 800]);       // This is where the axis is placed: from 100px to 800px
10
11// Draw the axis
12svg
13  .append("g")
14  .attr("transform", "translate(0,50)")      // This controls the vertical position of the Axis
15  .call(d3.axisBottom(x));