diff --git a/ts/src/stats/added.ts b/ts/src/stats/added.ts index b68160320..5d868e345 100644 --- a/ts/src/stats/added.ts +++ b/ts/src/stats/added.ts @@ -68,7 +68,10 @@ export function buildHistogram( return [null, []]; } - const colourScale = scaleSequential(interpolateBlues).domain([xMin!, xMax]); + const adjustedRange = scaleLinear().range([0.7, 0.3]); + const colourScale = scaleSequential((n) => + interpolateBlues(adjustedRange(n)) + ).domain([xMax!, xMin!]); const totalInPeriod = sum(bins, (bin) => bin.length); const cardsPerDay = Math.round(mean(bins, (bin) => bin.length) ?? 0); diff --git a/ts/src/stats/intervals.ts b/ts/src/stats/intervals.ts index b09459e31..c72a69b09 100644 --- a/ts/src/stats/intervals.ts +++ b/ts/src/stats/intervals.ts @@ -67,7 +67,6 @@ export function prepareIntervalData( return [null, []]; } - const total = allIntervals.length; const [_xMinOrig, origXMax] = extent(allIntervals); let xMax = origXMax; @@ -102,9 +101,10 @@ export function prepareIntervalData( return [null, []]; } - // start slightly darker - const shiftedMin = xMin! - Math.round((xMax - xMin!) / 10); - const colourScale = scaleSequential(interpolateBlues).domain([shiftedMin, xMax]); + const adjustedRange = scaleLinear().range([0.7, 0.3]); + const colourScale = scaleSequential((n) => + interpolateBlues(adjustedRange(n)) + ).domain([xMax!, xMin!]); function hoverText( data: HistogramData,