susielu/d3-annotation

"wrap" is performance heavy

pbadenski opened this issue · 3 comments

I have a dynamically updating graph on a page with annotations. It updates around 2-3 times per second. It's working rather well with the only exception of "wrap" calls which incur a big performance penalty (probably 60% - 80% of the total cost of rendering the annotation).

One way to address that would be to allow the user to disable wrapping. Not ideal - but does the trick when performance is the priority.

What is the code you're using on update? Are you re-calling the function or using the .update() function? the .update() shouldn't re-wrap it should only handle position changes. I'm curious if you're seeing otherwise though.

Recalling the function. I think this is only option for me - labels are dynamic and I'm using dynamic force-directed positioning for notes.

Ahh okay so your text is changing while it animates? (just curious) regardless I think it makes sense to add a 'don't wrap' option