UNPKG

@devexperts/dxcharts-lite

Version:
181 lines (180 loc) 8.53 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, HitBoundsTest } 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 { CanvasInputListenerComponent } from '../../inputlisteners/canvas-input-listener.component'; import { Bounds } from '../../model/bounds.model'; import { CanvasModel } from '../../model/canvas.model'; import { ChartBaseElement } from '../../model/chart-base-element'; import { DataSeriesModel } from '../../model/data-series.model'; import { ScaleModel } from '../../model/scale.model'; import { Pixel, Price, Unit } from '../../model/scaling/viewport.model'; import { AtLeastOne } from '../../utils/object.utils'; import { ChartBaseModel } from '../chart/chart-base.model'; import { PriceAxisType } from '../labels_generator/numeric-axis-labels.generator'; import { ChartPanComponent } from '../pan/chart-pan.component'; import { YAxisComponent } from '../y_axis/y-axis.component'; import { YExtentComponent, YExtentCreationOptions } from './extent/y-extent-component'; import { PaneHitTestController } from './pane-hit-test.controller'; import { HitTestCanvasModel } from '../../model/hit-test-canvas.model'; import { ChartResizeHandler } from '../../inputhandlers/chart-resize.handler'; export declare class PaneComponent extends ChartBaseElement { chartBaseModel: ChartBaseModel<'candle'>; private mainCanvasModel; private yAxisLabelsCanvasModel; readonly dynamicObjectsCanvasModel: CanvasModel; private hitTestController; private config; private mainScale; private drawingManager; private chartPanComponent; private canvasInputListener; private canvasAnimation; private cursorHandler; eventBus: EventBus; private canvasBoundsContainer; readonly uuid: string; seriesAddedSubject: Subject<DataSeriesModel>; seriesRemovedSubject: Subject<DataSeriesModel>; private hitTestCanvasModel; private chartResizeHandler; /** * Pane hit test (without Y-Axis and resizer) */ ht: HitBoundsTest; yExtentComponents: YExtentComponent[]; yExtentComponentsChangedSubject: Subject<void>; get scale(): ScaleModel; get yAxis(): YAxisComponent; get dataSeries(): DataSeriesModel<import("../../model/data-series.model").DataSeriesPoint, import("../../model/data-series.model").VisualSeriesPoint>[]; get visible(): boolean; mainExtent: YExtentComponent; constructor(chartBaseModel: ChartBaseModel<'candle'>, mainCanvasModel: CanvasModel, yAxisLabelsCanvasModel: CanvasModel, dynamicObjectsCanvasModel: CanvasModel, hitTestController: PaneHitTestController, config: FullChartConfig, mainScale: ScaleModel, drawingManager: DrawingManager, chartPanComponent: ChartPanComponent, canvasInputListener: CanvasInputListenerComponent, canvasAnimation: CanvasAnimation, cursorHandler: CursorHandler, eventBus: EventBus, canvasBoundsContainer: CanvasBoundsContainer, uuid: string, seriesAddedSubject: Subject<DataSeriesModel>, seriesRemovedSubject: Subject<DataSeriesModel>, hitTestCanvasModel: HitTestCanvasModel, chartResizeHandler: ChartResizeHandler, options?: AtLeastOne<YExtentCreationOptions>); /** * Method that activates the canvas bounds container and recalculates the zoom Y of the scale model. * @protected * @function * @returns {void} */ protected doActivate(): void; toY(price: Price): Pixel; /** * Creates a new GridComponent instance with the provided parameters. * @param {string} uuid - The unique identifier of the pane. * @param {ScaleModel} scale - The scale model used to calculate the scale of the grid. * @param {YAxisConfig} yAxisState - y Axis Config * @param {() => NumericAxisLabel[]} yAxisLabelsGetter * @param {() => Unit} yAxisBaselineGetter * @returns {GridComponent} - The newly created GridComponent instance. */ private createGridComponent; /** * Creates a handler for Y-axis panning of the chart. * @private * @param {string} uuid - The unique identifier of the chart pane. * @param {ScaleModel} scale - The scale model of the chart. * @returns [Unsubscriber, DragNDropYComponent] */ private createYPanHandler; private addCursors; createExtentComponent(options?: AtLeastOne<YExtentCreationOptions>): YExtentComponent; removeExtentComponents(extentComponents: YExtentComponent[]): void; /** * Create new pane extent and attach data series to it */ moveDataSeriesToNewExtentComponent(dataSeries: DataSeriesModel[], initialPane: PaneComponent, initialExtent: YExtentComponent, align?: YAxisAlign): void; /** * Attach data series to existing y axis extent */ moveDataSeriesToExistingExtentComponent(dataSeries: DataSeriesModel[], initialPane: PaneComponent, initialExtent: YExtentComponent, extentComponent: YExtentComponent, isForceKeepExtent?: boolean): void; /** * This method updates the view by calling the doAutoScale method of the scaleModel and firing the Draw event using the eventBus. * @private */ updateView(): void; /** * Merges all the y-axis extents on the pane into one. */ mergeYExtents(): void; getYAxisBounds: () => Bounds; /** * Returns the bounds of the pane component. */ getBounds(): Bounds; /** * Creates a new DataSeriesModel object. * @returns {DataSeriesModel} - The newly created DataSeriesModel object. */ createDataSeries(): DataSeriesModel; /** * Adds a new data series to the chart. * @param {DataSeriesModel} series - The data series to be added. * @returns {void} */ addDataSeries(series: DataSeriesModel): void; /** * Removes a data series from the chart. * * @param {DataSeriesModel} series - The data series to be removed. * @returns {void} */ removeDataSeries(series: DataSeriesModel): void; /** * Returns the type of the y-axis component for the current pane. * * @returns {PriceAxisType} The 'regular' type of the y-axis component for the current pane. * */ getAxisType(): PriceAxisType; /** * Moves the canvas bounds container up by calling the movePaneUp method with the uuid of the current object. * @returns {void} * @deprecated Use `paneManager.movePaneUp()` instead */ moveUp(): void; /** * Moves the canvas bounds container down by calling the movePaneDown method with the uuid of the current object. * @returns {void} * @deprecated Use `paneManager.movePaneDown()` instead */ moveDown(): void; /** * Checks if the current pane can move up. * @returns {boolean} - Returns true if the current pane can move up, otherwise false. * @deprecated Use `paneManager.canMovePaneUp()` instead */ canMoveUp(): 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. * @deprecated Use `paneManager.canMovePaneDown()` instead */ canMoveDown(): boolean; valueFormatter: (value: Unit, dataSeries?: DataSeriesModel) => string; get regularFormatter(): (value: number, precision?: number | undefined) => string; /** * Sets the pane value formatters for the current instance. * @param {YExtentFormatters} formatters - The pane value formatters to be set. */ setPaneValueFormatters(formatters: YExtentFormatters): void; /** * Returns the regular value from Y coordinate. * @param {number} y - The Y coordinate. * @returns {number} - The regular value. */ regularValueFromY(y: number): number; } export interface YExtentFormatters { regular: (value: number, precision?: number) => string; percent?: (value: number, dataSeries?: DataSeriesModel) => string; logarithmic?: (value: number) => string; }