score:1
Accepted answer
In
nodes.forEach(function(o, i) {
o.y += i & 1 ? k : -k;
o.x += i & 2 ? k : -k;
});
You are using the index i
for clustering... this won't work, you want to use arrInt[i]
instead:
nodes.forEach(function(o, i) {
o.y += arrInt[i] & 1 ? k : -k;
o.x += arrInt[i] & 2 ? k : -k;
});
Source: stackoverflow.com
Related Query
- Grouping nodes in d3.js in multiforce layout
- Adding new nodes to Force-directed layout
- D3 Tree Layout Separation Between Nodes using NodeSize
- Simple graph of nodes and links without using force layout
- d3.js: "Cannot read property 'weight' of undefined" when manually defining both nodes and links for force layout
- D3 force layout - linking nodes by name instead of index
- Avoid collision between nodes and edges in D3 force layout
- Update existing nodes in a d3 Force Layout
- Space out nodes evenly around root node in D3 force layout
- How to visualize groups of nodes in a d3 force-directed graph layout
- Increasing gap between nodes of my D3 tree layout
- d3js create a force layout with fixed nodes
- Stop Force Layout on d3js and start free dragging nodes
- d3.js: How to remove nodes when link-data updates in a force layout
- Place pie charts on nodes of force directed layout graph in D3
- Adding nodes dynamically to D3 Force Layout in version 4
- d3 force layout nodes always start at top-left of screen
- D3 force layout graph with nodes positioned in a grid
- Detecting visible nodes in d3.js force layout after zoom-pan
- How to make labels and nodes in D3 forced layout clickable to navigate to a URL?
- Setting different images for D3 force-directed layout nodes
- Reposition nodes in a multi-foci d3 force layout
- Dragging nodes with labels in d3 v4 force layout glitches
- d3js (v4) canvas force layout with text on nodes
- D3.js how do I arrange nodes of a force layout to be on a circle
- Speed up d3 force layout with many nodes and links
- Layout with hierarchical grouping Cola.js a.type not a function?
- reading nodes and edges from two distinct csv files using Force Layout
- Avoid overlapping of nodes in tree layout in d3.js
- D3js force layout - line with gradient between nodes
More Query from same tag
- How to Stack circles using d3js with lable and values
- How does d3.js decides how many and which ticks to show?
- horizontal lines along the y axis d3 bar chart
- nvd3.js How to disable tooltips for one serie only
- How can I get only elements with odd ids from a D3 selection?
- d3js multi-line scatterplot zoom
- How to store a JSON object loaded from a file?
- d3js Text Transitioin - example code not working
- How to normalize data in d3 and plot the lines in the axis independent of other line ranges
- How to remove gaps in C3 timeseries chart?
- d3.js force directed graph sphere
- d3.js onclick event uses the value of variable at time of click instead of at time of drawing
- Increase circle radius on drag until event is fired (D3js)
- power bi custom visuals use json file
- Append rectangle to line graph to show weekends
- Is it possible to not reorder elements when using d3.join?
- Showing total count for bar chart in c3js tooltip title
- Tooltip in linegraph doesn't show using d3-tip
- is it possible to tweak the d3 bubble chart to obtain the bubbles at scattered positions instead of a circle pack?
- Update real time d3 chart by socket.io
- d3.js function to filter the interactive chart
- d3 how to add ID from geojson to path
- Expanding D3 Pie Chart to fill SVG
- nvD3 Lineplusbar chart tool tip shows incorrect date (12/31/1969)
- d3 axis and label clipping
- Dc.js - Row Chart with dynamic height
- Dimple.js scatter plot not drawing correctly in Firefox v. 38.0.5
- D3js sorting issue on transition applied
- Center align two text elements without overlap in a rectangle
- Call Django View from D3.js onclick event on Heatmap