OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / SGI / util / SGI / lib / blt2.4 / demos / barchart5
1 #!/home/people/tkys/Eos/util/SGI/bin/bltwish
2 #!../bltwish
3
4 source bltDemo.tcl
5
6 set graph .htext.graph
7
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
22    00 00 00 00 }
23 }
24
25 option add *graph.x.Title "X Axis Label"
26 option add *graph.y.Title "Y Axis Label"
27 option add *graph.title "A Simple Barchart"
28 option add *graph.x.Font *Times-Medium-R*10*
29 option add *graph.Element.Relief raised
30
31 set visual [winfo screenvisual .] 
32 if { $visual != "staticgray" && $visual != "grayscale" } {
33     option add *graph.LineMarker.color yellow
34     option add *graph.Element.Background white
35     option add *graph.Legend.activeForeground pink
36     option add *print.background yellow
37     option add *quit.background red
38     option add *graph.background palegreen
39     option add *graph.plotBackground lightblue
40 }
41
42 htext .htext -text \
43 {   This is an example of the barchart widget.  The barchart has 
44     many components; x and y axis, legend, crosshairs, elements, etc.  
45     To create a postscript file "bar.ps", press the %%
46     set w $htext(widget)
47     button $w.print -text {Print} -command {
48         $graph postscript output bar.ps
49     } 
50     $w append $w.print
51
52 %% button.  
53 %%
54
55     barchart $graph  -relief raised -bd 2 
56     $graph xaxis configure -rotate 90 -stepsize 0 
57     $w append $graph -fill both -padx 4
58
59 %%
60     Hit the %%
61
62     button $w.quit -text quit -command exit
63     $w append $w.quit 
64
65 %% button when you've seen enough.%%
66
67     label $w.logo -bitmap BLT
68     $w append $w.logo -padx 20
69
70 %% }
71
72 set names { One Two Three Four Five Six Seven Eight }
73 if { $visual == "staticgray" || $visual == "grayscale" } {
74     set fgcolors { white white white white white white white white }
75     set bgcolors { black black black black black black black black }
76 } else {
77     set fgcolors { yellow orange red magenta purple blue cyan green }
78     set bgcolors { yellow4 orange4 red4 magenta4 purple4 blue4 cyan4 green4 }
79 }
80
81 set numColors [llength $names]
82
83 set tcl_precision 15
84 vector create x
85 vector create y
86 x seq -5.0 5.0 0.2 
87 y expr sin(x)
88 set barWidth 0.19
89
90 $graph element create sin -relief raised -bd 1 -x x -y y  -barwidth $barWidth
91 table . .htext -fill both
92         
93 wm min . 0 0
94
95 Blt_ZoomStack $graph
96 Blt_Crosshairs $graph
97 Blt_ActiveLegend $graph
98 Blt_ClosestPoint $graph