SHARE
TWEET

Untitled

a guest Jun 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var xAxisScale = d3.scale.linear()
  2.          .domain([0, d3.max(data, function(d) { return d.x; })])
  3.        .range([padding, containerWidth - padding * 2]);
  4.  
  5.     var xAxis = d3.svg.axis().scale(xAxisScale).orient("bottom");
  6.  
  7.     var xGuide = chartContainer.append('g')
  8.       .attr("class", "xAxis")
  9.       .call(xAxis)
  10.       .attr('transform', 'translate(0 ,' + (containerHeight -padding) + ')');
  11.  
  12.  
  13.     /* Code for adding y axis in chart
  14.      *
  15.      * */
  16.     var yAxisScale = d3.scale.linear()
  17.       .domain([0, d3.max(data, function(d){return d.y})])
  18.       .range([containerHeight-padding, padding ]);
  19.  
  20.     var yAxis = d3.svg.axis().scale(yAxisScale).orient("left");
  21.  
  22.     var yGuide = chartContainer.append('g')
  23.       .attr("class", "yAxis")
  24.       .call(yAxis)
  25.       .attr('transform', 'translate('+padding + ',0)');
  26.      
  27. var yAxis = d3.svg.axis().scale(yAxisScale).orient("left")
  28.   .tickValues(yAxisScale.ticks().concat(yAxisScale.domain()));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top