diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d90b7dbcc..d19044034 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -254,6 +254,7 @@ nav1s Ranjit Odedra Eltaurus jariji +Junia Mannervik ******************** diff --git a/ts/lib/tslib/time.ts b/ts/lib/tslib/time.ts index 25d70eef3..0e6330f38 100644 --- a/ts/lib/tslib/time.ts +++ b/ts/lib/tslib/time.ts @@ -178,9 +178,11 @@ export function dayLabel(daysStart: number, daysEnd: number): string { daysEnd: daysEnd - 1, }); } else { + const mostRecent = daysEnd <= 0 ? Math.abs(daysEnd - 1) : 0; + const oldest = -daysStart; return tr.statisticsDaysAgoRange({ - daysStart: Math.abs(daysEnd - 1), - daysEnd: -daysStart, + daysStart: mostRecent, + daysEnd: oldest, }); } } diff --git a/ts/routes/graphs/calendar.ts b/ts/routes/graphs/calendar.ts index 863923095..14c32d089 100644 --- a/ts/routes/graphs/calendar.ts +++ b/ts/routes/graphs/calendar.ts @@ -118,6 +118,10 @@ export function renderCalendar( // don't fill out future dates continue; } + if (date.getFullYear() != targetYear) { + // only fill blanks for the target year + continue; + } if (revlogRange == RevlogRange.Year && date < oneYearAgoFromNow) { // don't fill out dates older than a year continue; diff --git a/ts/routes/graphs/reviews.ts b/ts/routes/graphs/reviews.ts index ed0e07f8c..35db5868a 100644 --- a/ts/routes/graphs/reviews.ts +++ b/ts/routes/graphs/reviews.ts @@ -111,9 +111,7 @@ export function renderReviews( const desiredBars = Math.min(70, Math.abs(xMin!)); const x = scaleLinear().domain([xMin!, xMax]); - if (range === GraphRange.AllTime) { - x.nice(desiredBars); - } + const sourceMap = showTime ? sourceData.reviewTime : sourceData.reviewCount; const bins = bin() @@ -212,7 +210,9 @@ export function renderReviews( } function tooltipText(d: BinType, cumulative: number): string { - const day = dayLabel(d.x0!, d.x1!); + const startDay = Math.trunc(d.x0!); + const endDay = Math.trunc(d.x1!); + const day = dayLabel(startDay, endDay); const totals = totalsForBin(d); const dayTotal = valueLabel(sum(totals)); let buf = ``;
${day}${dayTotal}