HumbleSoftware / Flotr2

Graphs and Charts for Canvas in JavaScript.
http://www.humblesoftware.com/flotr2/
MIT License
2.45k stars 528 forks source link

Mouse tracking broken in bar chart for null value (with fix) #267

Open sveint opened 10 years ago

sveint commented 10 years ago

Hi,

I just noticed that if you pass in data where some values are null, geometry in line 154 of bars.js will also be null, leading to an exception. Reason for passing in null data is that for line graphs for instance, you need null data to make the lines disconnect (even the examples show this), and I use bar and line interchangibly with the same data.

A simple fix is to perform a test for geometry !== null before proceeding, which seems to work fine.

https://github.com/HumbleSoftware/Flotr2/blob/master/js/types/bars.js#L154

cesutherland commented 10 years ago

Hello, could you add the check and submit a PR?

sveint commented 10 years ago

Was about to make a PR when I saw someone already made one (a year ago):

https://github.com/HumbleSoftware/Flotr2/pull/212/