Debian Codegraph @

demos/scripts/graph1.tcl

raw
1
2 set X {
3 2.00000e-01 4.00000e-01 6.00000e-01 8.00000e-01 1.00000e+00
4 1.20000e+00 1.40000e+00 1.60000e+00 1.80000e+00 2.00000e+00
5 2.20000e+00 2.40000e+00 2.60000e+00 2.80000e+00 3.00000e+00
6 3.20000e+00 3.40000e+00 3.60000e+00 3.80000e+00 4.00000e+00
7 4.20000e+00 4.40000e+00 4.60000e+00 4.80000e+00 5.00000e+00
8 }
9
10 set Y1 {
11 4.07008e+01 7.95658e+01 1.16585e+02 1.51750e+02 1.85051e+02
12 2.16479e+02 2.46024e+02 2.73676e+02 2.99427e+02 3.23267e+02
13 3.45187e+02 3.65177e+02 3.83228e+02 3.99331e+02 4.13476e+02
14 4.25655e+02 4.35856e+02 4.44073e+02 4.50294e+02 4.54512e+02
15 4.56716e+02 4.57596e+02 4.58448e+02 4.59299e+02 4.60151e+02
16 }
17
18 set Y2 {
19 5.14471e-00 2.09373e+01 2.84608e+01 3.40080e+01 3.75691e+01
20 3.91345e+01 3.92706e+01 3.93474e+01 3.94242e+01 3.95010e+01
21 3.95778e+01 3.96545e+01 3.97313e+01 3.98081e+01 3.98849e+01
22 3.99617e+01 4.00384e+01 4.01152e+01 4.01920e+01 4.02688e+01
23 4.03455e+01 4.04223e+01 4.04990e+01 4.05758e+01 4.06526e+01
24 }
25
26 set Y3 {
27 2.61825e+01 5.04696e+01 7.28517e+01 9.33192e+01 1.11863e+02
28 1.28473e+02 1.43140e+02 1.55854e+02 1.66606e+02 1.75386e+02
29 1.82185e+02 1.86994e+02 1.89802e+02 1.90683e+02 1.91047e+02
30 1.91411e+02 1.91775e+02 1.92139e+02 1.92503e+02 1.92867e+02
31 1.93231e+02 1.93595e+02 1.93958e+02 1.94322e+02 1.94686e+02
32 }
33
34 set configOptions {
35 Axis.TitleFont {Times 18 bold}
36 Element.Pixels 6
37 Element.Smooth catrom
38 Legend.ActiveBackground khaki2
39 Legend.ActiveRelief sunken
40 Legend.Background ""
41 Title "A Simple X-Y Graph"
42 activeLine.Color yellow4
43 activeLine.Fill yellow
44 background khaki3
45 line1.Color red4
46 line1.Fill red1
47 line1.Symbol circle
48 line2.Color purple4
49 line2.Fill purple1
50 line2.Symbol arrow
51 line3.Color green4
52 line3.Fill green1
53 line3.Symbol triangle
54 x.Descending no
55 x.Loose no
56 x.Title "X Axis Label"
57 y.Rotate 90
58 y.Title "Y Axis Label"
59 }
60
61 set resource [string trimleft $graph .]
62 foreach { option value } $configOptions {
63 option add *$resource.$option $value
64 }
65 $graph element create line1 -x $X -y $Y2
66 $graph element create line2 -x $X -y $Y3
67 $graph element create line3 -x $X -y $Y1
68
69 Blt_ZoomStack $graph
70 Blt_Crosshairs $graph
71 Blt_ActiveLegend $graph
72 Blt_ClosestPoint $graph