import type { ScaleLinear } from 'd3-scale';
import { useRef } from 'react';
import { useLinearPrimaryTicks } from 'react-d3-utils';
import { useChartData } from '../../context/ChartContext.js';
import { D3Axis } from '../../elements/D3Axis.js';
import { useJGraph } from './JGraphContext.js';
export function JGraphVerticalAxis() {
const { width, margin } = useChartData();
const { scaleY } = useJGraph();
if (!scaleY) return null;
return (
);
}
interface VerticalAxisProps {
width: number;
scale: ScaleLinear;
x: number;
y: number;
}
function LinearVerticalAxis(props: VerticalAxisProps) {
const { scale, x, y, width } = props;
const ref = useRef(null);
const { scale: ticksScale, ticks } = useLinearPrimaryTicks(
scale,
'vertical',
ref,
);
return (
);
}