{
const width = 950;
const height = 500;
var svg = d3.create("svg").attr('width', width).attr('height',height);
const originX = width / 2;
const originY = height / 2;
const xScale = d3.scaleLinear().domain([-width/2, width/2]).range([0,width]);
const yScale = d3.scaleLinear().domain([-height/2, height/2]).range([height,0]);
console.log(xScale(100));
svg.selectAll("circle")
.data([{x: 100, y: 200, xPos: 100, yPos: 200}])
.enter().append("circle")
.attr("cx", d => xScale(d.x))
.attr("cy", d => yScale(d.y))
.attr("r", 100)
.call(d3.drag()
.subject(function(event, d) { return {x: xScale(d.x), y: yScale(d.y)}; })
.on("drag", dragged));
console.log(svg.node());
function dragged(event, d) {
console.log("d.y: ", d.y);
console.log("event.y: ", event.y);
d.x = xScale.invert(event.x);
d.y = yScale.invert(event.y);
d3.select(this).attr("cx", event.x).attr("cy", event.y);
}
return svg.node()
}