Are you an AI agent?

useLastYValue

useLastYValue: (chart: ChartInstance, seriesId: string) => { value: number; isLive: boolean } | null

Reactive snapshot of the most-recent Y value for a series: { value, isLive }, or null before the series has data. 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.value.toFixed(2)}</span>;
}