Skip to content

Conversation

@dfernandez79
Copy link
Contributor

Tooltips are not rendered correctly because there are multiple problems with the tooltip variable:

  1. There is a typo "toolip" in src/radar-chart.js@29
  2. setTooltip uses the closure tooltip, which is created in chart. The problem is that if you reuse the graph as shown in the README example, all the graph instances share the same tooltip variable. So the last value set is the one used.

This PR does a small correction in setTooltip, there is also another issue inside that function (the y variable in src/radar-chart.js@38 is declared global by mistake :(

I would recommend to add jshint to catch those errors, and to enclose RadarChart with a function to 'use strict' and avoid those hard to find problems. I'll do it in a future PR, however the change is not so small and merging will require more eyes.

michalgm added a commit to michalgm/radar-chart-d3 that referenced this pull request Aug 6, 2015
* Use d3.mouse to set tooltip coordinates offset to container
* Bind tooltip node creation to .enter() selection so elements aren't added in every radar() call
* localize tooltip variable - (as in alangrafu#32)
* Add 10px offset to tooltips to avoid pointer collision
* Reorder layers to ensure they are in proper order
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

Successfully merging this pull request may close these issues.

1 participant