#1230 Canvas reverse axis - mouse position and zoom broken

5.0
closed-fixed
nobody
None
5
2013-05-07
2013-04-11
fergus101
No

On reverse yaxis plots using canvas driver, the mouse position does not output the correct value. The zoom is reversed as well. Please see this jsfiddle.

Fix for the mouse position bug would be - in mouse_update call (gnuplot_mouse.js) as follows:

        if (axis_ymax > axis_ymin) {
            y =  axis_ymax + (ploty / (plot_ytop-plot_ybot)) * (axis_ymax - axis_ymin);
        } else {
            y =  axis_ymin - (ploty / (plot_ytop-plot_ybot)) * (axis_ymax - axis_ymin);
        }

I have not verified this issue for reverse x-axis and have yet to look into zoom issue.

Discussion

  • Ethan Merritt
    Ethan Merritt
    2013-04-11

    What version of gnuplot are you using to generate the plot?

    I see that the mousing code linked to by your demo page is
    /
    * $Id: gnuplot_mouse.js,v 1.7.2.2 2010/11/24 22:07:52 sfeam Exp $
    /
    which would be correct (I think) for gnuplot version 4.4, but is out of date with respect to newer gnuplot versions.

    Reversed axis range is working in current gnuplot so far as I know.
    See for example the last plot in
    http://gnuplot.sourceforge.net/demo_canvas_4.7/autoscale.html

    It is possible that it was broken in some earlier version, but I suspect the most likely problem is a version mismatch between the mousing code and the plotting code used by your demo page.

     
  • fergus101
    fergus101
    2013-04-11

    I have been using the gnuplot on Ubuntu (install using aptget install). The version installed has the mouse code issue and is:

    G N U P L O T
    Version 4.4 patchlevel 3
    last modified March 2011
    System: Linux 3.2.0-23-generic-pae

    I just checked the gnuplot on a windows machine and the mouse code code is same as the one on autoscale example. The gnuplot build is:

    G N U P L O T
    Version 4.6 patchlevel 0 last modified 2012-03-04
    Build System: MS-Windows 32 bit

    I also retested my code with latest gnuplot_mouse.js and that works - no issues.
    So, I guess the default Ubuntu gnuplot package install seems dated.

    Thanks for your help.

     
  • fergus101
    fergus101
    2013-04-12

    I spoke too soon.
    I have updated jsfiddle with latest version (http://jsfiddle.net/FjMjW/20/). The zoom issue is fixed - however, the y position on mouse click is still not right.

     
  • Ethan Merritt
    Ethan Merritt
    2013-05-06

    Hmm. Yes, strange. It does work in 4.7 but apparently not in 4.6. It seems like the fix for Bug #3581514 should have been applied also to 4.6 but was not. I'll remedy the omission but that won't help existing copies of the executable.

     
  • Ethan Merritt
    Ethan Merritt
    2013-05-07

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     On reverse yaxis plots using canvas driver, the mouse position does not output the correct value. The zoom is reversed as well. Please see this [jsfiddle][1].
    
     Fix for the mouse position bug would be - in mouse_update call (gnuplot_mouse.js) as follows:
    
    • status: open --> closed-fixed