From 853520d3b037c1094af92a90da4be01f89e19bba Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:48:36 +0900 Subject: [PATCH] sales analyzer tooltips --- Monitor/Pages/SalesAnalyzer.cshtml | 88 +++++++++-------------- Monitor/Pages/_get/DashboardBottom.cshtml | 51 +++++++------ 2 files changed, 56 insertions(+), 83 deletions(-) diff --git a/Monitor/Pages/SalesAnalyzer.cshtml b/Monitor/Pages/SalesAnalyzer.cshtml index 2d341a3..84a0393 100644 --- a/Monitor/Pages/SalesAnalyzer.cshtml +++ b/Monitor/Pages/SalesAnalyzer.cshtml @@ -394,20 +394,7 @@ .transition().duration(0) .call(salesChart); - // Add mouseleave, and mousemove event listeners to hide tooltip - d3.select('.sales-chart').on('mouseleave', function() { - d3.select('.nvtooltip').remove(); - }); - - d3.select('body').on('mousemove', function() { - var chartBounds = d3.select('.sales-chart')[0][0].getBoundingClientRect(); - var mouseX = d3.event.clientX; - var mouseY = d3.event.clientY; - - if (mouseX < chartBounds.left || mouseX > chartBounds.right || mouseY < chartBounds.top || mouseY > chartBounds.bottom) { - d3.select('.nvtooltip').remove(); - } - }); + nv.utils.windowResize(salesChart.update); return salesChart; }); @@ -442,20 +429,7 @@ .transition().duration(0) .call(cumulativeProfitChart); - // Add mouseleave, and mousemove event listeners to hide tooltip - d3.select('.cumulative-profit-chart').on('mouseleave', function() { - d3.select('.nvtooltip').remove(); - }); - - d3.select('body').on('mousemove', function() { - var chartBounds = d3.select('.cumulative-profit-chart')[0][0].getBoundingClientRect(); - var mouseX = d3.event.clientX; - var mouseY = d3.event.clientY; - - if (mouseX < chartBounds.left || mouseX > chartBounds.right || mouseY < chartBounds.top || mouseY > chartBounds.bottom) { - d3.select('.nvtooltip').remove(); - } - }); + nv.utils.windowResize(cumulativeProfitChart.update); return cumulativeProfitChart; }); @@ -490,20 +464,6 @@ .transition().duration(0) .call(TCVChart); - // Add mouseleave, and mousemove event listeners to hide tooltip - d3.select('.TCV-chart').on('mouseleave', function() { - d3.select('.nvtooltip').remove(); - }); - - d3.select('body').on('mousemove', function() { - var chartBounds = d3.select('.TCV-chart')[0][0].getBoundingClientRect(); - var mouseX = d3.event.clientX; - var mouseY = d3.event.clientY; - - if (mouseX < chartBounds.left || mouseX > chartBounds.right || mouseY < chartBounds.top || mouseY > chartBounds.bottom) { - d3.select('.nvtooltip').remove(); - } - }); nv.utils.windowResize(TCVChart.update); return TCVChart; }); @@ -561,20 +521,6 @@ }); - // Add mouseleave, and mousemove event listeners to hide tooltip - d3.select('.profit-chart').on('mouseleave', function() { - d3.select('.nvtooltip').remove(); - }); - - d3.select('body').on('mousemove', function() { - var chartBounds = d3.select('.profit-chart')[0][0].getBoundingClientRect(); - var mouseX = d3.event.clientX; - var mouseY = d3.event.clientY; - - if (mouseX < chartBounds.left || mouseX > chartBounds.right || mouseY < chartBounds.top || mouseY > chartBounds.bottom) { - d3.select('.nvtooltip').remove(); - } - }); nv.utils.windowResize(profitChart.update); return profitChart; }); @@ -582,4 +528,34 @@ } })(jQuery); + + + } diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml index 3a972d2..1e6f386 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml +++ b/Monitor/Pages/_get/DashboardBottom.cshtml @@ -493,33 +493,30 @@