0
Q:

what is x scale and y scale in d3 js

// create svg element
var svg = d3.select("#res")
  .append("svg")
    .attr("width", 1000)

// Create the scale
var x = d3.scaleLinear()
    .domain([0, 100])         // This is what is written on the Axis: from 0 to 100
    .range([100, 800]);       // This is where the axis is placed: from 100px to 800px

// Draw the axis
svg
  .append("g")
  .attr("transform", "translate(0,50)")      // This controls the vertical position of the Axis
  .call(d3.axisBottom(x));
0

New to Communities?

Join the community