1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<html>
<head>
<title>Dial: Show Range Cases</title>
<!-- Source File and Seed for YUI3-->
<style>
body{
margin-top:30px;
}
.yui3-dial,
.pics li {
margin-left:10px;
}
.steps{
margin:20px;
}
.angle-lines {
position:absolute;
left:100px;
top:100px;
border:solid 1px #abc;
}
.angle-lines li{
position:absolute;
bottom:0px;
left:-2px;
width:4px;
height: 0px;
border-top:solid 50px #0f0;
}
.angle-lines li.max{
border-top-color:#f00;
}
.angle-lines li.range{
border-top-color: #458042;
border-top-width: 8px;
height: 90px;
left: -11px;
top: -50px;
width: 20px;
opacity:0.5;
}
.min-max-label{
position:absolute;
top:-16px;
left:0px;
}
.pics img{
}
.hd{
font-size:150%;
margin: 1.5em;
}
.width-container{
width:1300px;
/*border:solid 1px #f00;*/
}
.pics li{
position:relative;
display:inline-block;
width:200px;
height:200px;
/*border:solid 1px #f00;*/
margin-top:20px;
}
.pics li div{
position:absolute;
bottom:-74px;
height:30px;
}
.pics .num {
position:absolute;
bottom:-24px;
height:30px;
font-size:373%;
width:100%;
text-align:center;
}
em {font-weight:bold;}
</style>
</head>
<body class="yui3-skin-sam">
<div class="hd">Test on Dials with different value ranges</div>
<div class="width-container">
<span id="dial_container1"></span>
<span id="dial_container2"></span>
<span id="dial_container3"></span>
<span id="dial_container4"></span>
<span id="dial_container5"></span>
<span id="dial_container6"></span>
<ul class="pics">
<li><img src="assets/images/clock.png" width="200" height="200"/><div>Range is one revolution</div><div class="num">1</div></li>
<li><img src="assets/images/wrapper.png" width="200" height="200"/><div>Range wraps around the dial one or more times</div><div class="num">2</div></li>
<li><img src="assets/images/needle.png" width="200" height="200"/><div>Range is < one revolution. The wrap point is in the range</div><div class="num">3</div></li>
<li><img src="assets/images/gas.png" width="200" height="200"/><div>Range is < one revolution. No wrap point in either the range nor out of range section</div><div class="num">4</div></li>
<li><img src="assets/images/ship.png" width="200" height="200"/><div>Range is < one revolution. wrap point found in out of range section</div><div class="num">5</div></li>
</ul>
</div>
</body>
</html>
<script>
YUI({lang:'en', filter:'raw'}).use("dial", function(Y) {
function drawMinMaxLines(dialObj){
// return;
var min = dialObj.get('min'),
max = dialObj.get('max'),
range = max - min,
rangeDashNum = range / 5,
angMax, angMin, thisVal = min, angThis, newUl, newLi, label;
dialObj._ringNode.append(newUl);
for(var i = 1; i < rangeDashNum; i++){
thisVal = min + ((range / rangeDashNum) * i);
angThis = dialObj._getAngleFromValue(thisVal);
newLi = Y.Node.create('<li class="range" style="-moz-transform: rotate(' + angThis + 'deg); -moz-transform-origin: center center;"></li>');
newUl.append(newLi);
}
newLi = Y.Node.create('<li class="min" style="-moz-transform: rotate(' + angMin + 'deg); -moz-transform-origin: bottom center;"></li>');
newUl.append(newLi);
newLi = Y.Node.create('<li class="max" style="-moz-transform: rotate(' + angMax + 'deg); -moz-transform-origin: bottom center;"></li>');
newUl.append(newLi);
label = Y.Node.create('<div class="min-max-label">min: ' + dialObj.get('min') + '<br>max: ' + dialObj.get('max') + '</div>');
dialObj._ringNode.append(label);
}
min:0,
max:100,
stepsPerRevolution:100,
value: 0,
diameter: 200,
decimalPlaces:0
});
dial_00.render("#dial_container1");
drawMinMaxLines(dial_00);
min:0,
max:200,
stepsPerRevolution:100,
value: 93,
diameter: 200,
decimalPlaces:0
});
dial_01.render("#dial_container2");
drawMinMaxLines(dial_01);
min:-40,
max:40,
// min:60,
// max:140,
stepsPerRevolution:100,
value: 10,
// value: 100,
diameter: 200,
decimalPlaces:0,
strings:{label:'Monkeys in barrel:', resetStr: 'Reset', tooltipHandle: 'my tool tip text'}
});
dial_02.render("#dial_container3");
drawMinMaxLines(dial_02);
min:0,
max:20,
stepsPerRevolution:100,
value: 10,
diameter: 200,
decimalPlaces:0,
strings:{label:'Altitude in Kilometers:', resetStr: 'Reset', tooltipHandle: 'Drag to set'}
});
dial_03.render("#dial_container4");
drawMinMaxLines(dial_03);
//////////////////////////////////////////////////////////////////
min:5,
max:80,
stepsPerRevolution:100,
value: 60,
diameter: 200,
decimalPlaces:0
});
dial_04.render("#dial_container5");
drawMinMaxLines(dial_04);
//////////////////////////////////////////////////////////////////
min:40,
max:100,
stepsPerRevolution:100,
value: 100,
diameter: 200,
decimalPlaces:0
});
dial_05.render("#dial_container6");
drawMinMaxLines(dial_05);
/*
min:170,
max:200,
stepsPerRevolution:100,
value: 180,
diameter: 200,
decimalPlaces:0
});
dial_05.render("#dial_container");
drawMinMaxLines(dial_05);
min:0,
max:70,
stepsPerRevolution:100,
value: 20,
diameter: 200,
decimalPlaces:0
});
dial_06.render("#dial_container");
drawMinMaxLines(dial_06);
///////////////////////////////////////////////////////
*/
});
</script>