krispo/angular-nvd3

Tooltip gets stuck after refresh data (updateWithOptions: true)

miguelrincon opened this issue · 6 comments

I am updating to 1.0.0-rc.2 with nvd3 1.8.1 an I am experiencing some problems with the tooltips.

My pie chart is refreshed every 10 seconds with new data from an ajax call, if I happen to to hover the chart so a tooltip is shown WHILE the refresh happens, the tooltip stays stuck in the same position and is never removed from the DOM.

In my setup updateWithOptions is true

tooltips

Since nv.tooltip.cleanup is removed from this version of nvd3, no cleanup happens on clearElement.

I am able to make things work normally by forcibly removing the tooltip in the clearElement function like this:

// Fully clear directive element
clearElement: function (){
    /* ... */
    if (scope.chart && scope.chart.tooltip){
       d3.select("#" + scope.chart.tooltip.id()).remove();
    }
    /* ... */
    scope.chart = null;
},

Not sure if this is the right approach and also I hope not to have to hack this tool.

I am using angular v1.4.2 and I was not able to reproduce this issue on a lineChart.

owaaa commented

Having the same issue on discrete bar chart. Thanks for the workaround

I was also able to reproduce this issue using the donut chart.
The workaround also worked for me, though it would be nice if the tooltip could refresh with the new values.

I am using:
Angular v1.3.16
angular-nvd3 v1.0.0-rc2
nvd3 v1.8.1
d3 v3.5.6

Yup, same here. I am seeing this on the pie chart.

Same here. Is there a fix expected?

Same here... also removing them by hacking it.

@miguelrincon thanks, your approach is correct. In the latest releases [1.0.3+] all it's fixed.