import React, { useMemo } from "react"; import { ScaleLinear, scaleLinear } from "d3-scale"; type Props = { x: number; y: number; scale: ScaleLinear; }; export const AxisScaleLinear = ({ x = 0, y = 0, scale }: Props) => { const orient = "bottom"; const ticks = useMemo( () => scale.ticks().map((value) => ({ value, xOffset: scale(value), })), [] ); // console.log("ticks:", ticks); const range = scale.range(); return ( {ticks.map(({ value, xOffset }) => ( {value} ))} ); };