score:1
The var root is set where it calls a function (classes), but when that function is defined it is passing in the root object.
No, it simply has a parameter that is named root
. This has nothing to do with the root
variable outside of the function.
You could rename the function parameter for example foobar
(function classes(foobar)
, and inside recurse(null, foobar);
), and things would still work exactly the same.
score:0
Your confusion is completely understandable, considering there are two uses of root
, and they don't refer to the same thing.
Note that classes
is invoked by classes(data)
, so the root
in the classes
function refers to the data loaded in flare.json
, while the root
in your data loading function is a d3 object, returned by d3.hierarchy
.
I would recommend renaming the root
parameter in classes
so there's less confusion.
Source: stackoverflow.com
Related Query
- Javascript: var is equal to function which same var is passed into
- JavaScript d3 passing arguments into a function that references d3.event.y
- How to append javascript file to the body from javascript file which is in the same directory. Java server faces 2 JSF2
- How to load a csv file from static in django into javascript function
- how can i use correctly the functions which have been already developed in javascript into an application in angular 4?
- How do I assign ticks to be equal to a different key value from the same object from the one on which the axis is based on in D3.js?
- how to pass same object on which javascript event is called in d3.js
- Javascript D3.js d3.json() function not accepting valid json, what to do to use it the same as d3.csv?
- Getting same value from javascript function
- Javascript library d3 call function
- How to add in zero values into a time series in d3.js / JavaScript
- What object type is the instance element parameter pass into the link function of an angular directive?
- Converting Javascript function to Typescript including getComputedTextLength()
- D3: use nest function to turn flat data with parent key into a hierarchy
- Why Babel 7 uses require() function for browser which knows nothing about it?
- Map function in D3, confused about multiple functions passed in
- Passing Object function into data() in d3
- Javascript - function argument
- Translate d3.js JavaScript function to CoffeeScript
- Javascript - How to pass original object to callback function
- Javascript function returns undefined
- Javascript manipulate data into array of object for d3 stacked chart
- Probability density function with javascript d3 and dc
- javascript / d3 - passing parameters to a function
- How would I import a single column CSV file into a pie chart using Javascript D3?
- How to send this D3.js element to another element's on-click function in this recursive Javascript
- Call JavaScript function from SVG file
- How to convert d3.value() iterable and d3.rollup from javaScript into TypeScript
- Merge two javascript objects if key is equal with either lodash, vanilla js, or d3
- How to call a function on click of a checkbox which is a popup on click of d3 element like rect
More Query from same tag
- d3-drag - rescale y-axis with drag in d3v5
- Need to create a line within x and y axis in d3 v5
- Rickshaw : data for multiple series not working
- Responsive d3 bubble chart
- Styling not working in Mozilla Firefox
- Forcing y-axis to 0 when using chained transitions
- How can I color one Y-axis line different from the other grid-lines?
- How to use elements of a JSON object to change attributtes in animation of a D3 bubble chart
- more minimaler cubism.js horizon chart from json example
- Want to Make my chart look responsive in D3
- D3 forced layout zoom and pan not working
- Scaling geographic shapes to a similar size in D3
- Sum Of count in D3
- How can I perform this d3.js magic (Grouped Bar Chart) with JSON rather than CSV?
- d3 map point only drawed in topleft corner
- Controlling bar position with tickValues in d3.js
- Custom coordinates and axis range on leaflet.js
- Why are there no ticks on my X (time) axis?
- D3 tree with predefined depths
- Iterating over array elements in d3.js to add to button
- Learning Map / Syllabus Visualization
- Why is .delay() not iterating properly?
- How to find out about loaded d3.js extensions and their versions at runtime?
- Setting color in D3 based on data like a boss
- Multi Line Graph D3.js
- Change color on a map D3
- JS D3 Update force Graph with Websocket
- sorting nested data in d3.v4
- How to remove extras lines using stylesheet from axies in the D3.js
- d3 force layout - positioning nodes