[JM] The following examples show the basic usage of the BLT charting capabilities. As many of the [BLT] users will notice, these examples just show the tip of the iceberg, but sometimes we are looking for the minimal example for a quick startup... ---- ** Barchart basic usage ** package require BLT blt::barchart .g -title "Comparison" pack .g .g element create BT1 -xdata {1 2 3 4 5 6 7 8} -ydata {.76 .98 .88 .92 .96 .98 .91 .80} -label {Series 1}\ -showvalues y ---- ** Barchart showing two series of data ** package require BLT blt::barchart .g -title "Comparison" -barmode aligned pack .g .g element create BT1 -xdata {1 2 3 4 5 6 7 8} -ydata {.76 .98 .88 .92 .96 .98 .91 .80} -label {Series 1}\ -showvalues y .g element create BT2 -xdata {1 2 3 4 5 6 7 8} -ydata {.1 .2 .3 .4 .5 .6 .7 .8} -label {Series 2}\ -showvalues y -foreground red ---- ** Function plotting using [[vector expr ...]] ** [UK]: #!/usr/bin/wish package require BLT namespace import ::blt::* proc compute args { catch { ::y expr { \ ($::a * (::x ^ 3) ) + ($::b * (::x ^ 2) ) \ + ($::c * ::x) + $::d \ } } cerr } label .l -text "Function: ax^3 + bx^2 + cx + d" ; table . .l 0,0 graph .g -width 700 -height 600 -bd 2 -relief groove ; table . .g 1,0 -fill both Blt_ZoomStack .g vector ::x ; ::x seq -10 10 0.5 vector ::y set items {label variable to from digits resolution tickinterval gridpos} set scale_cfg { a ::a -0.31 0.3 5 0.001 0.1 1,1 b ::b -1.01 1.0 5 0.002 0.5 1,2 c ::c -4.01 4.0 4 0.01 2.0 1,3 d ::d -10.01 10.0 3 0.1 5.0 1,4 } foreach $items $scale_cfg { set $variable 0.0 trace variable $variable w compute set w .sc$label set label [ string totitle $label ] scale $w -label $label \ -variable $variable -to $to -from $from \ -digits $digits -resolution $resolution \ -tickinterval $tickinterval \ -bd 2 -relief groove table . $w $gridpos -fill y } # fill vector ::y compute .g element create Function -xdata ::x -ydata ::y -pixels 3 .g axis configure y -min -20 -max 20 .g grid configure -hide no -dashes { 2 2 } # ready See also: [Tclodbc + BLT] ---- !!!!!! %| [Category BLT] |% !!!!!!