score:2
You need to keep the parent in variable and iterate over them to prepare nested data as
var divs = d3.select("body").selectAll("div")
.data(dataArr)
.enter()
.append("div")
.attr("class", "outerDiv");
var innerdiv = divs.selectAll("div")
.data(function(d){console.log(d); return d.stats}) //passing nested data
.enter()
.append("div")
.attr("class","innerdiv")
Sample fiddle is here http://jsfiddle.net/Qh9X5/9666/
Source: stackoverflow.com
Related Query
- Loop only through nested elements of the array item from D3 selectAll creation from data()
- loop through array and assign each item as a class in html tag using d3
- How to find the max/min of a nested array in javascript?
- Loop through array of arrays in D3
- How to update elements of an HTML that the elements are created using data from a CSV file?
- Looping through data attributes to create 4 separate bar charts... why are there "phantom" data elements being bound to the xAxis?
- Display only values from the data set into X axis ticks
- How to get the specific JSON array from a value in that array
- D3.js: "On the fly" added elements to array are not refreshing the svg graphic
- How to access the inner array resulting from d3.groups?
- Why does converting a negative string into a number ( +"-2.333" ) return NaN, only when the string came from d3.format function?
- Loop through array to append circles using d3
- How do I get the index number from the array in d3?
- Why d3.domain() has only one element when I use the whole data array as domain?
- Do I have to re-join the whole data set even if only one property in one item changed?
- D3 transition from stacked bar to bar chart only works the first time
- d3 plot missing the first item in an array
- d3.js — creating HTML table from 2 dimensional array but excluding the first inner array?
- calculate the date diff in javascript from JSON array
- Adding a key to nested elements in a d3.js chart with the data() method
- D3.js moving from tsv to json with nested array
- How do you call data from nested JSON array using d3?
- How to return only unique value from array objects bound to an element in d3.js
- NetworkD3 Sankey Plot in R: How to switch text labels from the right to the left of the inner nodes only
- How to find the extents in an array of nested objects?
- How to reshaping Data in Javascript from array to object without losing some of the data
- How can I Loop through array to assign html to tooltip
- D3 v4: spacing between and binding of elements of arbitrarily complex array with nested g tags
- Updating only those SVG elements where the underlying bound data has been modified
- Adding tooltip to SVG elements with text from an array
More Query from same tag
- How can we use d3.js in a ruby on rails document?
- How to make hierarchical/zoomable ticks in D3?
- D3.js plot: SVG z-order of foreignelement not working in firefox
- XAxis repeats itself in Rechart's ScatterChart when type="category"
- Display an arrow head in the middle of D3 force layout link
- How to get D3 csv data into a different variable
- How to cumulate d3.rollup data by year
- dc.js with crossfilter and d3, how to load multiple csv files at once, without knowing how many files the user will upload
- generate D3 html pages with R?
- How to remove/disable width 100% automatically?
- Using d3, what is the easiest way to draw a 10000 km2 polygon on a map?
- D3v4 time scale axis error in ticks display
- DC.js original ordering of ordinal scale on lineChart
- Click is not emitted when sending element to foreground
- Plugging in d3-force-3d calculations into a 3-D graph renderer
- Artifacts in Natural Earth Data railroad map
- Ignoring (but still working with) Non-conforming Lines in CSV for Updating Data
- Parsing month/day/year date format in D3
- setTimeout in D3.js
- D3 update not updating new Array
- D3JS chart: Hovering on some transitioning elements while others are still transitioning too stops the execution of the chart animation
- Equal distant scale ticks in d3
- D3 multi-line chart - Error: <path> attribute d: Expected number, "MNaN,NaNLNaN,NaNC…"
- Venn diagram layout with d3.js
- Flatten an Object hierarchy created with d3.js nesting
- D3.js: Force-directed graph, edge length proportional to edge weight
- D3 donut chart based on seasons with fixed labels
- D3.js line chart highest y axis smaller than highest line
- D3.js version 6: Loading a CSV and changing Variable types
- Issue with D3 zoomable treemap