PageSourceSearch

https://s3.elespanol.com/vendor_js/opta/widgets-opta-bm-grafico-svg-evo.js

js elespanol.com collected 2026-09-24 09:08:15 UTC 14,695 bytes, 418 lines download raw bytes

1function Dibujar_Grafica_Evolucion_svg() {
2	
3	segundosCuarto = Number(datos_partido.P1);
4	if ( segundosCuarto == 0 ) { segundosCuarto = 1800 };
5	
6	segundosProrroga = Number(datos_partido.P2);
7	if ( segundosProrroga == 0 ) { segundosProrroga = 300 };
8	
9	duracion = (segundosCuarto / 60) * 2;
10	if ( Number(datos_partido.PAR) > 2 )
11	{
12		duracion = duracion + ( (Number(datos_partido.P2) / 60) * (Number(datos_partido.PAR) - 2) );
13	};
14	if ( duracion == 0 ) { duracion = 60 };
15	
16	iW = wGraficoEVO - 30;
17	increX = ( iW ) / (duracion);
18
19	cadena_svg = '<svg width="' + wGraficoEVO + '"' + ' height="' + hGraficoEVO + '"' + ' xmlns="http://www.w3.org/2000/svg">';
20	cadena_svg += '<g>';
21
22	Dibujar_Grafica_Evolucion_svg_Celdas(5, 0, iW, hGraficoEVO);
23	Dibujar_Grafica_Evolucion_svg_Diferencias(5, 0);
24	
25	cadena_svg += '</g>';
26	cadena_svg += '</svg>';
27	
28	return cadena_svg;
29	
30	
31};
32
33function Dibujar_Grafica_Evolucion_svg_Celdas(coordX, coordY, iW, iH)
34{
35	//--------------------------------------
36	// lineas verticales de cuartos
37	//--------------------------------------
38	cadena_svg += '<g id="opta-evo-vertical-ctos">';
39	iX = coordX + increX ;
40	iY = coordY;
41
42	for (var k=1; k<=5; k++) 
43	{
44		iY1 = iY;
45		iY2 = iY + iH;
46		cadena_svg += '<line x1="' + iX + '"' + ' y1="' + iY1 + '"' + ' x2="' + iX + '"' + ' y2="' + iY2 + '"';
47		cadena_svg += ' fill="none" stroke="#000000" stroke-width="0.5"';
48		cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
49		cadena_svg += '/>';
50		iX = iX + (increX * (segundosCuarto / 60));
51	};
52	cadena_svg += '</g>';
53	
54	//--------------------------------------
55	// lineas verticales de prórrogas
56	//--------------------------------------
57	if ( Number(datos_partido.PAR) > 4 )
58	{
59		iX = iX - (increX * (segundosCuarto / 60));
60		for (var k=5; k<=Number(datos_partido.PAR)+1; k++) 
61		{
62			iY1 = iY;
63			iY2 = iY + iH;
64			cadena_svg += '<line x1="' + iX + '"' + ' y1="' + iY1 + '"' + ' x2="' + iX + '"' + ' y2="' + iY2 + '"';
65			cadena_svg += ' fill="none" stroke="#000000" stroke-width="0.5"';
66			cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
67			cadena_svg += '/>';
68			iX = iX + (increX * (segundosProrroga / 60));
69		};
70	};
71
72	
73	
74	//--------------------------------------
75	// lineas verticales celdas
76	//--------------------------------------
77	cadena_svg += '<g id="opta-evo-vertical-celdas">';
78	
79	iX = coordX + increX ;
80	iY = coordY;
81
82	for (var k=0; k<=duracion; k++)
83	{
84		iY1 = iY;
85		iY2 = iY + iH;
86		cadena_svg += '<line x1="' + iX + '"' + ' y1="' + iY1 + '"' + ' x2="' + iX + '"' + ' y2="' + iY2 + '"';
87		cadena_svg += ' fill="none" stroke="#000000" stroke-width="0.2"';
88		cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
89		cadena_svg += '/>';
90		iX = iX + increX;
91	};
92	cadena_svg += '</g>';
93
94
95	//--------------------------------------
96	// lineas horizontales celdas
97	//--------------------------------------
98	cadena_svg += '<g id="opta-evo-horizontal-celdas">';
99	
100	iX = coordX; //- increX;
101	iY = coordY + (increY * 2);
102
103	// LOCAL
104	for (var k=0; k<=MaxDifL; k++)
105	{
106		iX1 = iX;
107		iX2 = iX + iW + increX;
108		cadena_svg += '<line x1="' + iX1 + '"' + ' y1="' + iY + '"' + ' x2="' + iX2 + '"' + ' y2="' + iY + '"';
109		cadena_svg += ' fill="none" stroke="#000000" stroke-width="0.2"';
110		cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
111		cadena_svg += '/>';
112		iY = iY + increY;
113	};
114	
115	// LOCAL
116	for (var k=0; k<=MaxDifV; k++)
117	{
118		iX1 = iX;
119		iX2 = iX + iW + increX;
120		cadena_svg += '<line x1="' + iX1 + '"' + ' y1="' + iY + '"' + ' x2="' + iX2 + '"' + ' y2="' + iY + '"';
121		cadena_svg += ' fill="none" stroke="#000000" stroke-width="0.2"';
122		cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
123		cadena_svg += '/>';
124		iY = iY + increY;
125	};
126	cadena_svg += '</g>'
127
128
129	//--------------------------------------
130	// lineas horizontal (0, 0)
131	//--------------------------------------
132	cadena_svg += '<g id="opta-evo-horizontal-dif0">';
133	
134	iX = coordX - increX;
135	iY = coordY + (MaxDifL * (increY)) + (increY * 2) ;
136	
137	
138	iX0 = iX;
139	iY0 = iY;
140
141	
142	iX1 = iX;
143	iX2 = iX + iW + (increX * 2);
144	cadena_svg += '<line x1="' + iX1 + '"' + ' y1="' + iY + '"' + ' x2="' + iX2 + '"' + ' y2="' + iY + '"';
145	cadena_svg += ' fill="none" stroke="#000000" stroke-width="0.5"';
146	cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
147	cadena_svg += '/>';
148		
149	cadena_svg += '</g>';
150
151	//---------------------------------------------
152	// horizontales superior e inferior de tiempo
153	//---------------------------------------------
154	cadena_svg += '<g id="opta-evo-horizontal-tpos">';
155	
156	iX = coordX - increX;
157	iY = coordY + increY;
158
159	iX1 = iX;
160	iX2 = iX + iW + (increX * 2);
161	cadena_svg += '<line x1="' + iX1 + '"' + ' y1="' + iY + '"' + ' x2="' + iX2 + '"' + ' y2="' + iY + '"';
162	cadena_svg += ' fill="none" stroke="#000000" stroke-width="0.5"';
163	cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
164	cadena_svg += '/>';
165
166
167	iX = coordX - increX;
168	iY = coordY + iH - increY;
169
170	iX1 = iX;
171	iX2 = iX + iW + (increX * 2);
172	cadena_svg += '<line x1="' + iX1 + '"' + ' y1="' + iY + '"' + ' x2="' + iX2 + '"' + ' y2="' + iY + '"';
173	cadena_svg += ' fill="none" stroke="#000000" stroke-width="0.5"';
174	cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
175	cadena_svg += '/>';
176
177	cadena_svg += '</g>';
178
179
180
181	//-----------------------------------------
182	// TEXTOS MINUTOS (ARRIBA)
183	//-----------------------------------------
184	hasta = duracion + 1;
185	
186	cadena_svg += '<g id="opta-evo-ver-textos">';
187	
188	iX = coordX + increX + (increX / 2);
189	iY = coordY + 10;
190	
191	for (k=1; k < hasta; k++) {
192		cadena_svg += '<text font-family="Arial" font-size="8" text-anchor="middle">';
193		cadena_svg += '	<tspan x="' + iX + '"' + ' y="' + iY + '"' + '>' + k + '</tspan>';
194		cadena_svg += '</text>';
195		iX = iX + increX;
196	};
197	
198	iX = coordX + increX + (increX / 2);
199	iY = iH ;
200	
201	for (k=1; k < hasta; k++) {
202		cadena_svg += '<text font-family="Arial" font-size="8" text-anchor="middle">';
203		cadena_svg += '	<tspan x="' + iX + '"' + ' y="' + iY + '"' + '>' + k + '</tspan>';
204		cadena_svg += '</text>';
205		iX = iX + increX;
206	};
207
208	//--------------------------------
209	// diferencia local desde (0,0)
210	//--------------------------------
211	iX = coordX + 2; 
212	iY = iY0 - 2;
213	
214	for (k=1; k <=MaxDifL; k++) {
215		cadena_svg += '<text font-family="Arial" font-size="8" text-anchor="middle">';
216		cadena_svg += '	<tspan x="' + iX + '"' + ' y="' + iY + '"' + '>' + k + '</tspan>';
217		cadena_svg += '</text>';
218		iY = iY - increY;
219	};
220	
221	//--------------------------------
222	// diferencia visitante desde (0,0)
223	//--------------------------------
224	iX = coordX + 2 ;
225	iY = iY0 + increY;
226	
227	for (k=1; k <=MaxDifV; k++) {
228		cadena_svg += '<text font-family="Arial" font-size="8" text-anchor="middle">';
229		cadena_svg += '	<tspan x="' + iX + '"' + ' y="' + iY + '"' + '>' + k + '</tspan>';
230		cadena_svg += '</text>';
231		iY = iY + increY;
232	};
233
234	cadena_svg += '</g>';
235	
236};
237
238
239
240
241function Dibujar_Grafica_Evolucion_svg_Diferencias(coordX, coordY)
242{
243	
244	//-------------------------------------
245	// coordenadas 0,0
246	//-------------------------------------
247	iX = coordX + increX;
248	iY = coordY + (difer_max * (increY)) + (increY * 2) ;
249	iY = coordY + (MaxDifL * (increY)) + (increY * 2) ;
250	
251	iX0 = iX;
252	iY0 = iY;
253
254	
255	var rgbColor = $jOPTA(".opta-fondo-resultado").css('background-color');
256	
257	//--------------------------------------
258	// lineas verticales de cuartos
259	//--------------------------------------
260	cadena_svg += '<g id="opta-evo-evolucion">';
261	iX = coordX + increX ;
262	iY = coordY;
263	
264	iX2 = iX0;
265	iY2 = iY0;
266
267	for (k=1; k<array_diferencias.length; k++) {
268		
269		iX1 = iX2;
270		iY1 = iY2;
271		
272		iX2 = iX0 + (increX * k);
273		dif = Math.abs(Number(array_diferencias[k].dif));
274		if ( Number(array_diferencias[k].dif) > 0 )
275		{
276			iY2 = iY0 - (dif * increY);
277		}
278		else
279		{
280			iY2 = iY0 + (dif * increY);
281		};
282
283/*		
284		if (isNaN(iY2))
285		{
286			iY2 = 287;
287		};
288*/
289		array_diferencias[k].x = iX2;
290		array_diferencias[k].y = iY2;
291		cadena_svg += '<line x1="' + iX1 + '"' + ' y1="' + iY1 + '"' + ' x2="' + iX2 + '"' + ' y2="' + iY2 + '"';
292		cadena_svg += ' fill="none" stroke="' + rgbColor + '"' + ' stroke-width="3"';
293		cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
294		cadena_svg += '/>';
295		
296		xCuadro1 = iX2 - 4;
297		yCuadro1 = iY2 - 4;
298		//<rect x="25" y="25" width="100" height="100" fill="blue" opacity="0.5" />
299		cadena_svg += '<g id="opta-evo-evolucion-tooltip-' + k + '" class="pepito">';
300		//cadena_svg +='<path d="M ' + xCuadro1 + ' ' + yCuadro1 + ' h 10 v  10 h -10 v -10 Z" fill="' + rgbColor + '"'
301		
302		cadena_svg += '<rect x="' + xCuadro1 + '"' + ' y="' + yCuadro1 + '"' + ' width="7" height="7"fill="' + rgbColor + '"';
303		
304		cadena_svg += ' onMouseOver="onMouseOver_en_evo(\'' + k  + '\')" ';
305		cadena_svg += ' onMouseOut="onMouseOut_en_evo()" ';
306		cadena_svg += ' style="cursor:pointer;"';
307		cadena_svg += '/>';
308		cadena_svg += '</g>';
309		array_diferencias[k].x = xCuadro1;
310		array_diferencias[k].y = yCuadro1;
311		
312	};
313	cadena_svg += '</g>';
314		
315	cadena_svg += '<g id="opta-evo-evolucion-tooltip" style="visibility:hidden">';
316	cadena_svg += '<rect id="opta-tooltip-fondo" x="0" y="0" width="320" height="55" rx="10" ry="10"  fill="#000000" opacity="0.7" />';
317	cadena_svg += '<text id="opta-tooltip-TEXTO" x="0" y="0" font-weight="bold">';
318	cadena_svg += 	'<tspan id="opta-tooltip-MN" style="fill:#FFF; font-size:30px;" text-anchor="end" x="45" y="35">' + "10'" + '</tspan>';
319//	cadena_svg += 	'<tspan id="opta-tooltip-EL" style="fill:#FFF; font-size:15px;" text-anchor="start" x="50" y="20">' + datos_partido.EL + '</tspan>';
320//	cadena_svg += 	'<tspan id="opta-tooltip-EV" style="fill:#FFF; font-size:15px;" text-anchor="start" x="50" y="45">' + datos_partido.EV + '</tspan>';
321	//alert ("nbAliasDoc = "+ nbAliasLoc);
322	cadena_svg += 	'<tspan id="opta-tooltip-EL" style="fill:#FFF; font-size:15px;" text-anchor="start" x="50" y="20">' + nbAliasLoc + '</tspan>';
323	cadena_svg += 	'<tspan id="opta-tooltip-EV" style="fill:#FFF; font-size:15px;" text-anchor="start" x="50" y="45">' + nbAliasVis + '</tspan>';
324	cadena_svg += 	'<tspan id="opta-tooltip-RL" style="fill:#FFF; font-size:20px;" text-anchor="end" x="250" y="20">' + datos_partido.GFL + '</tspan>';
325	cadena_svg += 	'<tspan id="opta-tooltip-RV" style="fill:#FFF; font-size:20px;" text-anchor="end" x="250" y="45">' + datos_partido.GFV + '</tspan>';
326	cadena_svg += 	'<tspan id="opta-tooltip-DF" style="fill:#FFF; font-size:30px;" text-anchor="end" x="315" y="35">' + "(" + array_diferencias[array_diferencias.length-1].dif + ")" + '</tspan>';
327	cadena_svg += '</text>';
328	cadena_svg += '</g>';
329	
330	
331	
332	/*
333	//cadena_svg += '<g id="opta-evo-desglose-tooltip" style="visibility:hidden">';
334	cadena_svg += '<line id="opta-tooltip-SEP" x1="0" y1="50" x2="320" y2="50"';
335	cadena_svg += ' fill="none" stroke="#FF0000"' + ' stroke-width="2"';
336	cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
337	cadena_svg += '/>';
338	cadena_svg += '<rect id="opta-desglose-tooltip-fondo" x="0" y="0" width="320" height="50" rx="10" ry="10"  fill="#000000" opacity="0.7" />';
339	cadena_svg += '<text id="opta-desglose-tooltip-TEXTO" x="0" y="0" font-weight="bold">';
340	cadena_svg += 	'<tspan id="opta-desglose-tooltip-MN" style="fill:#FFF; font-size:30px;" text-anchor="end" x="45" y="35">' + "10'" + '</tspan>';
341	cadena_svg += 	'<tspan id="opta-desglose-tooltip-EL" style="fill:#FFF; font-size:15px;" text-anchor="start" x="50" y="20">' + datos_partido.EL + '</tspan>';
342	cadena_svg += 	'<tspan id="opta-desglose-tooltip-EV" style="fill:#FFF; font-size:15px;" text-anchor="start" x="50" y="45">' + datos_partido.EV + '</tspan>';
343	cadena_svg += 	'<tspan id="opta-desglose-tooltip-RL" style="fill:#FFF; font-size:20px;" text-anchor="end" x="250" y="20">' + datos_partido.PUNL + '</tspan>';
344	cadena_svg += 	'<tspan id="opta-desglose-tooltip-RV" style="fill:#FFF; font-size:20px;" text-anchor="end" x="250" y="45">' + datos_partido.PUNV + '</tspan>';
345	cadena_svg += 	'<tspan id="opta-desglose-tooltip-DF" style="fill:#FFF; font-size:30px;" text-anchor="end" x="315" y="35">' + "(" + array_diferencias[array_diferencias.length-1].dif + ")" + '</tspan>';
346	cadena_svg += '</text>';
347	cadena_svg += '</g>';
348	*/
349	
350};
351function onMouseOver_en_evo(k)
352{	
353	var iX;
354	var iY;
355	var iW = $jOPTA('#opta-tooltip-fondo').attr('width')// - 10;
356	
357	if ( k > (duracion / 2 ) )
358	{
359		iX = array_diferencias[k].x - (iW - 10);
360	}
361	else
362	{
363		iX = array_diferencias[k].x;
364	};
365	iY = array_diferencias[k].y - 50;
366	$jOPTA('#opta-tooltip-fondo').attr({x:iX,y:iY});
367	
368	iX1 = iX + 45;
369	iY1 = iY + 35;
370	$jOPTA('#opta-tooltip-MN').attr({x:iX1,y:iY1});
371	$jOPTA('#opta-tooltip-MN').text(k + "'");
372	
373	iX1 = iX + 50;
374	iY1 = iY + 20;
375	$jOPTA('#opta-tooltip-EL').attr({x:iX1,y:iY1});
376	
377	iX1 = iX + 50;
378	iY1 = iY + 45;
379	$jOPTA('#opta-tooltip-EV').attr({x:iX1,y:iY1});
380
381
382	iX1 = iX + 250;//225
383	
384	iY1 = iY + 20;
385	$jOPTA('#opta-tooltip-RL').attr({x:iX1,y:iY1});
386	$jOPTA('#opta-tooltip-RL').text(array_diferencias[k].RESL);
387	
388	iY1 = iY + 45;
389	$jOPTA('#opta-tooltip-RV').attr({x:iX1,y:iY1,});
390	$jOPTA('#opta-tooltip-RV').text(array_diferencias[k].RESV);
391	
392	iX1 = iX + 315;
393	iY1 = iY + 35;
394	$jOPTA('#opta-tooltip-DF').attr({x:iX1,y:iY1});
395	$jOPTA('#opta-tooltip-DF').text("(" + array_diferencias[k].dif + ")");
396	
397
398
399	$jOPTA('#opta-evo-evolucion-tooltip').css("visibility", "visible");
400};
401
402function onMouseOut_en_evo()
403{
404	$jOPTA('#opta-evo-evolucion-tooltip').css("visibility", "hidden");
405};
406
407function poner_tooltip_diferencia_maxima ()
408{
409	for (var d=array_diferencias.length-1; d>=1; d--) 
410	{
411		if ( Math.abs(Number(array_diferencias[d].dif )) ==  Math.abs(Number(MaxDif )))
412		{
413			onMouseOver_en_evo(d);
414			break;
415		};
416	};
417};
418

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.