Axis not autoscaling

Hi,

I have created a master interface for my users to review data. It is a grid of 9 graphs with individual left and bottom axis.

I have created a hook function such that when one of the graphs is expanded in the x axis (expand horizontal) from the pop menu all the graph bottom axis match and then intent is to autoscale the left axis to only the data seen.
Function SetXaxis()

    Variable Xmin, Xmax
    getaxis /Q Bvoc
    xmin=V_min
    Xmax=V_max
    getaxis/Q BJsc
    xmin = max(xmin,V_min)
    Xmax = min(xmax,V_max)
    getaxis/Q BFF
    xmin = max(xmin,V_min)
    Xmax = min(xmax,V_max)
    String AxisName ="Bvoc;Bjsc;Bff;Bvmax;Bpmax;Bimax;Brshunt;Brseries;Beff"
    Variable Index
    For(index=0;index<9;index+=1)
        setaxis $stringfromlist(index,AxisName) xmin,xmax
    endfor
    doupdate
    AxisName ="LVoc;Ljsc;LFF;Lvmax;Lpmax;Limax;Lrshunt;Lrseries;Leff"
    For(index=0;index<9;index+=1)
        setaxis/A=2/n=1 $stringfromlist(index,AxisName)
    endfor

End



The problem is not all the left axis scale to the visible region. See Master1.png attached. Now the really odd thing If I double click on one of the offending left axis to bring up the modifyaxis dialog box and then hit "cancel". I have done nothing made no changes just hit "cancel" The left axis autoscale correctly. See master 2.png attached

Any clue as to what is going on and how do I fix my code to work correctly
Master1.png (51.33 KB) Master2.png (56.5 KB)
Post a simplified experiment and I will investigate. Also let me know what OS you are using and what version of Igor.

I don't think this is the cause of the problem but your use of DoUpdate does not look right.

DoUpdate is needed before a command that requires that any previous changes to the graph be fully registered by Igor. This registration normally occurs in the outer loop when Igor updates any changed windows. DoUpdate is needed if your procedures might depend on something that is is pending registration. It forces an immediate update thereby causing the previous change to be fully accounted for internally.

For example, if you call ModifyGraph followed by GetAxis you need a DoUpdate before the GetAxis to ensure that the change requested by ModifyGraph has been fully registered.

In this case you probably don't need any DoUpdates but if you do, it would be before the first GetAxis.

As I said, I don't think that is the cause of your problem. To understand it I will need to do some debugging which requires a (preferrably) simplified experiment that illustrates the problem.
I added the doupdate thinking it was help in determining the autorange for visible data.

It works the same without it.

I am on MacOS 10.8 running version 6.30.

File is attached.
Summary Data.pxp (267.6 KB)
I believe the problem is that you are modifying the graph while responding to a graph-modified event. This causes all kinds of havoc. It is probably why you have "UpdtDisplay: recursion attempted" messages in the history.

To fix this you need to use Execute/P to call SetXAxis from your hook function. This posts it to the command queue and Igor executes it later in its outer loop, after the original graph modification is finished and the graph has been updated.

However calling SetXAxis from your hook using Execute/P also has a problem. Since SetXAxis modifies the graph, it triggers the hook again which modifies the graph which triggers the hook again...

To solve the problem I made these changes in the attached experiment:
1. Change the call to SetXAxis in HighlightDataPoint_Hook to call PossiblyExecuteSetXAxis.
2. Define a function HighlightDataPoint_Hook which calls SetXAxis via Execute/P but only if it was not called recently.

See the definition of HighlightDataPoint_Hook in the SeeAllPoints procedure file for details.

Update: I posted a different and probably better solution below.

Summary Data HR.pxp (268.57 KB)
If one turned off the hook function on entering the block of code that modifies the axes and then turned it (the hook) back on after finishing the modification, would this also solve the problem?
Hi Howard,

Thank you very much.

One question? If "autoscale visible data only" is set for the left axis of the graphs, would it be possible to set the range automatically of the other axis. For example if I select expand horizontally with a marquee the left axis would autoscale to visible data?
Quote:
If one turned off the hook function on entering the block of code that modifies the axes and then turned it (the hook) back on after finishing the modification, would this also solve the problem?


Sounds like a good solution and simpler than what I came up with. I have implemented it in the attached. See the PostSetXAxisCall function.
Summary Data HR-2.pxp (267.4 KB)