window size 7 days

This commit is contained in:
Pritimay Sarkar
2023-09-10 10:05:52 +05:30
parent 772db018ee
commit 8f3812ab67
6 changed files with 229 additions and 6 deletions

View File

@@ -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();
});

View File

@@ -68,8 +68,8 @@ div#tests-count-graph {
}
svg#bargraph {
height: 180px; /* 500px; */
width: 700px; /* 1100px; */
height: 160px; /* 500px; */
width: 400px; /* 1100px; */
/* border: 1px dotted #ccc; */
/* background-color: #ccc; */
}

View File

@@ -23,10 +23,10 @@ class TestAnalyticsGraph extends Component {
drawBar(data) {
if (!data) return;
data.reverse();
// data.reverse();
var margin = { top: 30, right: 20, bottom: 50, left: 15 },
width = 900 - margin.left - margin.right,
var margin = { top: 30, right: 20, bottom: 50, left: 55 },
width = 400 - margin.left - margin.right,
height = 180 - margin.top - margin.bottom;
var svg = d3.select("#tests-count-graph").append('svg')