BLT - graph - Waveform Viewer

Difference between version 12 and 13 - Previous - Next
the graph widget can even be used for excessive amounts of data:<<br>>
[waveform]
<<br>>
 #!/usr/bin/wish

 package require BLT
 namespace import ::blt::vector
 namespace import ::blt::graph

 # 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.

[UK] pasting this into wish runs without fault. Did you loose the quotes? ... Just tested with kit-8.4.13-build1-linux-x86-STall.bin : no probs

[LV] I just copy and pasted this example into a text file and ran it against Tcl/Tk 8.4.7 and BLT 3.0. I get this error: 
 Error in startup script: can't import command "label": already exists
    while executing
 "namespace import ::blt::*"
    (file "/tmp/samblt.tk" line 5)

Anyone have any idea what might be going wrong?

[UK] I guess BLT has grown a [[label]] command? apropos: BLT 3.0 from cvs at sourceforge?


<<categories>> BLT | Example | Graphics | Plotting