OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / lib / blt2.5 / demos / graph5.tcl
1 #!../src/bltwish
2
3 package require BLT
4 # --------------------------------------------------------------------------
5 # Starting with Tcl 8.x, the BLT commands are stored in their own 
6 # namespace called "blt".  The idea is to prevent name clashes with
7 # Tcl commands and variables from other packages, such as a "table"
8 # command in two different packages.  
9 #
10 # You can access the BLT commands in a couple of ways.  You can prefix
11 # all the BLT commands with the namespace qualifier "blt::"
12 #  
13 #    blt::graph .g
14 #    blt::table . .g -resize both
15
16 # or you can import all the command into the global namespace.
17 #
18 #    namespace import blt::*
19 #    graph .g
20 #    table . .g -resize both
21 #
22 # --------------------------------------------------------------------------
23 if { $tcl_version >= 8.0 } {
24     namespace import blt::*
25     #namespace import -force blt::tile::*
26 }
27 source scripts/demo.tcl
28
29 option add *Element.ScaleSymbols        true
30 option add *Axis.loose                  true
31 option add *Pixels                      .8c
32 option add *Element.lineWidth           0
33 option add *Legend.ActiveRelief         raised
34 option add *Legend.padY                 0
35 option add *Button*Font                 { Courier 14 } widgetDefault
36 option add *Legend*Font                 { Courier 14 bold } widgetDefault
37 option add *Graph.Font                  { Courier 18 bold } widgetDefault
38 option add *Graph.title                 "Element Symbol Types"
39 option add *Graph.width                 8i
40 option add *Graph.height                6i
41 option add *Graph.plotPadY              .25i
42 option add *Graph.plotPadX              .25i
43
44 set graph .graph
45
46 graph $graph
47
48 vector create x -variable ""
49 x set { 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 }
50
51 for { set i 0 } { $i < 11 } { incr i } {
52     set vecName "y${i}"
53     vector create ${vecName}
54     $vecName length 11
55     $vecName variable y
56     set y(:) [expr $i*100.0]
57 }
58
59 set attributes {
60     none        "None"          red     red4            y0
61     arrow       "Arrow"         brown   brown4          y10
62     circle      "Circle"        yellow  yellow4         y2
63     cross       "Cross"         cyan    cyan4           y6
64     diamond     "Diamond"       green   green4          y3
65     plus        "Plus"          magenta magenta4        y9
66     splus       "Splus"         Purple  purple4         y7
67     scross      "Scross"        red     red4            y8
68     square      "Square"        orange  orange4         y1
69     triangle    "Triangle"      blue    blue4           y4
70     "@bitmaps/hobbes.xbm @bitmaps/hobbes_mask.xbm"
71                 "Bitmap"        yellow  black           y5
72 }
73
74 set count 0
75 foreach {symbol label fill color yVec} $attributes {
76     $graph element create line${count} \
77         -label $label -symbol $symbol -color $color -fill $fill -x x -y $yVec 
78     incr count
79 }
80 $graph element configure line0 -dashes  { 2 4 2 } -linewidth 2
81 button .quit -text Quit -command exit
82 table . \
83   $graph 0,0 -fill both \
84   .quit  1,0 -fill x
85 Blt_ZoomStack $graph
86 Blt_Crosshairs $graph
87 Blt_ActiveLegend $graph
88 Blt_ClosestPoint $graph
89 Blt_PrintKey $graph