Skip to content
Chris Petersen edited this page Oct 16, 2014 · 1 revision

make-gltrace makes a data trace to be plotted by the glgui-trace widget.

Parameter Description
w Trace width
h Trace height
mode Trace mode (GLTRACE_RESET, GLTRACE_OVERWRITE, or GLTRACE_SHIFT)
vmin Lowest plotted value
vmax Highest plotted value
vlo Lower limit value, used if limit font set in glgui-trace
vhigh Higher limit value, used if limit font set in glgui-trace

Example

Example 1: Trace a fake waveform. First define the trace with its boundaries. Then place a trace-widget on the screen. Finally, clear the trace, load some data and update the trace. In a real world application the gltrace-add and gltrace-update would happen in a loop elsewhere, whenever new data are received.

(set! VAL_min 0)(set! VAL_max 10)
(set! val-trace (make-gltrace 101 30 GLTRACE_OVERWRITE VAL_min VAL_max VAL_min VAL_max))
(gltrace:clear val-trace)
(set! val-wave (glgui-trace gui 5 (- (glgui-height-get) 44 110) 200 40 val-trace Orange))
(set! values (list 0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 6 7 7 9 5 4 3 2 1 3 4 5 6 4 4 3 3 2 2 1 1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 0 0 1 1 2 2 3 3 4 4 5 5))
(let loop ((i 0))
  (if (< i (length values))
    (begin
      (gltrace-add val-trace (list-ref values i))
      (loop (+ i 1))
  )))
...
(gltrace-update val-trace) ;; this must be called in the event loop

Example 2: Make an SpO2 trace

(set! SPdata2 (make-gltrace (fix (/ tw 1.5)) (fix (/ th 1.5)) GLTRACE_SHIFT 40. 110. 90. 99.))
Clone this wiki locally