Omit zero interval, and don't nice the values

* to keep promise of radio buttons:
  * 1 month should mean 30/31 days
This commit is contained in:
Henrik Giesel 2021-01-08 00:09:12 +01:00
parent 97e3bfe1c0
commit e89996bc27

View file

@ -84,13 +84,12 @@ export function prepareIntervalData(
case IntervalRange.All: case IntervalRange.All:
break; break;
} }
const xMin = 0; const xMin = 1;
xMax = xMax! + 1; xMax = xMax! + 1;
// cap bars to available range // cap bars to available range
const desiredBars = Math.min(70, xMax! - xMin!); const desiredBars = Math.min(70, xMax! - xMin!);
const scale = scaleLinear().domain([xMin!, xMax!]);
const scale = scaleLinear().domain([xMin!, xMax!]).nice();
const bins = histogram() const bins = histogram()
.domain(scale.domain() as any) .domain(scale.domain() as any)
.thresholds(scale.ticks(desiredBars))(allIntervals); .thresholds(scale.ticks(desiredBars))(allIntervals);