Skip to content

useMeasure

Measure price changes, percentage swings, bar count and time intervals between two points on the chart.

import { useMeasure } from "react-klinecharts-ui";
const { isActive, startMeasure, cancelMeasure, result, clearResult, fromPoint } =
useMeasure();
PropertyTypeDescription
isActivebooleanWhether measurement mode is enabled
startMeasure() => voidEnter measurement mode (click two points)
cancelMeasure() => voidExit measurement mode
resultMeasureResult | nullMeasurement data (null until measured)
clearResult() => voidClear the current measurement result
fromPointMeasurePoint | nullFirst picked point while measuring (null when inactive)
interface MeasureResult {
priceDiff: number; // absolute price difference
pricePercent: number; // percentage change
bars: number; // number of bars between points
timeDiff: number; // time difference in ms
}