I'm using d3js to draw some graphs in my awesome UI, here below the scales I'm calling.
import {ScaleLinear, scaleLinear } from 'd3';
Given the scale I have created below
const history = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const maxValue = Math.max(...history);
const localYScale: ScaleLinear<number, number> = scaleLinear().domain([0, maxValue]).range([0, 32]);
by calling localYScale(0) I would expect the returned value to be 0 but it's returning 16...
I did few tweaks to investigate and turns out that if I assign a fallback value that is very close from 0 the localYScale(0) method returns the expected value for some reasons...
const maxValue = Math.max(...history) || 0,001;
I'm I missing something here with d3?....
Thanks