diff --git a/xg2.js b/xg2.js index 4783744c8e3fcde1b89465644e69c58d39b44af5..393719b569bdf765f0c854d26353f20fb913383d 100644 --- a/xg2.js +++ b/xg2.js @@ -142,7 +142,21 @@ .attr("font-size", "24px") // Tamaño mayor .attr("fill", "black") // Color del texto (negro) .text("Diferencia de xG (xG_diff)"); - + + // Dibujar lÃneas desde el eje Y hasta el final del eje X + svg.selectAll(".team-line") + .data(filteredData) + .enter() + .append("line") + .attr("class", "team-line") + .attr("x1", 0) // Desde el inicio del eje X + .attr("y1", d => y(d.team) + y.bandwidth() / 2) // Centrado en la banda del equipo + .attr("x2", width) // Hasta el final del eje X + .attr("y2", d => y(d.team) + y.bandwidth() / 2) // Mantener alineación + .attr("stroke", "lightgray") // Color de la lÃnea + .attr("stroke-width", 1) // Grosor de la lÃnea + .attr("stroke-dasharray", "4,2"); // LÃnea punteada + // Añadir el texto sobre el fondo svg.append("text") .attr("transform", "rotate(-90)") // Rota el texto