score:1
In my experience, the index passed to any D3 accessor function is always it's index in the DOM, relative to it's parent: https://github.com/d3/d3-selection/issues/73
The workaround I've used for this scenario is to implement in the click-event either an object lookup or an array filter, matching on a unique ID.
Source: stackoverflow.com
Related Query
- Unable to get the correct index of node that was clicked in d3 and update the JSON at that location
- How to get the id of svg that was draw over other svg and delete it
- Fade links and nodes that are not immediately connected to the node hovered on in a d3 graph
- Get coordinates of clicked on node in d3 tree and centre
- Get all the data from a clicked node in C3JS
- Get the center of an arc path and get the x and y that relates to in screen coords
- D3.js: How to get the computed width and height for an arbitrary element?
- How can I get the D3.js axis ticks and positions as an array?
- Unable to get node datum on mouseover in D3 v6
- What is the correct way to import and use d3 and its submodules in ES6?
- AngularJS, D3 and JQuery in the same page. D3 can't read the correct DOM dimensions
- d3.max didn't get the correct value
- How to show and hides nodes when you move the mouse over a node in D3 Javascript
- D3 update on node removal always remove the last entry in SVG DOM
- Where can I get the .geojson file for India and not separate files for each state/territory or any other distinction?
- D3 update dataset on click and redraw the bar chart
- dagre-d3 how to click node and run an event after that
- Reusable charts in d3: how do the create and update selections work?
- How to update elements of an HTML that the elements are created using data from a CSV file?
- D3 - How to get correct scale and translate origin after manual zoom and pan to country path
- How can I connect two parent node into one child node and how to make a tooltip for each node in the tree pragmatically? in D3 js (SVG)
- How to get the same node positions in d3's force layout graph
- Does the d3 treemap layout get cached when a root node is passed to it?
- How can i get the startAngle and endAngle of each arc in the sunburst example using d3.js?
- How can I get the natural width and height of an svg image element?
- D3 treemap: reserve min width and height for the smallest node
- When using D3.js, is there a method to automatically get the closest `key` that has data?
- The difference between select using merge and selectAll in D3 update mode
- How do I get D3 Data Driven Document to display a moment.js datetime in the correct time zone?
- Draw a map with D3.js: How to get the right scale() and translate()?
More Query from same tag
- Animating and Controlling D3JS Collapsible Tree nodes and links
- Cubism rendering wrongly
- vertical bars not aligned with the x-axis label and last bar rendered outside the x-axis range - D3 js - simple bar with fixed width
- Extracting data from excel sheet into csv (or) Json using Javascript
- d3js force-directed graph draws nodes but no links
- Multibar chart(nvd3) x axis label in not centered
- How do make my plot points smooth in d3.js using projection?
- Change starting point of alongPath animation
- d3.js pie chart clock
- D3 events in new versions
- D3.js - Animated exit for nested object
- Programmatically draw block diagram in d3.js or graphviz or similar
- How to get intersection of link-edge and node in d3js?
- Is there a way to make an SVG USE subsequently modifiable (or a different technique)?
- How to make d3 path stroke to curve inside? Like the reverse of "cardinal-closed" interpolation
- injecting the d3.js graphs correctly when using Angular directive multiple times with bootstrap
- How to set minimal step for y-axis in d3.js?
- d3.json cannot parse an 'Infinity' value
- Including major minor ticks
- D3 - Polylines from label to arc in Donut or Pie Chart
- angular.js and d3.js - geometric example
- Stackbar chart in dcjs split by dimension
- Animating elements in d3.js
- Append text or circle in heatmap grid of d3js
- How to set the width and height of svg to be equal to its g?
- Multiple d3 charts on a page using the same Angular2 component
- d3.js Stack Chart
- Horizontal bar chart y axis alignment
- d3pie error: no data supplied on d3pie.js
- d3.js appending two labels from a dataset on the Y axis