From 7a08970bf7149e9abefb5dc4ed74b39de323dbb8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 8 Jul 2020 13:31:09 +1000 Subject: [PATCH] another attempt at fixing review graph This should correctly show today count in the 1 month/3 month graphs. 1+ year will have a very tiny bar, but the today count is not so important at that range. I experimented with shifting the numbers by one at the gathering stage (so -1 = today) - that makes today fit in the previous bin, but means the bars no longer match the ticks. --- ts/src/stats/reviews.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ts/src/stats/reviews.ts b/ts/src/stats/reviews.ts index 42ca2b275..b89e719d7 100644 --- a/ts/src/stats/reviews.ts +++ b/ts/src/stats/reviews.ts @@ -139,6 +139,8 @@ export function renderReviews( const desiredBars = Math.min(70, Math.abs(xMin!)); const x = scaleLinear().domain([xMin!, xMax]).nice(desiredBars); + x.domain([x.domain()[0], xMax]); + const sourceMap = showTime ? sourceData.reviewTime : sourceData.reviewCount; const bins = histogram() .value((m) => { @@ -347,10 +349,6 @@ export function renderReviews( .attr("height", () => y(0) - y(yMax!)) .on("mousemove", function (this: any, d: any, idx) { const [x, y] = mouse(document.body); - if (d.x0! >= 0) { - // don't show 'in x days' at the end of the graph - return; - } showTooltip(tooltipText(d, areaData[idx + 1]), x, y); }) .on("mouseout", hideTooltip);