From ca5106d61341826a3b0d175655e511698a859139 Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Thu, 16 Nov 2023 16:33:38 +0530 Subject: [PATCH] resize card for test counts --- src/components/TestAnalytics.css | 29 ++++------------------------ src/components/TestAnalytics.js | 5 ++++- src/components/TestAnalyticsGraph.js | 4 ++-- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/components/TestAnalytics.css b/src/components/TestAnalytics.css index 4df1a2f..02fd9a8 100644 --- a/src/components/TestAnalytics.css +++ b/src/components/TestAnalytics.css @@ -1,38 +1,17 @@ -.analytics-page::-webkit-scrollbar { - display: none; -} - -.analytics-title::-webkit-scrollbar { - display: none; -} - -.analytics-page { - width: 100vw; -} - -.analytics-container { +.container { display: flex; flex-direction: column; align-items: center; justify-content: center; - font-family: sans-serif; -} - -.analytics-title { - padding: 10px; - text-align: center; - background: rgb(207, 235, 250); - color: black; - font-size: 30px; - font-family: sans-serif; + height: 50vh; } @media screen and (min-width: 900px) { - .analytics-container { + .container { display: flex; flex-direction: row; align-items: center; justify-content: center; - height: 45vh; + height: 50vh; } } \ No newline at end of file diff --git a/src/components/TestAnalytics.js b/src/components/TestAnalytics.js index e6bab32..4808fa1 100644 --- a/src/components/TestAnalytics.js +++ b/src/components/TestAnalytics.js @@ -53,7 +53,10 @@ const TestAnalytics = () => { const dailyCountsList = Object.entries(dailyCounts).sort().map(x => { return { date: x[0], count: x[1] }; }); - setDailyResults(dailyCountsList); + if (dailyCountsList?.length > 7) + setDailyResults(dailyCountsList.slice(dailyCountsList.length - 7, dailyCountsList.length)); + else + setDailyResults(dailyCountsList); const rss = _.groupBy(hposTests, function (test) { return moment(test.testTime).startOf('day').format(); }); diff --git a/src/components/TestAnalyticsGraph.js b/src/components/TestAnalyticsGraph.js index 9d7218a..3d25ff9 100644 --- a/src/components/TestAnalyticsGraph.js +++ b/src/components/TestAnalyticsGraph.js @@ -26,7 +26,7 @@ class TestAnalyticsGraph extends Component { data.reverse(); var margin = { top: 30, right: 20, bottom: 50, left: 15 }, - width = 1500 - margin.left - margin.right, + width = 400 - margin.left - margin.right, height = 180 - margin.top - margin.bottom; var svg = d3.select("#tests-count-graph").append('svg') @@ -113,7 +113,7 @@ class TestAnalyticsGraph extends Component { drawChart(data) { if (!data) return; var margin = { top: 20, right: 20, bottom: 30, left: 50 }, - width = 960 - margin.left - margin.right, + width = 420 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; const INNER_WIDTH = width;// - margin.left - margin.right;