Version 2 of BLT - graph - Waveform Viewer

Updated 2007-01-23 23:18:49

the graph widget can even be used for excessive amounts of data:

 #!/usr/bin/wish

 package require BLT
 namespace import ::blt::*

 # create a graph widget and show a grid
 graph .g ; pack .g -expand 1 -fill both
 .g grid configure -hide no
 # enable zooming
 Blt_ZoomStack .g

 set start [ clock  clicks -milliseconds ]
 # create two vectors,
 set ::X [ vector #auto ]
 set ::Y [ vector #auto ]

 # fill one vector for the x axis with 1 million points
 $::X seq 0 1.0e6
 # fill one vector for the y axis with a sine + noise
 $::Y expr "sin($::X/1e5) +(0.05*(random($::X)-0.5))"

 # create one element with data for the x and y axis, no dots
 .g element create Wave1 -xdata $::X -ydata $::Y -symbol none

 set stop [ clock clicks -milliseconds ]
 puts time_blt_vector_example:[expr ($stop - $start)/ 1000.0]

AET 24jan07 Erm . . .it chokes on the random() call. I'm using dqkit (tcl8.4.5). Complains

  can't find vector "random"

Tried srand(), same result.