Posted to tcl by jdc at Tue Oct 02 09:10:58 GMT 2007view raw

  1. set g [blt::graph $gf.g]
  2. set sx [scrollbar $gf.sx -orient horizontal -command [list $g axis view x]]
  3. set sy [scrollbar $gf.sy -orient vertical -command [list $g axis view y]]
  4.  
  5. grid $g -row 0 -column 0 -sticky ewns
  6. grid $sx -row 1 -column 0 -sticky ewns
  7. grid $sy -row 0 -column 1 -sticky ewns
  8. grid columnconfigure $gf 0 -weight 1
  9. grid rowconfigure $gf 0 -weight 1
  10.  
  11. $g axis configure x -scrollcommand [list $sx set] -rotate 0.0
  12. $g axis configure y -scrollcommand [list $sy set]
  13. $g grid on
  14.  
  15. Blt_ZoomStack $g
  16. Blt_Crosshairs $g
  17. Blt_ActiveLegend $g
  18. Blt_ClosestPoint $g
  19. Blt_PrintKey $g
  20.  
  21. $g element create t1 -smooth linear -symbol "" -color red -label "t1-red"
  22.  
  23. set dx {}
  24. set dy {}
  25. for { set i 0 } { $i < 1024 } { incr i } {
  26. lappend dx $i
  27. lappend dy [expr {sin($i*3.1415/1024)}]
  28. }
  29.  
  30. $g element configure t1 -xdata $dx -ydata $dy