Wick Charts

useLastYValue

useLastYValue: (chart: ChartInstance, seriesId: string) => number | null

Reactive snapshot of the most-recent Y value for a series. Tracks the smoothed value used by <YLabel>, so values animate consistently with the price badge.

Example

import { useChartInstance, useLastYValue } from '@wick-charts/react';
 
function PriceBadge({ seriesId }: { seriesId: string }) {
const chart = useChartInstance();
const last = useLastYValue(chart, seriesId);
if (last === null) return null;
 
return <span className="badge">${last.toFixed(2)}</span>;
}