-
dvpavan153November 21, 2017 at 1:50 pm #8105
Dear Tom,
First of all, Thank you so much for your valuable feedback.
1) As you suggested in the first point, I have removed all the unnecessary content from my code.
2) I have created variables as you suggested like viz, viz1, theme, theme1 and dataarray, data1array. I have completely commented out / removed the onclick, onmouseover etc functionalities for now.
3) My only intention now is to first draw the two trees with two different datasets using the above-mentioned variables.
Approach for the first tree, at function, initialize(),
viz.data(dataarray) // Expects hierarchical array of objects.
.width(600) // Width of component
.height(600) // Height of component
.children(function(d) {
return d.values
}) // Denotes the property that holds child object array
.key(function(d) {
return d.id
}) // Unique key
.value(function(d) {
return Number(10);
}) // Returning some random number
.fixedSpan(-1) // fixedSpan > 0 will use this pixel value for horizontal spread versus auto size based on viz width
.label(function(d) {
if (d.depth == 0) {
return trimLabel(“Zoo Health: ” + d.values[0].childProp_Health); //Label for root node
} // returns label for each node.
return trimLabel(d.key)
})Approach for the second tree, at function, initialize1(),
viz1.data(data1array) // Expects hierarchical array of objects.
.width(600) // Width of component
.height(600) // Height of component
.children(function(d) {
return d.values
}) // Denotes the property that holds child object array
.key(function(d) {
return d.id
}) // Unique key
.value(function(d) {
return Number(10);
}) // Returning some random number
.fixedSpan(-1) // fixedSpan > 0 will use this pixel value for horizontal spread versus auto size based on viz width
.label(function(d) {
if (d.depth == 0) {
return trimLabel(“Zoo Health: ” + d.values[0].childProp_Health); //Label for root node
} // returns label for each node.
return trimLabel(d.key)
})Issue: The children, key, label functions work flawlessly for the first tree, they are not giving expected output for the second. As a result, I can’t even draw the second tree in this approach.
I am sharing the google drive link with updated code,
https://drive.google.com/open?id=12ksFkjnc_Y6z8_-ROTS_aNTANVhh933IMy intention here is if the two trees can be drawn initially with this separate variable approach, I will focus further on the onclick, onmouseover etc events to make my tree fully functional.
Once again, Thank you for your time and effort for providing me the necessary feedback. It means a lot to me.
Regards,
PavanYou must be logged in to reply to this topic.
© 2024 — vizuly.io