lazzhadji / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

multiple y axes cause a loss of position data if the first y axis is not graphed #687

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Issue is as follows:
1) There are multiple data sets that use multiple y axes.
2) The first y axis is not being used.
3) We have bound a hover event.
4) We are using the "pos" object y coordinate.  

When the above criteria are met, the "pos" object in the hover bind function 
will have a value for "y2" (or whatever the axis you are using), but not for 
"y".  I have not tested to see if the same holds true for multiple x axes.  

You can see this error at the following js fiddle:
http://jsfiddle.net/aedile/GsBNX/2/

Using firefox and firebug, hover over the graph and notice that there are 
errors kicked off that say "pos.y is undefined".  If you turn on the "A" series 
by checking the "A" box, and hover over the graph again, then the errors stop.  

As a stop-gap measure, I added an invisible primary axis, as well as a default 
empty data set that is always "plotted".  This ensures that there is always a 
plot with the first axis, which seems to solve the problem.  This represents a 
"hack" users facing similar issues can implement until such time as this bug is 
fixed, and should not be considered a permanent solution.  

You can see this solution implemented at the following js fiddle:
http://jsfiddle.net/aedile/GsBNX/3/

Environment: 
Windows 7,
Firefox 11.0, 
jQuery 1.7.1,
flot 0.7

Original issue reported on code.google.com by jrcg....@gmail.com on 17 Apr 2012 at 3:52

GoogleCodeExporter commented 8 years ago
I can see what's happening, but I don't think it's a bug in Flot.  If one 
defines two y-axes, it makes sense to provide the hover position on both axes.  
Varying this behavior when one axis is unused feels inconsistent; how would you 
know which of the two axes you were getting?

I'm ready to be convinced otherwise, but for now I believe that the current 
behavior is correct.

Original comment by dnsch...@gmail.com on 4 Jun 2012 at 9:15