@mui/x-charts
Version:
The community edition of the Charts components (MUI X).
19 lines (18 loc) • 511 B
JavaScript
'use client';
import { useCartesianContext } from "../context/CartesianProvider/index.js";
export function useXAxis(identifier) {
const {
xAxis,
xAxisIds
} = useCartesianContext();
const id = typeof identifier === 'string' ? identifier : xAxisIds[identifier ?? 0];
return xAxis[id];
}
export function useYAxis(identifier) {
const {
yAxis,
yAxisIds
} = useCartesianContext();
const id = typeof identifier === 'string' ? identifier : yAxisIds[identifier ?? 0];
return yAxis[id];
}