PageSourceSearch

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

js elespanol.com collected 2026-10-01 09:15:53 UTC 15,440 bytes, 434 lines download raw bytes

1function Dibujar_Grafica_Evolucion_svg() {
2	
3	segundosCuarto = Number(datos_partido.P1);
4	if ( segundosCuarto == 0 ) { segundosCuarto = 600 };
5	
6	segundosProrroga = Number(datos_partido.P2);
7	if ( segundosProrroga == 0 ) { segundosProrroga = 300 };
8	
9	duracion = (segundosCuarto / 60) * 4;
10	if ( Number(datos_partido.PAR) > 4 )
11	{
12		duracion = duracion + ( (Number(datos_partido.P2) / 60) * (Number(datos_partido.PAR) - 4) );
13	};
14	if ( duracion == 0 ) { duracion = 40 };
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	var rgbColor = $jOPTA(".opta-fondo-resultado").css('background-color');
255	
256	//--------------------------------------
257	// lineas verticales de cuartos
258	//--------------------------------------
259	cadena_svg += '<g id="opta-evo-evolucion">';
260	iX = coordX + increX ;
261	iY = coordY;
262	
263	iX2 = iX0;
264	iY2 = iY0;
265
266	for (k=1; k<array_diferencias.length; k++) {
267		iX1 = iX2;
268		iY1 = iY2;
269		
270		iX2 = iX0 + (increX * k);
271		dif = Math.abs(Number(array_diferencias[k].dif));
272		if ( Number(array_diferencias[k].dif) > 0 )
273		{
274			iY2 = iY0 - (dif * increY);
275		}
276		else
277		{
278			iY2 = iY0 + (dif * increY);
279		};
280		array_diferencias[k].x = iX2;
281		array_diferencias[k].y = iY2;
282		
283		cadena_svg += '<line x1="' + iX1 + '"' + ' y1="' + iY1 + '"' + ' x2="' + iX2 + '"' + ' y2="' + iY2 + '"';
284		cadena_svg += ' fill="none" stroke="' + rgbColor + '"' + ' stroke-width="3"';
285		cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
286		cadena_svg += '/>';
287		
288		xCuadro1 = iX2 - 4;
289		yCuadro1 = iY2 - 4;
290		//<rect x="25" y="25" width="100" height="100" fill="blue" opacity="0.5" />
291		cadena_svg += '<g id="opta-evo-evolucion-tooltip-' + k + '" class="pepito">';
292		//cadena_svg +='<path d="M ' + xCuadro1 + ' ' + yCuadro1 + ' h 10 v  10 h -10 v -10 Z" fill="' + rgbColor + '"'
293		
294		cadena_svg += '<rect x="' + xCuadro1 + '"' + ' y="' + yCuadro1 + '"' + ' width="10" height="10"fill="' + rgbColor + '"';
295		
296		cadena_svg += ' onMouseOver="onMouseOver_en_evo(\'' + k  + '\')" ';
297		cadena_svg += ' onMouseOut="onMouseOut_en_evo()" ';
298		cadena_svg += ' style="cursor:pointer;"';
299		cadena_svg += '/>';
300		cadena_svg += '</g>';
301		array_diferencias[k].x = xCuadro1;
302		array_diferencias[k].y = yCuadro1;
303		
304	};
305	cadena_svg += '</g>';
306/*		
307	cadena_svg += '<g id="opta-evo-evolucion-tooltip" style="visibility:hidden">';
308	cadena_svg += '<rect id="opta-tooltip-fondo" x="0" y="0" width="320" height="55" rx="10" ry="10"  fill="#000000" opacity="0.7" />';
309	//cadena_svg += '<rect id="opta-tooltip-fondo" x="0" y="0" width="200" height="40" rx="10" ry="10"  fill="#000000" opacity="0.7" />';
310	cadena_svg += '<text id="opta-tooltip-TEXTO" x="0" y="0" font-weight="bold">';
311	cadena_svg += 	'<tspan id="opta-tooltip-MN" style="fill:#FFF; font-size:30px;" text-anchor="end" x="45" y="35">' + "10'" + '</tspan>';
312	cadena_svg += 	'<tspan id="opta-tooltip-EL" style="fill:#FFF; font-size:15px;" text-anchor="start" x="50" y="20">' + datos_partido.EL + '</tspan>';
313	cadena_svg += 	'<tspan id="opta-tooltip-EV" style="fill:#FFF; font-size:15px;" text-anchor="start" x="50" y="45">' + datos_partido.EV + '</tspan>';
314	cadena_svg += 	'<tspan id="opta-tooltip-RL" style="fill:#FFF; font-size:20px;" text-anchor="end" x="250" y="20">' + datos_partido.PUNL + '</tspan>';
315	cadena_svg += 	'<tspan id="opta-tooltip-RV" style="fill:#FFF; font-size:20px;" text-anchor="end" x="250" y="45">' + datos_partido.PUNV + '</tspan>';
316	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>';
317*/
318
319	cadena_svg += '<g id="opta-evo-evolucion-tooltip" style="visibility:hidden">';
320	cadena_svg += '<rect id="opta-tooltip-fondo" x="0" y="0" width="120" height="45" rx="7" ry="7"  fill="#000000" opacity="0.7" />';
321	cadena_svg += '<text id="opta-tooltip-TEXTO" x="0" y="0" font-weight="bold">';
322
323	cadena_svg += 	'<tspan id="opta-tooltip-MN" style="fill:#FFF; font-size:10px;" text-anchor="end" x="10" y="25">' + "10'" + '</tspan>';
324	cadena_svg += 	'<tspan id="opta-tooltip-EL" style="fill:#FFF; font-size:10px;" text-anchor="start" x="30" y="5">' + datos_partido.EL + '</tspan>';
325	cadena_svg += 	'<tspan id="opta-tooltip-EV" style="fill:#FFF; font-size:10px;" text-anchor="start" x="30" y="20">' + datos_partido.EV + '</tspan>';
326	cadena_svg += 	'<tspan id="opta-tooltip-RL" style="fill:#FFF; font-size:10px;" text-anchor="end" x="100" y="5">' + datos_partido.PUNL + '</tspan>';
327	cadena_svg += 	'<tspan id="opta-tooltip-RV" style="fill:#FFF; font-size:10px;" text-anchor="end" x="100" y="20">' + datos_partido.PUNV + '</tspan>';
328	cadena_svg += 	'<tspan id="opta-tooltip-DF" style="fill:#FFF; font-size:10px;" text-anchor="end" x="240" y="35">' + "(" + array_diferencias[array_diferencias.length-1].dif + ")" + '</tspan>';
329
330
331
332	cadena_svg += '</text>';
333	cadena_svg += '</g>';
334	
335	
336	
337	/*
338	//cadena_svg += '<g id="opta-evo-desglose-tooltip" style="visibility:hidden">';
339	cadena_svg += '<line id="opta-tooltip-SEP" x1="0" y1="50" x2="320" y2="50"';
340	cadena_svg += ' fill="none" stroke="#FF0000"' + ' stroke-width="2"';
341	cadena_svg += ' stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" stroke-opacity="null" fill-opacity="null"';
342	cadena_svg += '/>';
343	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" />';
344	cadena_svg += '<text id="opta-desglose-tooltip-TEXTO" x="0" y="0" font-weight="bold">';
345	cadena_svg += 	'<tspan id="opta-desglose-tooltip-MN" style="fill:#FFF; font-size:30px;" text-anchor="end" x="45" y="35">' + "10'" + '</tspan>';
346	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>';
347	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>';
348	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>';
349	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>';
350	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>';
351	cadena_svg += '</text>';
352	cadena_svg += '</g>';
353	*/
354	
355};
356function onMouseOver_en_evo(k)
357{	
358	var iX;
359	var iY;
360	var iW = $jOPTA('#opta-tooltip-fondo').attr('width')// - 10;
361	
362	if ( k > (duracion / 2 ) )
363	{
364		iX = array_diferencias[k].x - (iW - 10);
365	}
366	else
367	{
368		iX = array_diferencias[k].x;
369	};
370	iY = array_diferencias[k].y - 50;
371	$jOPTA('#opta-tooltip-fondo').attr({x:iX,y:iY});
372	
373//ori 	iX1 = iX + 45;
374	iX1 = iX + 14;
375//ori	iY1 = iY + 35;
376	iY1 = iY + 30;
377	$jOPTA('#opta-tooltip-MN').attr({x:iX1,y:iY1});
378	$jOPTA('#opta-tooltip-MN').text(k + "'");
379	
380//ori	iX1 = iX + 50;
381	iX1 = iX + 15;
382	iY1 = iY + 15;
383	$jOPTA('#opta-tooltip-EL').attr({x:iX1,y:iY1});
384	
385//ori	iX1 = iX + 50;
386	iX1 = iX + 15;
387//ori	iY1 = iY + 45;
388	iY1 = iY + 40;
389	$jOPTA('#opta-tooltip-EV').attr({x:iX1,y:iY1});
390
391
392// ori	iX1 = iX + 250;//225
393	iX1 = iX + 110;//225
394	
395	iY1 = iY + 15;
396	$jOPTA('#opta-tooltip-RL').attr({x:iX1,y:iY1});
397	$jOPTA('#opta-tooltip-RL').text(array_diferencias[k].RESL);
398	
399//ori	iY1 = iY + 45;
400	iY1 = iY + 40;
401	$jOPTA('#opta-tooltip-RV').attr({x:iX1,y:iY1,});
402	$jOPTA('#opta-tooltip-RV').text(array_diferencias[k].RESV);
403	
404//ori	iX1 = iX + 315;
405	iX1 = iX + 118;
406	iY1 = iY + 28;
407	$jOPTA('#opta-tooltip-DF').attr({x:iX1,y:iY1});
408	$jOPTA('#opta-tooltip-DF').text("(" + array_diferencias[k].dif + ")");
409	
410
411
412	$jOPTA('#opta-evo-evolucion-tooltip').css("visibility", "visible");
413};
414
415
416
417
418function onMouseOut_en_evo()
419{
420	$jOPTA('#opta-evo-evolucion-tooltip').css("visibility", "hidden");
421};
422
423function poner_tooltip_diferencia_maxima ()
424{
425	for (var d=array_diferencias.length-1; d>=1; d--) 
426	{
427		if ( Math.abs(Number(array_diferencias[d].dif )) ==  Math.abs(Number(MaxDif )))
428		{
429			onMouseOver_en_evo(d);
430			break;
431		};
432	};
433};
434

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.