Answers for "what is x scale and y scale in d3 js"

0

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));
Posted by: Guest on October-07-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language