Forum Discussion
How to replace/remove SVG-Elements by using EventListener
- 8 years ago
At first , "this.absline.parent" is not correct. It seems you should use something like this:
d3.select(this.absline.parent).selectAll("*").remove();We would also recommend not to remove/create an element for each event as adding/removing elements from DOM is a very expensive operation.
It'd be better to keep a single element and change its position for each event.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
At first , "this.absline.parent" is not correct. It seems you should use something like this:
d3.select(this.absline.parent).selectAll("*").remove();
We would also recommend not to remove/create an element for each event as adding/removing elements from DOM is a very expensive operation.
It'd be better to keep a single element and change its position for each event.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Thank you very much.
yes it makes more sense to create 1 static object and change it for each event.