1 #!/home/people/tkys/Eos/util/HP/bin/bltwish
8 bitmap define pattern1 { {4 4} {01 02 04 08} }
9 bitmap define pattern2 { {4 4} {08 04 02 01} }
10 bitmap define pattern3 { {2 2} {01 02 } }
11 bitmap define pattern4 { {4 4} {0f 00 00 00} }
12 bitmap define pattern5 { {4 4} {01 01 01 01} }
13 bitmap define pattern6 { {2 2} {01 00 } }
14 bitmap define pattern7 { {4 4} {0f 01 01 01} }
15 bitmap define pattern8 { {8 8} {ff 00 ff 00 ff 00 ff 00 } }
16 bitmap define pattern9 { {4 4} {03 03 0c 0c} }
17 bitmap define hobbes { {25 25} {
18 00 00 00 00 00 00 00 00 00 c0 03 00 78 e0 07 00 fc f8 07 00 cc 07 04 00
19 0c f0 0b 00 7c 1c 06 00 38 00 00 00 e0 03 10 00 e0 41 11 00 20 40 11 00
20 e0 07 10 00 e0 c1 17 00 10 e0 2f 00 20 e0 6f 00 18 e0 2f 00 20 c6 67 00
21 18 84 2b 00 20 08 64 00 70 f0 13 00 80 01 08 00 00 fe 07 00 00 00 00 00
25 option add *graph.xTitle "X Axis Label"
26 option add *graph.yTitle "Y Axis Label"
27 option add *graph.title "A Simple Barchart"
28 option add *graph.xFont *Times-Medium-R*12*
29 option add *graph.elemBackground white
30 option add *graph.elemRelief raised
32 set visual [winfo screenvisual .]
33 if { $visual != "staticgray" && $visual != "grayscale" } {
34 option add *print.background yellow
35 option add *quit.background red
39 This is an example of the barchart widget. To create a postscript
40 file "bar.ps", press the %%
41 button $htext(widget).print -text {Print} -command {
42 $graph postscript output bar.ps -maxpect 1
44 $htext(widget) append $htext(widget).print
47 barchart $graph -invert true
48 $graph xaxis configure -command FormatLabel -descending true
49 $graph legend configure -hide yes
51 htext .footer -text {Hit the %%
52 button $htext(widget).quit -text quit -command exit
53 $htext(widget) append $htext(widget).quit
54 %% button when you've seen enough.%%
55 label $htext(widget).logo -bitmap BLT
56 $htext(widget) append $htext(widget).logo -padx 20
59 set names { One Two Three Four Five Six Seven Eight }
60 if { $visual == "staticgray" || $visual == "grayscale" } {
61 set fgcolors { white white white white white white white white }
62 set bgcolors { black black black black black black black black }
64 set fgcolors { red green blue purple orange brown cyan navy }
65 set bgcolors { green blue purple orange brown cyan navy red }
67 set numColors [llength $names]
69 for { set i 0} { $i < $numColors } { incr i } {
70 $graph element create [lindex $names $i] \
72 -fg [lindex $fgcolors $i] \
73 -bg [lindex $bgcolors $i] \
74 -stipple pattern[expr $i+1] \
79 $graph element create Nine \
83 $graph element create Ten \
88 $graph element create Eleven \
92 # -coords { -Inf Inf }
94 $graph marker create bitmap \
95 -coords { 11 3.3 } -anchor center \
96 -bitmap @bitmaps/sharky.bm \
102 .header 0,0 -padx .25i \
103 .graph 1,0 -fill both \
104 .footer 2,0 -padx .25i
106 table configure . r0 r2 -resize none
110 proc FormatLabel { w value } {
111 # Determine the element name from the value
112 set displaylist [$w element show]
113 set index [expr round($value)-1]
114 set name [lindex $displaylist $index]
118 # Return the element label
119 set info [$w element configure $name -label]
120 return [lindex $info 4]
124 Blt_Crosshairs $graph
125 Blt_ActiveLegend $graph
126 Blt_ClosestPoint $graph
129 .graph marker bind all <B2-Motion> {
130 set coords [%W invtransform %x %y]
131 catch { %W marker configure [%W marker get current] -coords $coords }
134 .graph marker bind all <Enter> {
135 set marker [%W marker get current]
136 catch { %W marker configure $marker -bg green}
137 catch { %W marker configure $marker -fill green}
140 .graph marker bind all <Leave> {
141 set marker [%W marker get current]
142 catch { %W marker configure $marker -bg ""}
143 catch { %W marker configure $marker -fill ""}