From 38838a6d0b66888a1e8569602be3ff903bdb9780 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 1 Jul 2020 13:32:01 +1000 Subject: [PATCH] fix invalid cumulative path when no data available --- ts/src/stats/histogram-graph.ts | 2 +- ts/src/stats/reviews.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/src/stats/histogram-graph.ts b/ts/src/stats/histogram-graph.ts index 628218441..86806df44 100644 --- a/ts/src/stats/histogram-graph.ts +++ b/ts/src/stats/histogram-graph.ts @@ -102,7 +102,7 @@ export function histogramGraph( const areaData = cumsum(areaCounts); const yAreaScale = y.copy().domain([0, data.total]); - if (data.showArea && data.bins.length) { + if (data.showArea && data.bins.length && areaData.slice(-1)[0]) { svg.select("path.area") .datum(areaData as any) .attr( diff --git a/ts/src/stats/reviews.ts b/ts/src/stats/reviews.ts index a725a9499..6ce9bc790 100644 --- a/ts/src/stats/reviews.ts +++ b/ts/src/stats/reviews.ts @@ -309,7 +309,7 @@ export function renderReviews( const areaData = cumsum(areaCounts); const yAreaScale = y.copy().domain([0, areaData.slice(-1)[0]]); - if (bins.length) { + if (areaData.slice(-1)[0]) { svg.select("path.area") .datum(areaData as any) .attr(