diff --git a/frontend/templates/frontend/index.html b/frontend/templates/frontend/index.html
index 5e6099d..86a78a7 100644
--- a/frontend/templates/frontend/index.html
+++ b/frontend/templates/frontend/index.html
@@ -59,6 +59,10 @@
Select Date Range
From:
To:
+
+
+
@@ -144,6 +148,8 @@ Select Date Range
return {
position: [measurement.longitude, measurement.latitude],
+ values: measurement.values,
+ dateTime: measurement.dateTime,
size: 10,
color: color // Use the interpolated color
};
@@ -157,7 +163,8 @@ Select Date Range
getFillColor: d => d.color,
radiusMinPixels: 5,
radiusMaxPixels: 10,
- pickable: true
+ pickable: true,
+ onHover: ({object, x, y}) => handleHover(object, x, y)
});
deckgl.setProps({
@@ -205,6 +212,32 @@ Select Date Range
});
}
+ // Function to handle hover and display popup
+ function handleHover(object, x, y) {
+ const popup = document.getElementById('popup');
+ const popupContent = document.getElementById('popup-content');
+
+ if (object) {
+ // check if the object is valid
+ if(!object.values) {
+ object.values = {};
+ }
+ popupContent.innerHTML = `
+ Radiation Level: ${object.values.radiation}
+ Location: (${object.position[0]}, ${object.position[1]})
+ Date: ${new Date(object.dateTime).toLocaleString()}
+ `;
+
+ // Position the popup near the mouse
+ popup.style.left = `${x}px`;
+ popup.style.top = `${y}px`;
+ popup.style.display = 'block'; // Show the popup
+ } else {
+ console.log('No object');
+ popup.style.display = 'none'; // Hide the popup when not hovering
+ }
+ }
+
// Fetch data every 10 seconds
setInterval(fetchData, 10000);