Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
68
rated 0 times [  73] [ 5]  / answers: 1 / hits: 103461  / 12 Years ago, wed, december 5, 2012, 12:00:00

Can someone please explain the difference between datum() and data() in D3.js? I see both being used and I am not sure why you should choose one over the other?


More From » d3.js

 Answers
6

I found the correct answer here from Mike himself:



D3 - how to deal with JSON data structures?



If you want to bind your data to a single SVG element, use



(...).data([data])


or



(...).datum(data)


If you want to bind your data to multiple SVG elements



(...).data(data).enter().append(svg)


.....


[#81600] Tuesday, December 4, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shantelc

Total Points: 737
Total Questions: 120
Total Answers: 104

Location: Nicaragua
Member since Tue, Dec 8, 2020
4 Years ago
;