Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destructor - Tooltip node #100

Open
gfduszynski opened this issue Jan 30, 2018 · 3 comments
Open

Destructor - Tooltip node #100

gfduszynski opened this issue Jan 30, 2018 · 3 comments

Comments

@gfduszynski
Copy link

Hi,
Is there a chart destructor which removes chart tooltip node?

Upon entering a view I'm creating chart instance and I would like to destroy it upon leave.
I don't see a way to remove the tooltip node without using hacks.

@drewnoakes
Copy link
Collaborator

Good point. An easy way to do this should be added.

For now, a quick workaround (based on this code) is:

// remove the tooltip element from the DOM completely
var tt = chart.getTooltipEl();
tt.parentNode.removeChild(tt);

Or to hide it, in case you need it back again later:

chart.options.tooltip = false;
chart.updateTooltip();

Or:

chart.getTooltipEl().style.display = 'none';

I haven't tested any of these snippets though.

If someone wants to put together a PR that addresses this issue, it'd be great.

cc @Sly1024, @jpmbiz70, @ralphwetzel

@jpmbiz70
Copy link
Contributor

@gfduszynski I'm curious of the use case of why you want to remove the tooltip node or destroy it upon leave? Can you explain?

@gfduszynski
Copy link
Author

gfduszynski commented Jan 30, 2018

Thanks for quick feedback.
I'm doing prototype UI in kiosk type device, based on raspberry pi compute module 3.
Resources are somewhat constrained and I aim to keep node count low to maintain fluid animations.

I'm displaying 2 charts on one of my views.
During daily use I estimate tooltip node count could grow to hundreds.
Device will rarely be rebooted, so this will likely eventually lead to crash.

BTW: Suggested fix (first one) is good enough for me 👍 for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants