import type { StockPanel } from "./StockPanel"; import type { Axis } from "../xy/axes/Axis"; import type { DateAxis } from "../xy/axes/DateAxis"; import type { AxisRenderer } from "../xy/axes/AxisRenderer"; import type { IValueAxisSettings } from "../xy/axes/ValueAxis"; import type { XYSeries, IXYSeriesDataItem, IXYSeriesSettings } from "../xy/series/XYSeries"; import type { DataItem } from "../../core/render/Component"; import type { Indicator } from "./indicators/Indicator"; import type { DrawingSeries } from "./drawing/DrawingSeries"; import type { StockControl } from "./toolbar/StockControl"; import { MultiDisposer, IDisposer } from "../../core/util/Disposer"; import { SpriteResizer } from "../../core/render/SpriteResizer"; import { Container, IContainerPrivate, IContainerSettings, IContainerEvents } from "../../core/render/Container"; import { ListAutoDispose } from "../../core/util/List"; import { Rectangle } from "../../core/render/Rectangle"; import { Percent } from "../../core/util/Percent"; import { SettingsModal } from "./SettingsModal"; import { Color } from "../../core/util/Color"; import type { ISpritePointerEvent } from "../../core/render/Sprite"; export interface IStockChartSettings extends IContainerSettings { /** * The main price series. Indicators are calculated from it, compared * series are added to its panel, and drawings snap to it. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/#Setting_main_series} */ stockSeries?: XYSeries; /** * The main volume series, used by volume-based indicators. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/#Setting_main_series} */ volumeSeries?: XYSeries; /** * @ignore */ comparingSeriesSettings?: Partial; /** * Settings applied to the series on the main series' Y axis while the * chart is in percent scale mode. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/percent-mode/#Configuring} for more info */ percentScaleSeriesSettings?: Partial; /** * Settings applied to the main series' [[ValueAxis]] while the chart is in * percent scale mode. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/percent-mode/#Configuring} for more info */ percentScaleValueAxisSettings?: Partial>; /** * Turns percent scale mode on when a compared series is added, and off * when the last one is removed. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/percent-mode/} for more info * @default true */ autoSetPercentScale?: boolean; /** * Color of the `stockSeries` candles or columns that close at or above * their open. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/#Positive_negative_colors} for more info */ stockPositiveColor?: Color | null; /** * Color of the `stockSeries` candles or columns that close below their * open. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/#Positive_negative_colors} for more info */ stockNegativeColor?: Color | null; /** * Color that `getVolumeColor()` returns for a volume column whose * `stockSeries` close is at or above the previous close. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/#Positive_negative_colors} for more info */ volumePositiveColor?: Color | null; /** * Color that `getVolumeColor()` returns for a volume column whose * `stockSeries` close is below the previous close. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/#Positive_negative_colors} for more info */ volumeNegativeColor?: Color | null; /** * Makes drawings selectable, so they can be moved, rotated or deleted. * Turns `erasingEnabled` off. * * @default false * @since 5.9.1 */ drawingSelectionEnabled?: boolean; /** * Deletes a drawing when it is clicked. Turns drawing selection off. * * @default false * @since 5.9.2 */ erasingEnabled?: boolean; /** * Hides the drawings' grips while drawing mode is off. * * @default false * @since 5.10.6 */ hideDrawingGrips?: boolean; /** * Hides each panel's controls until the pointer is over that panel's plot * area. * * @default false * @since 5.13.0 */ autoHidePanelControls?: boolean; } export interface IStockChartPrivate extends IContainerPrivate { /** * The [[SettingsModal]] that edits indicators and series. */ settingsModal: SettingsModal; /** * Whether the chart is in percent scale mode, as set by * `setPercentScale()`. */ comparing?: boolean; /** * Series added with `addComparingSeries()`. */ comparedSeries?: XYSeries[]; /** * Date axis of the main series' panel. The date axes of the other panels * follow its range. */ mainAxis?: DateAxis; drawingSelectionEnabled?: boolean; } export interface IStockChartEvents extends IContainerEvents { /** * A drawing was added, changed or removed. */ drawingsupdated: {}; /** * An indicator was added or removed, or one of its editable settings * changed. */ indicatorsupdated: {}; /** * A drawing was added. * * @since 5.9.0 */ drawingadded: { drawingId: string; series: DrawingSeries; index: number; }; /** * A drawing was removed. * * @since 5.9.0 */ drawingremoved: { drawingId: string; series: DrawingSeries; index: number; }; /** * A drawing was selected. * * @since 5.9.0 */ drawingselected: { drawingId: string; series: DrawingSeries; index: number; }; /** * A drawing was unselected. * * @since 5.9.0 */ drawingunselected: { drawingId: string; series: DrawingSeries; index: number; }; } /** * The stock chart: [[StockPanel]] charts stacked over one date range, with * indicators, drawings and series comparison. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/} for more info * @important */ export declare class StockChart extends Container { static className: string; static classNames: Array; _settings: IStockChartSettings; _privateSettings: IStockChartPrivate; _events: IStockChartEvents; protected _xAxes: Array>; protected _downY?: number; protected _upperPanel?: StockPanel; protected _dhp?: Percent; protected _uhp?: Percent; protected _downResizer?: Rectangle; protected _syncExtremesDp?: MultiDisposer; protected _drawingsChanged: boolean; protected _indicatorsChanged: boolean; protected _baseDP?: IDisposer; /** * The chart's panels, from top to bottom. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/#Panels} for more info */ readonly panels: ListAutoDispose; /** * The chart's indicators. * * @see {@link https://www.amcharts.com/docs/v5/charts/stock/indicators/} for more info */ readonly indicators: ListAutoDispose; /** * A container above the panels for extra tools, such as a [[Scrollbar]]. */ readonly toolsContainer: Container; /** * The container the panels are placed in. */ readonly panelsContainer: Container; /** * All [[StockControl]] elements created for this chart. * * @since 5.7.0 */ readonly controls: StockControl[]; /** * The [[SpriteResizer]] that resizes and rotates icon and label drawings. * * @since 5.7.0 */ spriteResizer: SpriteResizer; protected _afterNew(): void; protected _dispose(): void; /** * Dispatches `drawingsupdated` on the next update. */ markDirtyDrawings(): void; /** * Dispatches `indicatorsupdated` on the next update. */ markDirtyIndicators(): void; /** * Updates the drawings for drawing mode turning on or off: icon and label * drawings react to the pointer only while it is on, and with * `hideDrawingGrips`, grips show only while it is on. * * @param enabled Drawing mode on * @since 5.10.6 */ toggleDrawing(enabled?: boolean): void; _prepareChildren(): void; _afterChanged(): void; _updateChildren(): void; /** * Turns percent scale mode on or off. In it, `percentScaleSeriesSettings` * apply to the series on the main series' Y axis, and * `percentScaleValueAxisSettings` to that axis. Also turns that axis' * `logarithmic` off. * * @param percentScale Percent scale on; if not set, on when there are compared series */ setPercentScale(percentScale?: boolean): void; /** * Adds a series to compare with `stockSeries`: to its panel, and to its * legend with a close button. With `autoSetPercentScale`, also turns on * percent scale mode. * * @param series Compared series * @return The same series */ addComparingSeries(series: XYSeries): XYSeries; /** * Removes a compared series. With `autoSetPercentScale`, turns percent * scale mode off when no compared series are left. * * @param series Compared series */ removeComparingSeries(series: XYSeries): void; protected _maybePrepSeriesDefaults(series: XYSeries): void; /** * Returns a series setting as it was before percent scale mode changed it. * * @param series Series * @param setting Setting key * @return Value */ getSeriesDefault(series: XYSeries, setting: keyof IXYSeriesSettings): any; protected _maybePrepAxisDefaults(): void; protected _processIndicator(indicator: Indicator): void; protected _removeIndicator(indicator: Indicator): void; protected _removePanel(chart: StockPanel): void; _updateControls(): void; protected _processPanel(panel: StockPanel): void; _updateResizers(): void; protected _syncYAxesSize(): void; protected _removeXAxis(_axis: Axis): void; protected _processXAxis(axis: Axis): void; protected _syncExtremes(): void; protected _syncXAxes(axis: Axis): void; /** * Returns the color for a volume column: `positiveColor` if the * `stockSeries` close at that data item is at or above the previous close, * `negativeColor` if it is below. * * @param dataItem Data item of the volume column * @param negativeColor Color for a lower close; `volumeNegativeColor` if not set * @param positiveColor Color for a higher or equal close; `volumePositiveColor` if not set * @return Color */ getVolumeColor(dataItem: DataItem, negativeColor?: Color, positiveColor?: Color): Color | undefined; /** * Returns the first [[StockControl]] of a class, such as * `"DrawingControl"`. * * @since 5.7.0 * @param type Class name of the control * @return Control */ getControl(type: string): StockControl | undefined; _dragStartDrawing(event: ISpritePointerEvent): void; _dragStopDrawing(event: ISpritePointerEvent): void; /** * Makes drawings react to the pointer, or not. * * @param value Drawings interactive? * @param except Drawing series to leave as it is * @since 5.4.9 */ drawingsInteractive(value: boolean, except?: DrawingSeries): void; /** * Unselects all selected drawings. * * @return Number of drawings unselected * @since 5.9.0 */ unselectDrawings(): number; /** * Cancels the drawing in progress, deleting it. * * @since 5.9.0 */ cancelDrawing(): void; /** * Deletes all selected drawings. * * @since 5.9.0 * */ deleteSelectedDrawings(): void; /** * Selects a drawing by its ID. Works only while drawing selection is on * (`drawingSelectionEnabled`). * * @param id Drawing ID * @param keepSelection Keep the drawings already selected * @since 5.9.0 */ selectDrawing(id: string, keepSelection?: boolean): void; /** * Unselects a drawing by its ID. * * @param id Drawing ID * @since 5.9.0 */ unselectDrawing(id: string): void; /** * Deletes a drawing by its ID. * * @param id Drawing ID * @since 5.9.0 */ deleteDrawing(id: string): void; } /** * Registers a custom class, such as an indicator, so that objects using it * can be serialized and restored. * * @param name Class name * @param ref Class reference * @since 5.7.2 */ export declare function registerClass(name: string, ref: any): void; //# sourceMappingURL=StockChart.d.ts.map