19 var block1El = document.getElementById(
'block1');
20 var block2El = document.getElementById(
'block2');
21 var block3El = document.getElementById(
'block3');
22 var block4El = document.getElementById(
'block4');
25 var canvas1 = document.getElementById(
"canvas1"),
26 ctx1 = canvas1.getContext(
"2d"),
27 canvas2 = document.getElementById(
"canvas2"),
28 ctx2 = canvas2.getContext(
"2d"),
29 canvas3 = document.getElementById(
"canvas3"),
30 ctx3 = canvas3.getContext(
"2d")
31 canvas4 = document.getElementById(
"canvas4"),
32 ctx4 = canvas4.getContext(
"2d")
33 canvas1Grid = document.getElementById(
"canvas1Grid"),
34 ctx1Grid = canvas1Grid.getContext(
"2d"),
35 canvas2Grid = document.getElementById(
"canvas2Grid"),
36 ctx2Grid = canvas2Grid.getContext(
"2d"),
37 canvas3Grid = document.getElementById(
"canvas3Grid"),
38 ctx3Grid = canvas3Grid.getContext(
"2d")
39 canvas4Grid = document.getElementById(
"canvas4Grid"),
40 ctx4Grid = canvas4Grid.getContext(
"2d");
42 var color1 = document.getElementById(
'color1');
43 var color2 = document.getElementById(
'color2');
44 var color3 = document.getElementById(
'color3');
45 var color4 = document.getElementById(
'color4');
47 var gblAlpha1 = document.getElementById(
'gblAlpha1');
48 var gblAlpha2 = document.getElementById(
'gblAlpha2');
49 var gblAlpha3 = document.getElementById(
'gblAlpha3');
50 var gblAlpha4 = document.getElementById(
'gblAlpha4');
54 var defaultSigHighHeight = 150;
55 var defaultSigLowHeight = 300;
56 var defaultSigWidth = 20;
57 var defaultVertDivs = 12;
58 var defaultGblAlpha = 0.1;
59 var defaultTimeoutval = 150;
61 var sigHighHeight1 = 150,
65 var sigHighHeight2 = 150,
69 var sigHighHeight3 = 150,
73 var sigHighHeight4 = 150,
77 canvas1.width = canvas1.style.width = sigWidth1*32;
78 canvas1.height = canvas1.style.height = sigLowHeight1;
80 canvas2.width = canvas2.style.width = sigWidth2*32;
81 canvas2.height = canvas2.style.height = sigLowHeight2;
83 canvas3.width = canvas3.style.width = sigWidth3*32;
84 canvas3.height = canvas3.style.height = sigLowHeight3;
86 canvas4.width = canvas4.style.width = sigWidth4*32;
87 canvas4.height = canvas4.style.height = sigLowHeight4;
89 canvas1Grid.width = canvas1Grid.style.width = sigWidth1*32;
90 canvas1Grid.height = canvas1Grid.style.height = sigLowHeight1;
91 ctx1Grid.fillStyle =
"white";
92 ctx1Grid.fillRect(0, 0, canvas1Grid.width, canvas1Grid.height);
94 canvas2Grid.width = canvas2Grid.style.width = sigWidth2*32;
95 canvas2Grid.height = canvas2Grid.style.height = sigLowHeight2;
96 ctx2Grid.fillStyle =
"white";
97 ctx2Grid.fillRect(0, 0, canvas2Grid.width, canvas2Grid.height);
99 canvas3Grid.width = canvas3Grid.style.width = sigWidth3*32;
100 canvas3Grid.height = canvas3Grid.style.height = sigLowHeight3;
101 ctx3Grid.fillStyle =
"white";
102 ctx3Grid.fillRect(0, 0, canvas3Grid.width, canvas3Grid.height);
104 canvas4Grid.width = canvas4Grid.style.width = sigWidth4*32;
105 canvas4Grid.height = canvas4Grid.style.height = sigLowHeight4;
106 ctx4Grid.fillStyle =
"white";
107 ctx4Grid.fillRect(0, 0, canvas4Grid.width, canvas4Grid.height);
109 $(block1El).css(
"height",sigLowHeight1);
110 $(block1El).css(
"width",sigWidth1*32);
112 $(block2El).css(
"height",sigLowHeight2);
113 $(block2El).css(
"width",sigWidth2*32);
115 $(block3El).css(
"height",sigLowHeight3);
116 $(block3El).css(
"width",sigWidth3*32);
118 $(block4El).css(
"height",sigLowHeight4);
119 $(block4El).css(
"width",sigWidth4*32);
121 var testCanvasEl = document.getElementById(
"testCanvas");
122 var testGridEl = document.getElementById(
"testGrid");
125 var getDataReq =
true;
129 function handlerFunction(req) {
130 console.log(
"handlerFunction() was called. Req: " + req.responseText);
133 var child1data = DesktopContent.getXMLValue(req,
"rawData");
135 (
"#tstBlkEl").innerHTML = child1data;
136 (
"#tstBlkEl").innerHTML +=
"<br>";
137 console.log(
"--child1data:" + child1data);
142 DesktopContent.XMLHttpRequest(
"Request?RequestType=getNext&bufferName=DB1&consumerName=NimStreamConsumer&args={timestamp:0,count:1200000}",
"",handlerFunction);
143 setTimeout(getData,5000);
157 function pxCheck(pxData){
159 if((pxData[0] == 255) && (pxData[1] == 255) && (pxData[2] == 255) && (pxData[3] == 255)){
180 function fadeOut(ctxVar,canvasVar,gblAlphaVar,timeoutVal) {
183 ctxVar.globalAlpha = gblAlphaVar.value;
184 ctxVar.globalCompositeOperation=
'destination-out';
185 ctxVar.fillStyle=
'#FFF';
186 ctxVar.fillRect(0,0,canvasVar.width, canvasVar.height);
189 return setTimeout(
function() {
190 fadeOut(ctxVar,canvasVar,gblAlphaVar,timeoutVal);
210 function drawGrid(strokeColor,ctxVar,canvasVar,vertDivs,sigWidth,sigLowHeight){
212 console.log(
"vDiv Spacing: " + (sigLowHeight/vertDivs));
213 ctxVar.clearRect(0, 0, canvasVar.width, canvasVar.height);
214 ctxVar.fillStyle =
"white";
215 ctxVar.fillRect(0, 0, canvasVar.width, canvasVar.height);
219 for (var x =0; x <= canvasVar.width; x += sigWidth){
220 ctxVar.moveTo(0.5 + x, 0);
221 ctxVar.lineTo(0.5 + x, canvasVar.height);
224 for (var x=0; x <= canvasVar.height; x += (sigLowHeight/vertDivs)){
225 ctxVar.moveTo(0,0.5+x);
226 ctxVar.lineTo(canvasVar.width, 0.5 + x);
229 ctxVar.strokeStyle = strokeColor;
249 function drawScope(scopeArr,strokeColor,ctxVar,sigWidth,sigLowHeight,sigHighHeight){
254 if(scopeArr[0]==
"1"){
255 lastHeight = sigHighHeight+5;
256 ctxVar.moveTo(0,lastHeight);
259 lastHeight = sigLowHeight;
260 ctxVar.moveTo(0,lastHeight);
262 for(var i = 0; i <= scopeArr.length; i++){
263 if(scopeArr[i]==
"1"){
264 if(lastHeight == sigHighHeight){
265 ctxVar.lineTo(((i+1)*sigWidth), sigHighHeight);
268 ctxVar.lineTo(((i)*sigWidth), sigHighHeight);
269 ctxVar.lineTo(((i+1)*sigWidth), sigHighHeight);
270 lastHeight = sigHighHeight;
274 if(lastHeight == sigLowHeight){
275 ctxVar.lineTo(((i+1)*sigWidth), sigLowHeight);
278 ctxVar.lineTo(((i)*sigWidth), sigLowHeight);
279 ctxVar.lineTo(((i+1)*sigWidth), sigLowHeight);
280 lastHeight = sigLowHeight;
284 ctxVar.strokeStyle=strokeColor;
294 function keepDrawing1() {
295 drawScope(
"1010101010101011110000", color1.value, ctx1, sigWidth1, sigLowHeight1, sigHighHeight1);
296 setTimeout(keepDrawing1,1500);
299 function keepDrawing2() {
300 drawScope(
"0001101000101011010101", color2.value, ctx2, sigWidth2, sigLowHeight2, sigHighHeight2);
301 setTimeout(keepDrawing2,2500);
304 function keepDrawing3() {
305 drawScope(
"1101010010101110100010", color3.value, ctx3, sigWidth3, sigLowHeight3, sigHighHeight3);
306 setTimeout(keepDrawing3,7000);
309 function keepDrawing4() {
310 drawScope(
"1101010010101110100010", color4.value, ctx4, sigWidth4, sigLowHeight4, sigHighHeight4);
311 setTimeout(keepDrawing4,700);
314 drawGrid(
"lightgray",ctx1Grid,canvas1Grid,defaultVertDivs,sigWidth1,sigLowHeight1);
315 drawGrid(
"lightgray",ctx2Grid,canvas2Grid,defaultVertDivs,sigWidth2,sigLowHeight2);
316 drawGrid(
"lightgray",ctx3Grid,canvas3Grid,defaultVertDivs,sigWidth3,sigLowHeight3);
317 drawGrid(
"lightgray",ctx4Grid,canvas4Grid,defaultVertDivs,sigWidth4,sigLowHeight4);
322 fadeOut(ctx1,canvas1,gblAlpha1,defaultTimeoutval);
323 fadeOut(ctx2,canvas2,gblAlpha2,defaultTimeoutval);
324 fadeOut(ctx3,canvas3,gblAlpha3,defaultTimeoutval);
325 fadeOut(ctx4,canvas4,gblAlpha4,defaultTimeoutval);
326 $(document).ready(getData());