1
2proc FormatXTicks { w value } {
3
4    # Determine the element name from the value
5
6    set index [expr round($value)]
7    if { $index != $value } {
8	return $value
9    }
10    incr index -1
11
12    set name [lindex { A1 B1 A2 B2 C1 D1 C2 A3 E1 } $index]
13    return $name
14}
15
16source scripts/patterns.tcl
17
18image create photo bgTexture -file ./images/chalk.gif
19
20set configOptions {
21    Axis.TickFont		-*-helvetica-medium-r-*-*-12-*-*
22    Axis.TitleFont		-*-helvetica-bold-r-*-*-12-*-*
23    Element.Background		white
24    Element.Relief		raised
25    Grid.Dashes			{ 2 4 }
26    Grid.Hide			no
27    Grid.MapX			""
28    Legend.Font			"-*-helvetica*-bold-r-*-*-12-*-*"
29    Legend.ActiveBorderWidth	2
30    Legend.ActiveRelief		raised
31    Legend.Anchor		ne
32    Legend.BorderWidth		0
33    Legend.Position		right
34    TextMarker.Font		*Helvetica-Bold-R*14*
35    activeBar.Foreground	black
36    activeBar.Stipple		pattern1
37    BarMode			stacked
38    Font			-*-helvetica-bold-r-*-*-14-*-*
39    Tile			bgTexture
40    Title			"Comparison of Simulators"
41    x.Command			FormatXTicks
42    x.Title			"Simulator"
43    y.Title			"Time (hrs)"
44}
45
46set resource [string trimleft $graph .]
47foreach { option value } $configOptions {
48    option add *$resource.$option $value
49}
50
51set visual [winfo screenvisual .]
52if { $visual != "staticgray" && $visual != "grayscale" } {
53    option add *print.background	yellow
54    option add *quit.background		red
55    option add *quit.activeBackground	red2
56}
57
58vector create X Y0 Y1 Y2 Y3 Y4
59
60X set { 1 2 3 4 5 6 7 8 9 }
61Y0 set {
62    0.729111111  0.002250000  0.09108333  0.006416667  0.026509167
63    0.007027778  0.1628611    0.06405278  0.08786667
64}
65Y1 set {
66    0.003120278	 0.004638889  0.01113889  0.048888889  0.001814722
67    0.291388889  0.0503500    0.13876389  0.04513333
68}
69Y2 set {
70    11.534444444 3.879722222  4.54444444  4.460277778  2.334055556
71    1.262194444  1.8009444    4.12194444  3.24527778
72}
73Y3 set {
74    1.015750000  0.462888889  0.49394444  0.429166667  1.053694444
75    0.466111111  1.4152500    2.17538889  2.55294444
76}
77Y4 set {
78    0.022018611  0.516333333  0.54772222  0.177638889  0.021703889
79    0.134305556  0.5189278    0.07957222  0.41155556
80}
81
82
83#
84# Element attributes:
85#
86#    Label	yData	Color		Stipple Pattern
87set attributes {
88    "Load"	Y2	lightblue	pattern1
89    "Other"	Y4	lightpink	pattern1
90    "Read In"	Y0	lightgoldenrod	pattern1
91    "Setup"	Y1	lightyellow	pattern2
92}
93set attributes {
94    "Load"	Y2	white	 	azure		""		0
95    "Solve"	Y3	cyan1		lightcyan	pattern2 	1
96    "zOther"	Y4	lightpink	lightpink 	pattern1	1
97    "Read In"	Y0	lightgoldenrod	lightgoldenrod  pattern1	1
98    "Setup"	Y1	lightyellow	lightyellow	pattern2	1
99}
100
101foreach {label yData fg bg stipple bd} $attributes {
102    $graph element create $yData \
103	-label $label \
104	-borderwidth $bd \
105	-y $yData \
106	-x X \
107	-fg $fg \
108	-bg $bg \
109	-stipple $stipple
110}
111
112Blt_ZoomStack $graph
113Blt_Crosshairs $graph
114Blt_ActiveLegend $graph
115Blt_ClosestPoint $graph
116
117$graph marker bind all <B2-Motion> {
118    set coords [%W invtransform %x %y]
119    catch { %W marker configure [%W marker get current] -coords $coords }
120}
121
122$graph marker bind all <Enter> {
123    set marker [%W marker get current]
124    catch { %W marker configure $marker -bg green}
125}
126
127$graph marker bind all <Leave> {
128    set marker [%W marker get current]
129    catch { %W marker configure $marker -bg ""}
130}
131
132