Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Analyse des données de santé
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
BOHELAY CORENTIN p2209196
Analyse des données de santé
Commits
682f719c
Commit
682f719c
authored
2 months ago
by
RABEHI AMIRA p2312013
Browse files
Options
Downloads
Patches
Plain Diff
Integration et Amelioration des visu
parent
429b890e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/index.html
+6
-0
6 additions, 0 deletions
frontend/index.html
static/css/style.css
+12
-1
12 additions, 1 deletion
static/css/style.css
static/js/main.js
+82
-22
82 additions, 22 deletions
static/js/main.js
with
100 additions
and
23 deletions
frontend/index.html
+
6
−
0
View file @
682f719c
...
@@ -120,6 +120,12 @@
...
@@ -120,6 +120,12 @@
<div
class=
"row align-items-center"
>
<div
class=
"row align-items-center"
>
<!-- Visualisation à gauche -->
<!-- Visualisation à gauche -->
<div
class=
"col-md-6 order-md-1"
>
<div
class=
"col-md-6 order-md-1"
>
<div
id=
"distance-buttons-container"
class=
"d-flex justify-content-between align-items-center"
>
<button
id=
"distancePrevYear"
class=
"btn btn-outline-dark"
disabled
>
<
</button>
<span
id=
"distanceCurrentYear"
class=
"font-weight-bold"
style=
"font-size: 1.5rem;"
>
2024
</span>
<button
id=
"distanceNextYear"
class=
"btn btn-outline-dark"
>
>
</button>
</div>
<div
id=
"distance-visualization"
style=
"position: relative;"
></div>
<div
id=
"distance-visualization"
style=
"position: relative;"
></div>
<div
id=
"distance-slider-container"
style=
"margin-top: 20px;"
></div>
<div
id=
"distance-slider-container"
style=
"margin-top: 20px;"
></div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
static/css/style.css
+
12
−
1
View file @
682f719c
...
@@ -2044,7 +2044,18 @@ button:hover {
...
@@ -2044,7 +2044,18 @@ button:hover {
transform
:
translate
(
-50%
,
-50%
);
/* Centrer autour de la souris */
transform
:
translate
(
-50%
,
-50%
);
/* Centrer autour de la souris */
z-index
:
9999
;
z-index
:
9999
;
}
}
.tooltip-distance
{
position
:
absolute
;
background-color
:
rgba
(
0
,
0
,
0
,
0.7
);
/* Fond noir semi-transparent */
color
:
white
;
/* Texte blanc */
padding
:
5px
10px
;
border-radius
:
5px
;
/* Bordures arrondies */
font-size
:
12px
;
pointer-events
:
none
;
/* Empêche l'interaction avec le tooltip */
box-shadow
:
0px
4px
6px
rgba
(
0
,
0
,
0
,
0.2
);
/* Ajout d'une ombre */
transform
:
translate
(
-50%
,
-50%
);
/* Centrer autour de la souris */
z-index
:
9999
;
}
/* Visu 5 */
/* Visu 5 */
/* Sleep and Activity Analysis */
/* Sleep and Activity Analysis */
...
...
This diff is collapsed.
Click to expand it.
static/js/main.js
+
82
−
22
View file @
682f719c
...
@@ -422,17 +422,47 @@ function renderDistanceVisualization() {
...
@@ -422,17 +422,47 @@ function renderDistanceVisualization() {
.
attr
(
"
transform
"
,
`translate(
${
margin
.
left
}
,
${
margin
.
top
}
)`
);
.
attr
(
"
transform
"
,
`translate(
${
margin
.
left
}
,
${
margin
.
top
}
)`
);
const
years
=
[
2023
,
2024
];
const
years
=
[
2023
,
2024
];
const
sliderContainer
=
d3
.
select
(
"
#distance-slider-container
"
);
const
prevYearBtn
=
document
.
getElementById
(
"
distancePrevYear
"
);
const
nextYearBtn
=
document
.
getElementById
(
"
distanceNextYear
"
);
const
currentYearDisplay
=
document
.
getElementById
(
"
distanceCurrentYear
"
);
const
rangeSlider
=
sliderContainer
.
append
(
"
input
"
)
// Gestion des événements des boutons
.
attr
(
"
type
"
,
"
range
"
)
prevYearBtn
.
addEventListener
(
"
click
"
,
()
=>
{
.
attr
(
"
min
"
,
0
)
const
currentYearIndex
=
years
.
indexOf
(
parseInt
(
currentYearDisplay
.
textContent
));
.
attr
(
"
max
"
,
years
.
length
-
1
)
if
(
currentYearIndex
>
0
)
{
.
attr
(
"
value
"
,
years
.
indexOf
(
2024
))
const
newYear
=
years
[
currentYearIndex
-
1
];
.
style
(
"
width
"
,
"
40%
"
);
currentYearDisplay
.
textContent
=
newYear
;
updateVisualization
(
newYear
);
const
yearDisplay
=
sliderContainer
.
append
(
"
span
"
)
// Activer/désactiver les boutons
.
text
(
years
[
years
.
indexOf
(
2024
)]);
nextYearBtn
.
disabled
=
false
;
if
(
currentYearIndex
-
1
===
0
)
{
prevYearBtn
.
disabled
=
true
;
}
}
});
nextYearBtn
.
addEventListener
(
"
click
"
,
()
=>
{
const
currentYearIndex
=
years
.
indexOf
(
parseInt
(
currentYearDisplay
.
textContent
));
if
(
currentYearIndex
<
years
.
length
-
1
)
{
const
newYear
=
years
[
currentYearIndex
+
1
];
currentYearDisplay
.
textContent
=
newYear
;
updateVisualization
(
newYear
);
// Activer/désactiver les boutons
prevYearBtn
.
disabled
=
false
;
if
(
currentYearIndex
+
1
===
years
.
length
-
1
)
{
nextYearBtn
.
disabled
=
true
;
}
}
});
// Initialisation des boutons
prevYearBtn
.
disabled
=
years
.
indexOf
(
parseInt
(
currentYearDisplay
.
textContent
))
===
0
;
nextYearBtn
.
disabled
=
years
.
indexOf
(
parseInt
(
currentYearDisplay
.
textContent
))
===
years
.
length
-
1
;
const
tooltip
=
d3
.
select
(
"
body
"
).
append
(
"
div
"
)
const
tooltip
=
d3
.
select
(
"
body
"
).
append
(
"
div
"
)
.
attr
(
"
class
"
,
"
tooltip-distance
"
)
.
attr
(
"
class
"
,
"
tooltip-distance
"
)
...
@@ -521,24 +551,54 @@ function renderDistanceVisualization() {
...
@@ -521,24 +551,54 @@ function renderDistanceVisualization() {
})
})
.
style
(
"
opacity
"
,
0.7
)
.
style
(
"
opacity
"
,
0.7
)
.
on
(
"
mouseover
"
,
function
(
event
,
d
)
{
.
on
(
"
mouseover
"
,
function
(
event
,
d
)
{
tooltip
.
transition
().
duration
(
200
).
style
(
"
opacity
"
,
.
9
);
tooltip
.
transition
().
duration
(
200
).
style
(
"
opacity
"
,
0.9
);
tooltip
.
html
(
`Mois :
${
d
.
month
}
<br>Distance :
${
d
[
`Distance_
${
member
}
`
]}
km<br>Calories :
${
d
[
`Calories_
${
member
}
`
]}
cal`
)
const
monthFormatted
=
d3
.
timeFormat
(
"
%B
"
)(
parseDate
(
d
.
month
));
// Formatage du mois
.
style
(
"
left
"
,
(
event
.
pageX
+
5
)
+
"
px
"
)
const
distance
=
d
[
`Distance_
${
member
}
`
]
?
d
[
`Distance_
${
member
}
`
].
toFixed
(
2
)
:
"
Pas de données
"
;
.
style
(
"
top
"
,
(
event
.
pageY
-
28
)
+
"
px
"
);
const
calories
=
d
[
`Calories_
${
member
}
`
]
?
d
[
`Calories_
${
member
}
`
].
toFixed
(
2
)
:
"
Pas de données
"
;
})
.
on
(
"
mouseout
"
,
function
()
{
tooltip
.
html
(
`
tooltip
.
transition
().
duration
(
500
).
style
(
"
opacity
"
,
0
);
<strong>
${
member
}
</strong><br>
});
Mois :
${
monthFormatted
}
<br>
Distance :
${
distance
}
km<br>
Calories :
${
calories
}
cal
`
)
.
style
(
"
left
"
,
`
${
event
.
pageX
+
10
}
px`
)
.
style
(
"
top
"
,
`
${
event
.
pageY
-
28
}
px`
);
})
.
on
(
"
mousemove
"
,
function
(
event
)
{
tooltip
.
style
(
"
left
"
,
`
${
event
.
pageX
+
10
}
px`
).
style
(
"
top
"
,
`
${
event
.
pageY
-
28
}
px`
);
})
.
on
(
"
mouseout
"
,
function
()
{
tooltip
.
transition
().
duration
(
500
).
style
(
"
opacity
"
,
0
);
});
// Ajouter une légende horizontale sous le graphique
const
legend
=
svg
.
append
(
"
g
"
)
.
attr
(
"
transform
"
,
`translate(
${
width
/
2
-
(
members
.
length
*
110
)
/
2
}
,
${
height
+
90
}
)`
);
// Positionnement horizontal centré
members
.
forEach
((
member
,
i
)
=>
{
const
legendGroup
=
legend
.
append
(
"
g
"
)
.
attr
(
"
transform
"
,
`translate(
${
i
*
100
}
, 0)`
);
// Espacement horizontal entre les éléments
// Rectangle coloré pour la légende
legendGroup
.
append
(
"
rect
"
)
.
attr
(
"
width
"
,
15
)
.
attr
(
"
height
"
,
15
)
.
attr
(
"
fill
"
,
colorMap
[
member
])
.
style
(
"
opacity
"
,
0.8
);
// Texte descriptif à côté du rectangle
legendGroup
.
append
(
"
text
"
)
.
attr
(
"
x
"
,
20
)
// Décalage horizontal par rapport au rectangle
.
attr
(
"
y
"
,
12
)
// Alignement vertical au centre
.
style
(
"
font-size
"
,
"
12px
"
)
.
text
(
member
);
});
});
});
}
}
updateVisualization
(
years
[
1
]);
updateVisualization
(
years
[
1
]);
rangeSlider
.
on
(
"
input
"
,
function
()
{
const
selectedYear
=
years
[
this
.
value
];
yearDisplay
.
text
(
selectedYear
);
updateVisualization
(
selectedYear
);
});
});
});
}
}
...
...
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