score:6
Accepted answer
You can use the csv file. In order to show a tree, you will need to create an array for the nodes and another for the edges:
d3.csv('url.csv', function(data) {
var nodes = [], edges = [];
for (var k = 0, n = data.length; k < n; k += 1) {
nodes.push({name: data[k].name, size: data[k].size, id: data[k].id}),
edges.push({source: data[k].id, target: data[k].parent});
}
});
with this structure, you will be able to use the force layout, or convert the nodes, edges arrays to a tree structure.
Source: stackoverflow.com
Related Query
- D3.js - building a force directed hierachical tree from csv data
- Updating links on a force directed graph from dynamic json data
- Constructing Force Directed Graphs From Only Link Data
- Creating a D3.js Collapsible Tree from CSV data
- How to expand child from JSON, load data after click parent - D3.Js - force directed layout
- map function to get radius data from csv for d3 force layout
- how to import php script that convert mysql data to json format, from d3.json function in force directed layout
- How to load data from a CSV file in D3 v5
- Importing data from multiple csv files in D3
- Cannot import data from csv file in d3
- Select data from a CSV before loading it with javascript (d3 library)
- Curved line on d3 force directed tree
- D3 force directed graph, different shape according to data and value given?
- How to load data from an internal JSON array rather than from an external resource / file for a collapsible tree in d3.js?
- d3.js how to generate tree hierarchy from csv or table
- How to update elements of an HTML that the elements are created using data from a CSV file?
- Create tree hierarchy from csv in d3.js
- Copy data from csv into array in D3
- d3.js Force Directed Tree with Labels
- reading nodes and edges from two distinct csv files using Force Layout
- Collapsible D3 force directed graph with non-tree data
- display data from csv file into BarGraph using d3.js
- Rendering D3 data from CSV
- Plotly/D3 – Reading data from CSV into separate traces
- how to get data with tsv or csv to array in d3.js from a txt file?
- Unable to reference d3.js data imported from a csv file with spaces in the header
- d3js Force Directed Graph - Click on node to popup infobox which read from JSON
- D3 - Loading data from a second CSV
- grouped bar chart from JSON data instead of CSV
- D3.js join data from multiple csv files
More Query from same tag
- Fix position of force-graph node using D3.js
- Remove old points from line graph in d3
- d3.js Sankey using named nodes
- Filtering json data D3.js
- Filtering out multidimensional data
- I can't see the div for the 1st object data using D3
- d3-annotation + d3-zoom - Zooming without scaling
- d3.tsv/d3.csv columns in accessor (row) function
- Uncaught TypeError: Cannot read property 'length' of undefined in d3
- Reset and clear function in D3.js
- Y axis labels are cut off on D3 plot
- How to display source nodes of a clicked target?
- How to add updating labels in D3 Vertical Bar Chart in an Ember Application
- How to add popup on D3.js visualization (tree nodes)
- How to remove extras lines using stylesheet from axies in the D3.js
- D3 calculate x position from dates
- Add labels to a d3 bar chart
- D3 nodes color based on group defined in csv
- How to resolve d3js tree graph getting clipped
- Using D3.js + click events with Angular 6
- Google maps with d3.js (v5) color scale not working
- How to correctly initialize the embeding a d3.js resizable chart in a React.js component?
- Unable to render image inside D3 force directed graph
- D3: Zoom does not reset the scale
- Display information from d3.js to web inspector
- Having trouble drawing d3.js Focus+Context via Brushing chart with multiple paths
- D3js: Dragging a group by using one of it's children
- how to Show text at fixed coordinate of (x,y) in Java Script D3
- Smooth scrolling brush with scaleband like string labels
- C3.js : Jquery change method with 2 dropdown list