score:1
Accepted answer
the easiest way to do this would be to filter your update selections on the depth (depth === 0 is the root node):
var node = vis.selectall("g.node")
.data(nodes, function(d) { return d.id || (d.id = ++i); });
node = node.filter(function(d) { return d.depth > 0 });
you'd also have to do this for the links:
var link = vis.selectall("path.link")
.data(tree.links(nodes), function(d) { return d.target.id; });
link = link.filter(function(d) { return d.source.depth > 0 });
Source: stackoverflow.com
Related Query
- How I can hide the root element in a dendogram d3
- How can I use an Angularjs filter within the html element of a d3 tooltip?
- how can I see the current element that represents a bar to which the hovering is applied
- How can I get the dom svg element from d3 node data?
- How can I animate the top of my svg element like in this gif using d3.js?
- How can I set the background color of a svg element which contains a D3 heat map?
- How can I hide lines from the axes of my bar chart?
- How can you change the element drawing order depending on the datapoint index?
- How can i get the key of an element in stack-layout in d3?
- D3 - How can I show/hide a text element when hovering a circle element created from different attributes of the same data entry?
- How can I hide the date on the x axis?
- how can i hide the names of ancestors of a node
- How can I toggle the value of an svg text element with D3.js when user clicks the text?
- How to access the DOM element that correlates to a D3 SVG object?
- How can I bring a circle to the front with d3?
- How do I get the width of an svg element using d3js?
- d3.js - How can I set the cursor to hand when mouseover these elements on SVG container?
- How can I get the D3.js axis ticks and positions as an array?
- MultiBar chart with nvd3 / d3 only shows labels for every other tick on the x-axis. How can I get them all to show up?
- How can I change the radius and opacity of a circle in d3?
- how can I exclude an element from an Angular scope?
- New to nvD3 - how can I make my unix timestamps appear as dates on the x-axis?
- How can I start with all the nodes collapsed in d3js?
- How can I get "call" to execute for each data element in D3?
- How can I toggle the class of all elements in a selection?
- d3.js when click outside the elements, hide the element
- How can I set min/max of the x-axis in Rickshaw / D3?
- How can I set the each line color or width in SVG path
- D3.js - How can I add a new line to the text in this Collapsible Tree?
- d3.js: how can I get 'full width' ticks on the y-axis
More Query from same tag
- Wrapping Text in D3
- Is it possible to interactively visualize 10000 31x31 contour plots?
- D3.js streamgraph transition plots nothing
- D3.js Unable to get map zooming to work in Webkit browsers
- how can i group JSON data into the weeks according to calender?
- How do I center a donut chart inside an svg
- Can we change the padding property of pack layout with a transition?
- D3 js BoxPlot with already calculated data
- CloudFront Image error when used in D3
- How do I structure data in php to get the correct json result?
- combining class="{{...}}" expression w/ ng-class="{'className' : boolean}" expression?
- Cannot find module 'd3-selection', 'd3-shape', 'd3-scale'
- width attribute not working with d3 style
- Data driven colour in D3.JS SVG circles
- Opacity of font not rendering
- Sorting bar chart in D3 not working
- d3.js json uncaught syntax error unexpected token o
- d3 graticule with fill color?
- Tooltip is invisible on javascript graph
- Dimple.js Stacked Bar Graph
- Zoom on multiple areas in d3.js
- How to embbed data in d3 script?
- Using dc.js with data dimension in array
- Trouble inserting GLTF file viewer in html (using 3js)
- d3js elements not updated when data is updated
- associating a javascript object to an SVG element
- SVG path transition works different in Firefox
- continuous loop between first and last element
- SVG dx+text-anchor middle have different behavior into chrome and firefox
- unable to add label to node on force directed graph