UNPKG

@devexperts/dxcharts-lite

Version:
143 lines (142 loc) 6.65 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 { Subject } from 'rxjs'; import { CanvasAnimation } from '../../animation/canvas-animation'; import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container'; import { CursorHandler } from '../../canvas/cursor.handler'; import { FullChartConfig, YAxisAlign } from '../../chart.config'; import { DrawingManager } from '../../drawers/drawing-manager'; import EventBus from '../../events/event-bus'; import { CrossEventProducerComponent } from '../../inputhandlers/cross-event-producer.component'; import { CanvasInputListenerComponent, Point } from '../../inputlisteners/canvas-input-listener.component'; import { CanvasModel } from '../../model/canvas.model'; import { ChartBaseElement, ChartEntity } from '../../model/chart-base-element'; import { ScaleModel } from '../../model/scale.model'; import { AtLeastOne } from '../../utils/object.utils'; import { ChartBaseModel } from '../chart/chart-base.model'; import { ChartPanComponent } from '../pan/chart-pan.component'; import { YExtentComponent, YExtentCreationOptions } from './extent/y-extent-component'; import { PaneHitTestController } from './pane-hit-test.controller'; import { PaneComponent } from './pane.component'; import { DataSeriesModel } from '../../model/data-series.model'; import { HitTestCanvasModel } from '../../model/hit-test-canvas.model'; import { ChartResizeHandler } from '../../inputhandlers/chart-resize.handler'; export type MoveDataSeriesToPaneDirection = 'above' | 'below'; interface MoveDataSeriesToPaneOptions { paneUUID?: string; extent?: YExtentComponent; direction?: MoveDataSeriesToPaneDirection; align?: YAxisAlign; extentIdx?: number; isForceKeepPane?: boolean; index?: number; } export declare class PaneManager extends ChartBaseElement { private chartBaseModel; private dynamicObjectsCanvasModel; private userInputListenerComponents; private eventBus; private mainScale; private canvasBoundsContainer; private config; private canvasAnimation; private canvasInputListener; private drawingManager; private cursorHandler; private crossEventProducer; chartPanComponent: ChartPanComponent; private mainCanvasModel; private yAxisLabelsCanvasModel; private hitTestCanvasModel; private chartResizeHandler; panes: Record<string, PaneComponent>; paneRemovedSubject: Subject<PaneComponent>; paneAddedSubject: Subject<Record<string, PaneComponent>>; hitTestController: PaneHitTestController; dataSeriesAddedSubject: Subject<DataSeriesModel>; dataSeriesRemovedSubject: Subject<DataSeriesModel>; /** * Returns order of panes in the chart from top to bottom. */ get panesOrder(): string[]; constructor(chartBaseModel: ChartBaseModel<'candle'>, dynamicObjectsCanvasModel: CanvasModel, userInputListenerComponents: ChartEntity[], eventBus: EventBus, mainScale: ScaleModel, canvasBoundsContainer: CanvasBoundsContainer, config: FullChartConfig, canvasAnimation: CanvasAnimation, canvasInputListener: CanvasInputListenerComponent, drawingManager: DrawingManager, cursorHandler: CursorHandler, crossEventProducer: CrossEventProducerComponent, chartPanComponent: ChartPanComponent, mainCanvasModel: CanvasModel, yAxisLabelsCanvasModel: CanvasModel, hitTestCanvasModel: HitTestCanvasModel, chartResizeHandler: ChartResizeHandler); private addBounds; /** * Adds a resizer to the canvas bounds container for the given uuid. * @param {string} uuid - The uuid of the pane to which the resizer is to be added. * @returns {BarResizerComponent} - The BarResizerComponent instance that was added to the userInputListenerComponents array. */ private addResizer; get yExtents(): YExtentComponent[]; /** * Returns the pane component that contains the given point. * @param {Point} point - The point to check. * @returns {PaneComponent | undefined} - The pane component that contains the point or undefined if no pane contains it. */ getPaneIfHit(point: Point): PaneComponent | undefined; /** * Creates sub-plot on the chart with y-axis * @param uuid * @param {AtLeastOne<YExtentCreationOptions>} options * @returns */ createPane(uuid?: string, options?: AtLeastOne<YExtentCreationOptions>): PaneComponent; /** * Moves the canvas bounds container up by calling the movePaneUp method with the uuid of the current object. * @returns {void} */ movePaneUp(uuid: string): void; /** * Moves the canvas bounds container down by calling the movePaneDown method with the uuid of the current object. * @returns {void} */ movePaneDown(uuid: string): void; /** * Checks if the current pane can move up. * @returns {boolean} - Returns true if the current pane can move up, otherwise false. */ canMovePaneUp(uuid: string): boolean; /** * Checks if the current pane can move down. * * @returns {boolean} - Returns true if the current pane is not the last one in the canvasBoundsContainer, otherwise returns false. */ canMovePaneDown(uuid: string): boolean; /** * Removes pane from the chart and all related components * @param uuid */ removePane(uuid: string): void; /** * Hides a pane from the chart and all related components */ hidePane(paneUUID: string): void; /** * Shows a pane, use if the pane is hidden */ showPane(paneUUID: string): void; /** * Move data series to a certain pane, or create a new one if no pane is found */ moveDataSeriesToPane(dataSeries: DataSeriesModel[], initialPane: PaneComponent, initialExtent: YExtentComponent, options: MoveDataSeriesToPaneOptions): void; /** * Adds cursors to the chart elements based on the provided uuid and cursor type. * @private * @param {string} uuid - The unique identifier for the chart element. * @param {string} [cursor=this.config.components.chart.cursor] - The type of cursor to be added to the chart element. * @returns {void} */ private addCursors; /** * Recalculates the zoom Y of all pane components and fires a draw event on the event bus. * @function * @name recalculateState * @memberof PaneManager * @returns {void} */ recalculateState(): void; } export {};