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

NVD3.js Tooltip Failure on Multiple Charts of the Same Type #587

Closed
rchaudhuri opened this issue Jun 12, 2014 · 3 comments
Closed

NVD3.js Tooltip Failure on Multiple Charts of the Same Type #587

rchaudhuri opened this issue Jun 12, 2014 · 3 comments

Comments

@rchaudhuri
Copy link

I’m experiencing an issue with the pieChart(), where if I create two pie charts of the same type, i.e. using the same JSP, then the tooltips for the older one stops working. I.E. I create piechart1, which has tooltips, then I create piechart2, which has tool tips, but then the tooltips on piechart1 stops working.

I traced this down to the nvd3.js code and found that since pieChart() calls pie(), the tooltips start with the below inside of the function chart(selection) within the pie(). What seems to be happening is that the second I create another pie chart, the d3.event comes back as NULL for the previous pie. Therefore, the dispatch.elementMouseover call fails. Any ideas how to get around this? My use case is that a user may want to utilize the same graph twice with two difference time frames.

 var ae = slices.enter().append('g')
          .attr('class', 'nv-slice')
          .on('mouseover', function(d,i){
              alert(d3.event);
              d3.select(this).classed('hover', true);
            dispatch.elementMouseover({
                label: getX(d.data),
                value: getY(d.data),
                point: d.data,
                pointIndex: i,
                pos: [d3.event.pageX, d3.event.pageY],
                id: id
            });
            alert("done tooltip!");
          }) 

I really appreciate any help you can give me. The problem seems to be that the d3.event on the old chart dies the minute a chart of the identical type (or should I say identical JSP) is loaded.

@liquidpele
Copy link
Contributor

Should be fixed since my example has 2 pie charts on the same page.

@5ri
Copy link

5ri commented Jan 28, 2016

I am having the same problem ....

@liquidpele
Copy link
Contributor

Make sure you are on the latest version 1.8.2, and if the issue still happens then create a jsfiddle that demonstrates the problem (you can link to versions on github using rawgit.com)

This issue was closed.
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