I’m adding input controls to modify my chart dynamically (here) and I’m taking inspiration from these notebooks (one and two).
Checkbox to choose continents seems work as expected, while the radio button to choose visualization does not show texts that should be there (but for example it shows them if I go to use the height slider). Watch here:
So technically I am trying to reach the situation that in the Join view, it remains as in the original version (here)*, while in the Split view it should be like as it shows now but with the texts above visible and centered according to continents columns (which can also be modified with the checkbox).
Opinions on this method that I am using? Can you help me understand where the mistake is?
*Idkw If I comment all the method I used, Join view shows the original version.
Furthermore, I saw, at the end of the svg function, someone using Object.assign() and after an update function but I didn’t catch how it works at all or whether it’s better, like in these notebooks (1), (2), (3)
showTitles is called,
scale.domain() is undefined. One way to fix this is add the line
scale.domain(graph_filtered.map((d) => d[visualization]))
as the first statement of your
showTitles function. You’ll probably need to work on the alignment, too, though.
Object.assign(target, object) will assign the properties of
object to the
target. In the cases that you point to, the
object contains update functions for the SVG. The advantage is that you can call those functions in response to a button click, rather than having the entire visualization be regenerated. That can certainly yield beautiful results but might or might not be necessary in every situation.
Ok thanks! It seems to work except for the centerings of the writings as you said, now I will try to arrange them according to the values of the largest circles in their category.