Scroll Through a Trace

Here is a code that will scroll. Select a graph with the trace that you want to scroll. Type scroll_OverTrace(...) with input values gwidth as the width of the view pane, sstep as the scroll step, and speed as the 60/speed tick rate.

// scroll in graph with axis width gwidth with step sstep at speed in 60/speed ticks

Function scroll_OverTrace(variable gwidth, variable sstep, variable speed)

    // sanity check
    if (sstep > gwidth)
        sstep = gwidth/10
    endif
   
    // front graph
    string fgwin   
    fgwin = WinName(0,1,1)
   
    variable lx, rx, gmin, gmax
    GetAxis/W=$fgwin/Q bottom
    lx = v_min
    rx = v_max
    GetAxis/W=$fgwin/Q left
    gmin = v_min
    gmax = v_max
   
    // top trace
    string tname   
    tname = StringFromList(0,TraceNameList(fgwin,"",1))
   
    wave gwave = TraceNameToWaveRef(fgwin,tname)
   
    // set up new window
    KillWindow/Z LiveTraceScroll
    display/N=LiveTraceScroll gwave
    SetAxis/W=LiveTraceScroll left, gmin, gmax
    SetAxis/W=LiveTraceScroll bottom, lx, gwidth
    DoUpdate/W=LiveTraceScroll
   
    // loop to scroll
    variable ic, nsteps, dx
    nsteps = (rx - lx)/sstep   
    for (ic=0;ic<nsteps;ic+=1)
        dx = ic*sstep
        SetAxis/W=LiveTraceScroll bottom, lx+dx, gwidth+dx
        sleep/T/Q/PROG={"Stop","",1} 60/speed
        DoUpdate/W=LiveTraceScroll
    endfor

    // return to main window
    DoWindow/F $fgwin
       
    return 0
end

 

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More