Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • I'm getting the error of [Cannot read property 'force' of undefined]. I made sure that the height and width within the simulation line has valid values which is does. I tried logging the result of the d3.forceCenter function, and it returns another function. Is there something that I'm missing? It seems so close, but I can't figure out where I'm going wrong. Any suggestions? Commented May 14, 2020 at 20:35
  • 1
    Your Blockbuilder example doesn't have a simulation variable like the lwc-recipes example. Not sure that part is needed since a tree grid would probably stay vertically aligned at the top anyway. Have you tried removing that line and seeing what happens? Commented May 14, 2020 at 20:44
  • Yeah, realized that as well after posting. Removed it and it's working for the most part, except for some tweaks that I need to make. Thank you so much! Commented May 14, 2020 at 20:47
  • one last question. The last function that I am trying to add the snippet of code to set the svg height is a toggle function. So as a result I am getting the expanded svg height when its collapsing and the collapsed svg height when its expanding. Any suggestions? Commented May 14, 2020 at 21:38
  • 1
    I was able to get it to work. I needed to have the height determination function near the start of the function that was getting called last. I also needed to wrap it in a Math.max() to get the greatest either from the getBBox() or from the calculation determining the size of all the rectangle elements holding the different values (nodes.length * barHeight + margin.top + margin.bottom). Once I did that it worked perfectly! Thank you for the help! Commented May 18, 2020 at 12:25