Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EstadisticasClubBaloncesto
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DESI_24-25
EstadisticasClubBaloncesto
Commits
8ac6c60a
Commit
8ac6c60a
authored
4 months ago
by
rodpena
Browse files
Options
Downloads
Patches
Plain Diff
commit grafico radar
parent
eebbf87f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
script.js
+80
-2
80 additions, 2 deletions
script.js
with
80 additions
and
2 deletions
script.js
+
80
−
2
View file @
8ac6c60a
...
...
@@ -77,8 +77,86 @@ function rendimientoJugadores() {
// Crear div a la derecha (resto del espacio)
restoPantalla
.
append
(
"
div
"
)
.
attr
(
"
id
"
,
"
lado-derecho
"
);
.
append
(
"
div
"
)
.
attr
(
"
id
"
,
"
lado-derecho
"
)
.
style
(
"
flex
"
,
"
1
"
)
.
style
(
"
background-color
"
,
"
#F5F5F5
"
)
// Fondo gris claro
.
style
(
"
display
"
,
"
flex
"
)
.
style
(
"
align-items
"
,
"
center
"
)
.
style
(
"
justify-content
"
,
"
center
"
)
.
style
(
"
position
"
,
"
relative
"
);
// Permite po
crearGraficoRadar
(
"
#lado-derecho
"
);
}
// Función para crear el gráfico de radar con líneas intermedias y exteriores
function
crearGraficoRadar
(
containerSelector
)
{
const
container
=
d3
.
select
(
containerSelector
);
// Configuración del SVG
const
width
=
600
;
// Tamaño del gráfico
const
height
=
600
;
// Configuración del radar
const
metrics
=
8
;
// Número de vértices
const
levels
=
5
;
// Número de niveles (anillos intermedios)
const
radius
=
Math
.
min
(
width
,
height
)
/
2
;
// Radio del radar exterior
const
angleSlice
=
(
2
*
Math
.
PI
)
/
metrics
;
// Escala para los niveles (líneas intermedias)
const
rScale
=
d3
.
scaleLinear
().
range
([
0
,
radius
]).
domain
([
0
,
100
]);
// Crear el SVG dentro del contenedor
const
svg
=
container
.
append
(
"
svg
"
)
.
attr
(
"
width
"
,
width
)
.
attr
(
"
height
"
,
height
)
.
append
(
"
g
"
)
.
attr
(
"
transform
"
,
`translate(
${
width
/
2
}
,
${
height
/
2
}
)`
);
// Dibujar líneas intermedias y exteriores
for
(
let
level
=
1
;
level
<=
levels
;
level
++
)
{
const
levelRadius
=
(
level
/
levels
)
*
radius
;
const
vertices
=
[];
for
(
let
i
=
0
;
i
<
metrics
;
i
++
)
{
vertices
.
push
([
levelRadius
*
Math
.
cos
(
angleSlice
*
i
-
Math
.
PI
/
2
),
levelRadius
*
Math
.
sin
(
angleSlice
*
i
-
Math
.
PI
/
2
),
]);
}
// Dibujar las líneas entre los vértices de cada nivel (incluyendo la exterior)
for
(
let
i
=
0
;
i
<
vertices
.
length
;
i
++
)
{
const
[
x1
,
y1
]
=
vertices
[
i
];
const
[
x2
,
y2
]
=
vertices
[(
i
+
1
)
%
vertices
.
length
];
svg
.
append
(
"
line
"
)
.
attr
(
"
x1
"
,
x1
)
.
attr
(
"
y1
"
,
y1
)
.
attr
(
"
x2
"
,
x2
)
.
attr
(
"
y2
"
,
y2
)
.
style
(
"
stroke
"
,
level
===
levels
?
"
black
"
:
"
#999
"
)
// Exterior en azul, intermedias en gris
.
style
(
"
stroke-width
"
,
level
===
levels
?
2
:
1
);
// Exterior más gruesa
}
}
// Dibujar líneas radiales desde el centro hasta los vértices
const
exteriorVertices
=
[];
for
(
let
i
=
0
;
i
<
metrics
;
i
++
)
{
exteriorVertices
.
push
([
radius
*
Math
.
cos
(
angleSlice
*
i
-
Math
.
PI
/
2
),
radius
*
Math
.
sin
(
angleSlice
*
i
-
Math
.
PI
/
2
),
]);
}
exteriorVertices
.
forEach
(([
x
,
y
])
=>
{
svg
.
append
(
"
line
"
)
.
attr
(
"
x1
"
,
0
)
.
attr
(
"
y1
"
,
0
)
.
attr
(
"
x2
"
,
x
)
.
attr
(
"
y2
"
,
y
)
.
style
(
"
stroke
"
,
"
#444
"
)
// Líneas radiales en gris oscuro
.
style
(
"
stroke-width
"
,
1.5
);
// Grosor de las líneas radiales
});
}
// Función para cargar datos del CSV desde una URL
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment