Open XQ-0 opened 1 year ago
How to get the position of the mouse when moving
tvWidget.onChartReady(() => {
let crosshairValue;
const crosshairMovedHandler = (params) => {
crosshairValue = params;
};
tvWidget.activeChart().crossHairMoved().subscribe(null, crosshairMovedHandler);
tvWidget.subscribe('mouse_down', () => {
const mouseUpHandler = () => {
console.log(crosshairValue);
tvWidget.unsubscribe('mouse_up', mouseUpHandler);
};
tvWidget.subscribe('mouse_up', mouseUpHandler);
});
}