mirror of
https://github.com/ankitects/anki.git
synced 2026-01-09 03:53:55 -05:00
modified youngest bar in reviews to include today aswell
This commit is contained in:
parent
a3fc69fe89
commit
e3546ea496
1 changed files with 17 additions and 3 deletions
|
|
@ -123,13 +123,27 @@ export function renderReviews(
|
||||||
}
|
}
|
||||||
|
|
||||||
const sourceMap = showTime ? sourceData.reviewTime : sourceData.reviewCount;
|
const sourceMap = showTime ? sourceData.reviewTime : sourceData.reviewCount;
|
||||||
const bins = bin()
|
let bins = bin()
|
||||||
.value((m) => {
|
.value((m) => {
|
||||||
return m[0];
|
return m[0];
|
||||||
})
|
})
|
||||||
.domain(x.domain() as any)
|
.domain(x.domain() as any)
|
||||||
.thresholds(thresholds)(sourceMap.entries() as any);
|
.thresholds(thresholds)(sourceMap.entries() as any);
|
||||||
|
|
||||||
|
if (bins.length > 1 && thresholds.length > 1) {
|
||||||
|
const lastBin = bins[bins.length - 1];
|
||||||
|
const prevBin = bins[bins.length - 2];
|
||||||
|
const nominalWidth = thresholds[1] - thresholds[0];
|
||||||
|
const lastWidth = lastBin.x1! - lastBin.x0!;
|
||||||
|
if (lastBin.x1! > 0 && lastWidth < nominalWidth * 0.75) {
|
||||||
|
for (const entry of lastBin) {
|
||||||
|
prevBin.push(entry);
|
||||||
|
}
|
||||||
|
prevBin.x1 = lastBin.x1;
|
||||||
|
bins = bins.slice(0, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// empty graph?
|
// empty graph?
|
||||||
const totalDays = sum(bins, (bin) => bin.length);
|
const totalDays = sum(bins, (bin) => bin.length);
|
||||||
if (!totalDays) {
|
if (!totalDays) {
|
||||||
|
|
@ -219,8 +233,8 @@ export function renderReviews(
|
||||||
}
|
}
|
||||||
|
|
||||||
function tooltipText(d: BinType, cumulative: number): string {
|
function tooltipText(d: BinType, cumulative: number): string {
|
||||||
const startDay = Math.trunc(d.x0!);
|
const startDay = Math.floor(d.x0!);
|
||||||
const endDay = Math.trunc(d.x1!);
|
const endDay = Math.ceil(d.x1!);
|
||||||
const day = dayLabel(startDay, endDay);
|
const day = dayLabel(startDay, endDay);
|
||||||
const totals = totalsForBin(d);
|
const totals = totalsForBin(d);
|
||||||
const dayTotal = valueLabel(sum(totals));
|
const dayTotal = valueLabel(sum(totals));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue