reduce maximum lightness in added/interval graphs

This commit is contained in:
Damien Elmes 2020-08-05 15:43:44 +10:00
parent 15c50e68eb
commit ddfd6511bf
2 changed files with 8 additions and 5 deletions

View File

@ -68,7 +68,10 @@ export function buildHistogram(
return [null, []]; 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 totalInPeriod = sum(bins, (bin) => bin.length);
const cardsPerDay = Math.round(mean(bins, (bin) => bin.length) ?? 0); const cardsPerDay = Math.round(mean(bins, (bin) => bin.length) ?? 0);

View File

@ -67,7 +67,6 @@ export function prepareIntervalData(
return [null, []]; return [null, []];
} }
const total = allIntervals.length;
const [_xMinOrig, origXMax] = extent(allIntervals); const [_xMinOrig, origXMax] = extent(allIntervals);
let xMax = origXMax; let xMax = origXMax;
@ -102,9 +101,10 @@ export function prepareIntervalData(
return [null, []]; return [null, []];
} }
// start slightly darker const adjustedRange = scaleLinear().range([0.7, 0.3]);
const shiftedMin = xMin! - Math.round((xMax - xMin!) / 10); const colourScale = scaleSequential((n) =>
const colourScale = scaleSequential(interpolateBlues).domain([shiftedMin, xMax]); interpolateBlues(adjustedRange(n))
).domain([xMax!, xMin!]);
function hoverText( function hoverText(
data: HistogramData, data: HistogramData,