cecilialee
2/22/2018 - 11:39 PM

Create a circle in D3

Create a circle in D3. #javascript #d3

// create y in linear scale
var y = d3.scaleLinear().domain([15, 90]).range([250, 0]);

// create x in log scale
var x  = d3.scaleLog().domain([250, 100000]).range([0, 600]);

// create r in radius scale
var r = d3.scaleSqrt().domain([52070, 1380000000]).range([10, 50]);

// append circle and attr to svg
svg.append('circle').attr('fill', 'red').attr('r', r(1380000000)).attr('cx', x(13330)).attr('cy', y(77));