score:1
one problem i can see from the code is in this section:
function clonespeciesmaker(d) {
var svg = d3.select('svg');
//original becomes copy
d3.select(this)
.classed('original',false)
.attr('class','copy');
// creates new 'original' in place
var data = [{cx:d.cx,cy:d.cy,r:d.r}];
svg.append('circle')
.data(data)
.attr('class','original')
.attr("cx",function(d) {return d.x})
.attr("cy",function(d) {return d.y})
.attr("r",function(d) {return d.r})
.style("fill","purple")
.attr("class","original")
.call(dragoriginal);
}
you are setting the data like this
var data = [{cx:d.cx,cy:d.cy,r:d.r}];
but you are doing which is incorrect d.x and d.y is not defined by you in data.
.attr("cx",function(d) {return d.x})
.attr("cy",function(d) {return d.y})
this should have been:
.attr("cx",function(d) {return d.cx})
.attr("cy",function(d) {return d.cy})
Source: stackoverflow.com
Related Query
- Append element on d3 dragstart
- Append SVG canvas to element other than body using D3
- Append DOM element to the D3
- D3 append element only if element not exist
- Append foreignObject containing some HTML inside an SVG element
- Can I append a literal SVG element with d3?
- How to append a text element with inline tspan children?
- Is it possible to append text to a text element in SVG?
- How to append a new div element that is sibling of first div created using d3?
- Append d3 svg to current ng-repeat element
- D3.js append tspan to text element
- SVG D3.js append element to SVG g:circle on text mouseover
- Append objects equal to the sum of every element in an array
- How do you append a svg image to a rect element of another svg image?
- d3.js - understand arrow function to append element to g
- D3JS: Unable to append a text element only once
- Append element (rect) with variable width after each x-axis coordinate position from previous element
- d3 append copy of g element on click to separate div
- how to conditionally append element in D3 .enter() function
- How to append `text` element by conditional in d3js
- Why text append outside svg element d3js?
- append svg:text below each rect element
- D3js append different ellements into SVG in d3.hierarchy by type of JSON element
- Append an SVG Element to HTML Table Cell Using D3.js
- d3js append circle shape on line element in Force directed graph?
- D3.js Invisible rect element when using d3 append to add "rect" elements to an svg
- d3.js not returning a dynamically constructed html element on append
- Append an Entire SVG Element or Series of Elements
- addEventListener doesn't work for element added by append method from d3js
- How do append a <text> for every element of the data in a D3 svg
More Query from same tag
- Directed acyclic graph using d3.js without DOT
- How to apply specific colors to D3.js map based on data values?
- Drag & Drop SVG Shapes Using D3 and AngularJS
- Adding data label in D3 Line chart (for Power BI)
- D3 force layout with clustering to the top based on size
- D3: scale and color for choropleth map
- How to import D3 package before another script/ package which requires D3?
- Filtering data to conditionally render elements
- How to highlight the similarity of the value between rows and columns?
- A function in d3.js to create start and end nodes and node and link texts from a JSON source of varying size
- SVG tag mousedown event with D3
- dc.js line chart is not showing anything
- How to pass values between drag.start and drag.end in d3
- Make circles match same color filtering as multi-line on d3.js?
- Increasing the Pseudo-Area of D3 Path Link For Easier D3-Tip Event Trigger
- plotting data points on waves from dynamically generated data using d3.js
- Drag and linking rectangles, d3+js
- D3.js multiple force layout graphs from json file
- How do I place a D3 tooltip inside a div?
- d3 animate path by arc
- d3: How to add border to a circle on an if-condition?
- place nodes generated from a force to a radial scatter plot
- Getting color from external image using JavaScript
- D3Plus Header Modification
- Overlap of Elements in d3.js Word cloud
- SVG Marker Not Working
- Manually positioning ticks on axis - D3
- Add colors to dimple.js bar chart based on value and add goal line
- D3 Mathematical Function Create
- JS error for d3-brush in d3 v4 implementation