Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getScales(props, { innerHeight, innerWidth }) {
const { data: rawData, min, max, valueAccessor } = props || this.props;
const data = rawData.map(parsedDatumThunk(valueAccessor));
const yExtent = extent(data, getY);
const xScale = scaleLinear({
domain: [0, data.length - 1],
range: [0, innerWidth],
});
const yScale = scaleLinear({
domain: [isDefined(min) ? min : yExtent[0], isDefined(max) ? max : yExtent[1]],
range: [innerHeight, 0],
});
return { xScale, yScale, data };
}
getScales(props, { innerHeight, innerWidth }) {
const { data: rawData, min, max, valueAccessor } = props || this.props;
const data = rawData.map(parsedDatumThunk(valueAccessor));
const yExtent = extent(data, getY);
const xScale = scaleLinear({
domain: [0, data.length - 1],
range: [0, innerWidth],
});
const yScale = scaleLinear({
domain: [isDefined(min) ? min : yExtent[0], isDefined(max) ? max : yExtent[1]],
range: [innerHeight, 0],
});
return { xScale, yScale, data };
}