UNPKG

@devexperts/dxcharts-lite

Version:
67 lines (66 loc) 3.47 kB
/* * Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { BehaviorSubject } from 'rxjs'; import { ChartConfigComponentsCrossTool } from '../../chart.config'; import { CrossEventProducerComponent } from '../../inputhandlers/cross-event-producer.component'; import { Hover, HoverProducerComponent } from '../../inputhandlers/hover-producer.component'; import { CanvasModel } from '../../model/canvas.model'; import { ChartBaseElement } from '../../model/chart-base-element'; import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container'; import { BaselineModel } from '../../model/baseline.model'; export type CrossToolType = 'cross-and-labels' | 'only-labels' | 'none' | string; export interface CrossToolHover { x: number; y: number; time: string; paneId: string; } export declare class CrossToolModel extends ChartBaseElement { private config; private crossToolCanvasModel; private crossEventProducer; private hoverProducer; private canvasBoundsContainer; private baselineModel; currentHoverSubject: BehaviorSubject<CrossToolHover | null>; get currentHover(): CrossToolHover | null; set currentHover(value: CrossToolHover | null); constructor(config: Required<ChartConfigComponentsCrossTool>, crossToolCanvasModel: CanvasModel, crossEventProducer: CrossEventProducerComponent, hoverProducer: HoverProducerComponent, canvasBoundsContainer: CanvasBoundsContainer, baselineModel: BaselineModel); /** * Sets the type of the CrossTool object. * * @param {CrossToolType} type - The type of the CrossTool object. * @returns {void} */ setType(type: CrossToolType): void; /** * Method to activate the cross tool. * It subscribes to the hoverProducer's hover event and updates the crosstool. */ protected doActivate(): void; /** * This method is used to fire the draw event of the crossToolCanvasModel if the type is not 'none'. * @private */ private fireDraw; /** * Updates the current hover position with the provided hover object. * @param {Object} hover - The hover object containing the x and y coordinates and time formatted. * @param magnetTarget {MagnetTarget} * @param {number} hover.x - The x coordinate of the hover. * @param {number} hover.y - The y coordinate of the hover. * @param {string} hover.timeFormatted - The formatted time of the hover. * @param {Object} hover.candleHover - The candle hover object containing the open, close, high, low and closestOHLCY coordinates. * @param {number} hover.candleHover.openY - The y coordinate of the open price of the candle. * @param {number} hover.candleHover.closeY - The y coordinate of the close price of the candle. * @param {number} hover.candleHover.highY - The y coordinate of the high price of the candle. * @param {number} hover.candleHover.lowY - The y coordinate of the low price of the candle. * @param {number} hover.candleHover.closestOHLCY - The y coordinate of the closest OHLC price of the candle. * @returns {void} */ updateCrossTool(hover: Hover, magnetTarget?: import("./cross-tool.component").MagnetTarget): void; private updateCrossToolMobile; }