From 080d4abb9936758b24936c28a84ae40b11c6cb0b Mon Sep 17 00:00:00 2001 From: palaniappan-r Date: Sat, 24 Feb 2024 15:49:38 +0530 Subject: [PATCH] feat: let toolchain graphs be hidden when clicked --- results/html/index.html | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/results/html/index.html b/results/html/index.html index 648a4f87..08a2d632 100644 --- a/results/html/index.html +++ b/results/html/index.html @@ -27,7 +27,7 @@
@@ -183,7 +183,7 @@

To check the latest statistics of a project for the selected board, please < } function LineChart(canvas_name, title, unitstr, labels, datasets, legend) { - return new Chart(document.getElementById(canvas_name), { + const chart = new Chart(document.getElementById(canvas_name), { type: 'line', data: { labels: labels, @@ -240,11 +240,27 @@

To check the latest statistics of a project for the selected board, please < } } } - } + }, } }); + +//Toolchain will be hidden when clicked +document.getElementById(canvas_name).addEventListener('click', function(evt) { + const activePoints = chart.getElementsAtEventForMode(evt, 'point', { intersect: true }, true); + + if (activePoints.length > 0) { + const clickedDatasetIndex = activePoints[0].datasetIndex; + chart.data.datasets[clickedDatasetIndex].hidden = !chart.data.datasets[clickedDatasetIndex].hidden; + + chart.update(); + } +}); + + + return chart; } + function handleSearchQuery() { var search_query = window.location.search; const params = new URLSearchParams(search_query);