useYAxis
useYAxis(options) manages the lifecycle of a standalone Y axis. It’s the hook equivalent of <KLineChart.YAxis>.
import { useYAxis } from "react-klinecharts";
function MyYAxis() { const id = useYAxis({ value: { paneId: "candle", position: "left" } }); return null;}Signature
Section titled “Signature”function useYAxis(options: UseYAxisOptions): Nullable<string>Returns the axis id (or null).
Options
Section titled “Options”| Option | Type | Description |
|---|---|---|
value |
YAxisOverride |
Y axis config. createYAxis is idempotent, so changing value is safe. |
Behavior
Section titled “Behavior”- Creates the axis on mount via
createYAxis({ ...value, id })with a stable id. - Overrides config when
valuechanges (skips the first run). - Recreates the axis when
paneIdornamechanges. - Removes the axis on unmount via
removeYAxis({ id }).