Skip to content

<KLineChart.YAxis>

<KLineChart.YAxis> manages the lifecycle of a standalone Y axis. KLineCharts v10 supports multiple Y axes per pane — use this to add an extra axis (e.g. a secondary price scale on the candle pane). It renders nothing.

<KLineChart data={data}>
<KLineChart.YAxis value={{ paneId: "candle", position: "left" }} />
</KLineChart>
Prop Type Description
value YAxisOverride Y axis config. createYAxis is idempotent, so changing value is safe.
  • MountcreateYAxis({ ...value, id }) with a stable id (useId()). Since the id is fresh, a new axis is created and the config is applied.
  • value changeoverrideYAxis. The first run is skipped.
  • paneId / name change → recreates the axis.
  • UnmountremoveYAxis({ id }).
import { useYAxis } from "react-klinecharts";
function MyYAxis() {
const id = useYAxis({ value: { paneId: "candle", position: "left" } });
return null;
}

useYAxis returns the axis id (or null).