diff --git a/public/assets/users/assets/img/overlay/overlay.png b/public/assets/users/assets/img/overlay/overlay.png new file mode 100644 index 0000000..2def254 Binary files /dev/null and b/public/assets/users/assets/img/overlay/overlay.png differ diff --git a/resources/views/user/layouts/index.blade.php b/resources/views/user/layouts/index.blade.php index 4836d9b..1c19afe 100644 --- a/resources/views/user/layouts/index.blade.php +++ b/resources/views/user/layouts/index.blade.php @@ -73,6 +73,7 @@ class="bi bi-arrow-up-short"> + diff --git a/resources/views/user/pages/finish_ujian/index.blade.php b/resources/views/user/pages/finish_ujian/index.blade.php index 40b733b..fa5298a 100644 --- a/resources/views/user/pages/finish_ujian/index.blade.php +++ b/resources/views/user/pages/finish_ujian/index.blade.php @@ -46,6 +46,13 @@

Grafik Kecepatan Mata

+
+

Heatmap Pergerakan Mata

+
+ +
+
+
@@ -69,6 +76,13 @@ const ws = new WebSocket('{{ env("WEBSOCKET_URL") }}'); let table = null; let data_tobii = null; + let heatmapContainer = null; + let clientWidth = null; + let clientHeight = null; + let mappedHeatmapData = null; + let scaleX = null; + let scaleY = null; + let heatmapInstance = null; function renderVelocityChart(timeseries) { const base = timeseries.timestamp[0]; @@ -118,6 +132,16 @@ function renderVelocityChart(timeseries) { const result = await res.json(); if(result != null) { renderVelocityChart(result.timeseries); + mappedHeatmapData = result.heatmap.map(point => ({ + x: point.x * scaleX, + y: point.y * scaleY, + value: point.value + })); + heatmapInstance.setData({ + max: 10, + data: mappedHeatmapData + }); + heatmapContainer.style.removeProperty('position'); } } @@ -175,6 +199,19 @@ function renderVelocityChart(timeseries) { if(data.type === 'json_file_data') { if(data.data != null) { data_tobii = data.data; + + heatmapContainer = document.getElementById('heatmapChart'); + clientWidth = heatmapContainer.clientWidth; + clientHeight = heatmapContainer.clientHeight; + scaleX = clientWidth / 1366; + scaleY = clientHeight / 768; + + heatmapInstance = h337.create({ + container: heatmapContainer, + radius: 40, + maxOpacity: 0.6, + blur: 0.85 + }); loadData(data_tobii); } }