Posted to tcl by jdc at Tue Oct 02 09:12:33 GMT 2007view raw
- package require Tk
- package require BLT
- set gf [frame .gf]
- pack $gf -fill both -expand true
- set g [blt::graph $gf.g]
- set sx [scrollbar $gf.sx -orient horizontal -command [list $g axis view x]]
- set sy [scrollbar $gf.sy -orient vertical -command [list $g axis view y]]
- grid $g -row 0 -column 0 -sticky ewns
- grid $sx -row 1 -column 0 -sticky ewns
- grid $sy -row 0 -column 1 -sticky ewns
- grid columnconfigure $gf 0 -weight 1
- grid rowconfigure $gf 0 -weight 1
- $g axis configure x -scrollcommand [list $sx set] -rotate 90.0
- $g axis configure y -scrollcommand [list $sy set]
- $g grid on
- Blt_ZoomStack $g
- Blt_Crosshairs $g
- Blt_ActiveLegend $g
- Blt_ClosestPoint $g
- Blt_PrintKey $g
- $g element create t1 -smooth linear -symbol "" -color red -label "t1-red"
- set dx {}
- set dy {}
- for { set i 0 } { $i < 1024 } { incr i } {
- lappend dx $i
- lappend dy [expr {sin($i*3.1415/1024)}]
- }
- $g element configure t1 -xdata $dx -ydata $dy