I am trying to learn how to use a new library, Labella. It basically does all the underlying manipulation of SVG elements in a data visualization so they don’t overlap each other on the webpage.
In order to understand how it works, I wanted to first recreate one of their demos.
This is their demo: http://twitter.github.io/labella.js/with_text.html
And this is my recreation: https://codesandbox.io/s/frosty-dew-1c7kq
I am getting stuck at this line:
var bbox = dummyText.text(labelText(movie)).getBBox();
Even though I copy/pasted the demo’s dataset into my own code, the
dummyText.text(labelText(movie)) is returning
undefined. So of course,
dummyText.text(labelText(movie)). is also undefined and
getBBox() errors out.
Why does my code return
undefined from the exact same dataset that demo has…?