Open adschm opened 3 years ago
it can't be achieved by onrendered
option?
The repositioning is working, but the icons jump from their original position to the new one, which looks quite unprofessional:
https://jsfiddle.net/adschm/213wufbc/15/
I was hoping that redraw would be early enough to prevent this.
Off-Topic question: Is there any nicer solution available (something like the old d3.translate) to retrieve the existing location apart from the getTranslation function I use here?
Update: After looking at the fiddle again I see that onrendered appears to do the job for the first rendering, and only the update via .load() is the problem.
Update 2: load.done solves the issue for refresh:
https://jsfiddle.net/adschm/oda34ps2/3/
However, then I need another hook for the initial positioning. (Initial positioning also works if I simply call the function to reposition directly after bb.generate(), but IMO that's a race condition and only working "accidentally")
Update 3: the load.done approach breaks when arcs are deselected/hidden via clicking the corresponding legend item ...
I ended up with a combination of load().done and onrendered:
This actually works quite well.
Still, providing an "onredraw" hook would improve the situation by not having to call the function twice on reload. While this appears to be cheap for me (at the moment), it might be more expensive for similar cases with other manipulation algorithms.
I'm trying to implement a third-party mechanism for text overlap reduction in my code.
Currently, I'm just using onrendered to hook my function, which will have the label jump into position after each chart update. I would like to see a hook that is earlier in the process, e.g. something like the $redraw that appears to be only available for plugins ...