radar-chart-d3 icon indicating copy to clipboard operation
radar-chart-d3 copied to clipboard

Fix for tooltip variable usage

Open dfernandez79 opened this issue 9 years ago • 0 comments

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.

dfernandez79 avatar Apr 06 '15 21:04 dfernandez79