import type { Root } from "../../core/Root"; import type { Chart } from "./Chart"; import type { Bullet } from "./Bullet"; import type { Graphics } from "../../core/render/Graphics"; import type { ILegendDataItem } from "./Legend"; import { Template } from "../../core/util/Template"; import type { Sprite } from "../../core/render/Sprite"; import type { Pattern } from "./patterns/Pattern"; import type { Gradient } from "./gradients/Gradient"; import type { IBounds } from "../../core/util/IBounds"; import type { IDisposer } from "../../core/util/Disposer"; import { Component, IComponentSettings, IComponentPrivate, DataItem, IComponentEvents, IComponentDataItem } from "../../core/render/Component"; import { List } from "../../core/util/List"; import { Color } from "../../core/util/Color"; import { Container } from "../../core/render/Container"; import { Label } from "../../core/render/Label"; import { LabelFit } from "../../core/util/Fit"; declare class LabelBoxes { protected _cells: { [key: string]: Array; }; hits(box: IBounds): boolean; add(box: IBounds): void; protected _cellsOf(box: IBounds, f: (key: string) => void): void; } /** * A rule that sets a setting of each series element, such as its color or * size, by its data item's value: from `min` at the lowest value to `max` at * the highest. * * @see {@link https://docs.amcharts.com/v5/concepts/settings/heat-rules/} for more info */ export interface IHeatRule { /** * Template of the elements to set, e.g. `series.columns.template`. */ target: Template; /** * Setting value for the element with the lowest value. */ min?: any; /** * Setting value for the element with the highest value. */ max?: any; /** * Setting value for elements whose data item has no value. */ neutral?: any; /** * Setting values for a scale through more than two, in place of `min` and * `max`: the element with the lowest value gets the first, the one with * the highest the last, and the ones between blend through the stops * between. Numbers, percents or colors, all of one kind, e.g. * `[negative, warning, positive]` from the interface colors. Values * outside `minValue` and `maxValue` get the first or last stop. * * @since 5.21.2 */ stops?: Array; /** * Data item field that holds the value, e.g. `"value"` or `"valueY"`. */ dataField: string; /** * The setting to set, e.g. `"fill"`. */ key?: string; /** * Lowest value of the range. If not set, the series' lowest value is used, * which needs `calculateAggregates`. Lower values get `min`. */ minValue?: number; /** * Highest value of the range. If not set, the series' highest value is * used, which needs `calculateAggregates`. Higher values get `max`. */ maxValue?: number; /** * Spreads the values between `min` and `max` on a logarithmic scale. * Values of zero or less get `min`. If `minValue` is zero or less, the * lowest value above zero is used instead. * * @default false */ logarithmic?: boolean; /** * A function that sets the element's settings itself, in place of `min`, * `max` and `key`. It is called for each element, also for one with no * value. */ customFunction?: (target: Sprite, minValue: number, maxValue: number, value?: any) => void; } export interface ISeriesDataItem extends IComponentDataItem { id?: string; /** * A URL to open when the data item's element is clicked. * * @since 5.20.7 */ url?: string; value?: number; valueWorking?: number; valueChange?: number; valueChangePercent?: number; valueChangeSelection?: number; valueChangeSelectionPercent?: number; valueChangePrevious?: number; valueChangePreviousPercent?: number; valueWorkingOpen?: number; valueWorkingClose?: number; customValue?: number; customValueWorking?: number; customValueChange?: number; customValueChangePercent?: number; customValueChangeSelection?: number; customValueChangeSelectionPercent?: number; customValueChangePrevious?: number; customValueChangePreviousPercent?: number; } /** * One data item in a series' summary for screen readers. */ export interface ISeriesSummaryItem { /** * What the value is for: a category, date or name. */ label: string; /** * The value. */ value: number; /** * The value, formatted. */ text: string; } /** * A summary of a series' data, as returned by `getSummary()`. */ export interface ISeriesSummary { /** * Number of data items with a value. */ count: number; /** * The first data item with a value (series whose data has an order, like * XY series). */ first?: ISeriesSummaryItem; /** * The last data item with a value (series whose data has an order). */ last?: ISeriesSummaryItem; /** * The data item with the highest value. */ highest: ISeriesSummaryItem; /** * The data item with the lowest value. */ lowest: ISeriesSummaryItem; /** * All of it in a few short sentences, as screen readers read it. */ text: string; } /** * Sets an element's `ariaDescription` to a summary the library worked out, * unless one was set in code. No text takes it away. * * @ignore */ export declare function setSummaryDescription(target: Sprite | undefined, text: string | undefined): void; /** * One column of a data table for screen readers: a heading and its values. * * @ignore */ export interface IDataTableColumn { name: string; items: Array; } /** * Builds or updates a data table for screen readers, hidden from view, for * `owner` (a chart, or a series not in a chart): a row for each category or * date, a column for each series. No columns take it away. Returns the table. * * @ignore */ export declare function renderDataTable(owner: Sprite, table: HTMLTableElement | undefined, columns: Array): HTMLTableElement | undefined; export interface ISeriesSettings extends IComponentSettings { /** * Name of the series. */ name?: string; /** * Describes the series' data to screen readers in a few short sentences: * how many values it has, its highest and lowest, and where the data has * an order (XY series), its first and last. * * The summary goes to the series' legend item, and to the series itself * when it is not in a chart (a hierarchy, flow or word cloud), for which * the series has to be `focusable`. In a chart, set `ariaSummary` on the * chart instead: then `false` here leaves this series out. * * @since 5.24.0 * @see {@link https://docs.amcharts.com/v5/concepts/accessibility/#data-summary} for more info */ ariaSummary?: boolean; /** * Gives screen readers the series' data as a table, hidden from view: a * row for each category or date, with its value. Screen readers can move * through it by row and column. * * With grouped data (a date axis with `groupData`), the table has the * groups shown when the chart is zoomed out all the way, whatever the zoom. * * In a chart, set `ariaDataTable` on the chart instead, for one table with * a column for each series: then `false` here leaves this series out. * A series not in a chart (a hierarchy, flow or word cloud) with `true` * gets a table of its own. * * @since 5.24.0 * @see {@link https://docs.amcharts.com/v5/concepts/accessibility/#data-table} for more info */ ariaDataTable?: boolean; /** * A key to look up in data for an id of the data item. */ idField?: string; /** * A key to look up in data for a URL to open when the data item's element * (a bullet, column, slice, map polygon or map line) is clicked. Links are * off until this is set. * * @since 5.20.7 */ urlField?: string; /** * Where a data item's URL opens: `"_self"` for the same window, `"_blank"` * for a new tab, or a named window / frame. A chart embedded in an iframe * usually wants `"_blank"` or `"_top"`. * * @default "_self" * @since 5.20.7 */ linkTarget?: string; /** * A key to look up in data for a numeric value of the data item. Some * series draw their elements by it; heat rules can use it too. */ valueField?: string; /** * A key to look up in data for an extra numeric value of the data item * (`customValue`), e.g. for heat rules. */ customValueField?: string; /** * Text template for the item's label in a [[Legend]]. */ legendLabelText?: string; /** * Text template for the item's value label in a [[Legend]]. */ legendValueText?: string; /** * Shows and hides the data items one after another instead of all at * once, including in the initial animation. Works in XY and percent * series. * * @see {@link https://docs.amcharts.com/v5/concepts/animations/#animation-of-series} for more info */ sequencedInterpolation?: boolean; /** * Extra delay in milliseconds between the animations of consecutive data * items, with `sequencedInterpolation`. * * @see {@link https://docs.amcharts.com/v5/concepts/animations/#animation-of-series} for more info */ sequencedDelay?: number; /** * Heat rules to apply to the series' elements. A rule without `minValue` * and `maxValue` needs `calculateAggregates` to find the value range. * * @see {@link https://docs.amcharts.com/v5/concepts/settings/heat-rules/} for more info */ heatRules?: IHeatRule[]; /** * Makes the series compute aggregate values, such as sums, averages, lows, * highs and changes. * * Enable it only if they are used, e.g. in tooltips, data fields or heat * rules. */ calculateAggregates?: boolean; /** * Series stroke color. * * @see {@link https://docs.amcharts.com/v5/charts/xy-chart/series/#series-colors} for more info */ stroke?: Color; /** * Series fill color. * * @see {@link https://docs.amcharts.com/v5/charts/xy-chart/series/#series-colors} for more info */ fill?: Color; /** * Series fill pattern. * * @see {@link https://docs.amcharts.com/v5/concepts/colors-gradients-and-patterns/patterns/} for more info * @since 5.10.0 */ fillPattern?: Pattern; /** * Series fill gradient. * * @see {@link https://docs.amcharts.com/v5/concepts/colors-gradients-and-patterns/gradients/} for more info */ fillGradient?: Gradient; /** * Series stroke gradient. * * @see {@link https://docs.amcharts.com/v5/concepts/colors-gradients-and-patterns/gradients/} for more info */ strokeGradient?: Gradient; /** * The series' data item in a [[Legend]]. * * @readonly */ legendDataItem?: DataItem; /** * Fields to leave out of `calculateAggregates`, to save work where their * aggregates are not needed. * * @since 5.14.4 */ excludeFromAggregate?: Array; /** * Hides a label in the series' bullets where it would overlap a label * shown before it, or be cut off at the edge of the area it is drawn in. * Labels of the chart's earlier series come first, then those of earlier * data items. A hidden label comes back once it fits. * * Only labels are hidden: a bullet's circle or other shape stays. A label * with its own `forceHidden`, or in a bullet with `stacked` set, is left * as it is. Labels of series without this setting are never hidden, and * the others make room for them. * * @default false * @since 5.22.0 * @see {@link https://docs.amcharts.com/v5/concepts/common-elements/bullets/#hiding-overlapping-labels} for more info */ autoLabels?: boolean; } export interface ISeriesPrivate extends IComponentPrivate { /** * @ignore */ chart?: Chart; startIndex?: number; endIndex?: number; adjustedStartIndex?: number; adjustedEndIndex?: number; /** * Average of all data items' values (with `calculateAggregates`). */ valueAverage?: number; /** * Number of data items with a value (with `calculateAggregates`). */ valueCount?: number; /** * Sum of all data items' values (with `calculateAggregates`). */ valueSum?: number; /** * Sum of the absolute values of all data items (with `calculateAggregates`). */ valueAbsoluteSum?: number; /** * Lowest value of all data items (with `calculateAggregates`). */ valueLow?: number; /** * Highest value of all data items (with `calculateAggregates`). */ valueHigh?: number; /** * Value of the first data item that has one (with `calculateAggregates`). */ valueOpen?: number; /** * Value of the last data item that has one (with `calculateAggregates`). */ valueClose?: number; customValueAverage?: number; customValueCount?: number; customValueSum?: number; customValueAbsoluteSum?: number; customValueLow?: number; customValueHigh?: number; customValueOpen?: number; customValueClose?: number; baseValueSeries?: Series; } export interface ISeriesEvents extends IComponentEvents { } /** * Base class of all series. */ export declare abstract class Series extends Component { static className: string; static classNames: Array; _settings: ISeriesSettings; _privateSettings: ISeriesPrivate; _dataItemSettings: ISeriesDataItem; _events: ISeriesEvents; /** * @ignore */ _exportName(): string | undefined; /** * @ignore */ _dataItemName(dataItem: DataItem, sprite: Sprite): string | undefined; protected _aggregatesCalculated: boolean; protected _dataProcessed: boolean; protected _psi: number | undefined; protected _pei: number | undefined; protected _aggregatesStart: number | undefined; protected _aggregatesEnd: number | undefined; protected _aggregatesAdjustedStart: number | undefined; protected _aggregatesAdjustedEnd: number | undefined; protected _aggregatesOfAll?: Array<[string, number]>; protected _aggregatesSameOpen: boolean; protected _aggregatesPending: boolean; protected _aggregatesForced: boolean; protected _aggregatesLate: boolean; protected _baseSeriesDirty: boolean; protected _bulletPaint?: Template; protected _labelFit?: LabelFit; _passFrames: number; protected _passKey?: string; protected _passTime: number; /** * The chart the series belongs to. */ chart: Chart | undefined; /** * Functions that make the series' bullets: each is called for every data * item and returns a [[Bullet]], or nothing for no bullet. * * @see {@link https://docs.amcharts.com/v5/concepts/common-elements/bullets/} for more info */ bullets: List<(>(root: Root, series: Series, dataItem: D) => Bullet | undefined)>; /** * The [[Container]] that holds the series' bullets. */ readonly bulletsContainer: Container; protected _afterNew(): void; protected _dispose(): void; protected _summaryTimer: IDisposer | undefined; /** * The series' summary text, as last worked out for its chart. * * @ignore */ _summaryText: string | undefined; /** * Returns a summary of the series' data: how many values it has, its * highest and lowest, and where the data has an order its first and last, * with a text for screen readers. `undefined` if it has no values. * * @since 5.24.0 * @return Summary */ getSummary(): ISeriesSummary | undefined; protected _summaryItems(dataItems?: Array>): Array; protected _summaryLabel(dataItem: DataItem): string; protected _summaryValueText(value: number, _dataItem: DataItem): string; protected _summaryOrdered(): boolean; protected _summaryWanted(): boolean; protected _tableDataItems(): Array>; protected _tableWanted(): boolean; /** * The series' column of the data table, as last worked out for its chart. * * @ignore */ _tableItems: Array | undefined; protected _dataTable: HTMLTableElement | undefined; /** * The summary and the data table are worked out again a little later: * values can change many times in a row. * * @ignore */ _scheduleSummary(): void; protected _applySummary(): void; protected _eachBulletLabel(f: (label: Label, bullet: Bullet) => void): void; protected _bulletLabelShown(label: Label, drawn: { [uid: number]: boolean; }): boolean; protected _bulletDrawn(sprite: Sprite, drawn: { [uid: number]: boolean; }): boolean; protected _bulletLabelBox(label: Label): IBounds | undefined; protected _fitBulletLabels(): void; protected _fitOwnBulletLabels(placed: LabelBoxes, area: IBounds, clips: { [uid: number]: IBounds; }, drawn: { [uid: number]: boolean; }): void; _passDue(group: Array, key: string): boolean; protected _releaseBulletLabels(): void; /** * Returns the index of the first data item in the visible range. */ startIndex(): number; /** * Returns the index after the last data item in the visible range. */ endIndex(): number; protected _handleBullets(dataItems: Array>): void; protected _makeBullets(dataItem: DataItem): void; protected _shouldMakeBullet(_dataItem: DataItem): boolean; protected _makeBullet(dataItem: DataItem, bulletFunction: (root: Root, series: Series, dataItem: DataItem) => Bullet | undefined, index?: number): Bullet | undefined; /** * Container a data item's bullets are added to. Series that lay their data * items out as separate containers can put bullets into the item itself, so * that they move with it and can be stacked among its other children. */ protected _getBulletContainer(_dataItem: DataItem): Container; protected _makeBulletReal(dataItem: DataItem, bullet: Bullet): void; /** * Makes an element open its data item's URL when clicked. * * @ignore */ _linkSprite(sprite: Sprite, dataItem: DataItem): void; /** * Opens a data item's URL in the window set by `linkTarget`. * * Override to intercept links, e.g. in an editor. * * @param dataItem Data item * @since 5.20.7 */ openUrl(dataItem: DataItem): void; /** * A bullet whose shape defines none of its own paint inherits the full set * from the series, so bullets match their series without restating the color * (like columns do). It's all-or-nothing: if the bullet sets even one of * `fill`/`fillGradient`/`fillPattern`/`stroke`/`strokeGradient`, it is left * entirely alone. Only `Graphics`-based shapes are touched; container/label/ * picture bullets are left to style their own children. * * @ignore */ _applyBulletDefaultPaint(sprite: Sprite, dataItem?: DataItem): void; /** * Template with the series' paint, for bullets that have none of their own. * * @ignore */ _getBulletPaint(): Template; protected _syncBulletPaint(): void; /** * Adds a bullet to one data item. Unlike `series.bullets`, it takes a * [[Bullet]] instance, not a function. * * @see {@link https://docs.amcharts.com/v5/concepts/common-elements/bullets/#adding-directly-to-data-item} for more info * @since 5.6.0 * * @param dataItem Target data item * @param bullet Bullet instance */ addBullet(dataItem: DataItem, bullet: Bullet): void; protected _autoAppearReady(): boolean; _clearDirty(): void; _prepareChildren(): void; _handleRemoved(): void; /** * @ignore */ _adjustStartIndex(index: number): number; /** * @ignore */ _adjustEndIndex(index: number): number; /** * Whether the data shown is about to be replaced in this frame, so * aggregates worked out now would be thrown away. * * @ignore */ _aggregatesDeferred(): boolean; /** * Called after the aggregates in view were worked out again. * * @ignore */ _aggregatesChanged(): void; /** * Works out the aggregates of the data items in view (from `startIndex` * to `endIndex`), or with `all`, of all data items (`startIndex` 0 and * `endIndex` the number of data items). */ protected _calculateAggregates(startIndex: number, endIndex: number, all?: boolean): void; _updateChildren(): void; _positionBullets(dataItem: DataItem): void; protected _hideBullets(dataItem: DataItem): void; _positionBullet(_bullet: Bullet): void; _placeBulletsContainer(chart: Chart): void; _removeBulletsContainer(): void; /** * @ignore */ disposeDataItem(dataItem: DataItem): void; protected _getItemReaderLabel(): string; /** * Shows a data item and its bullets. * * @param dataItem Data item * @param duration Animation duration in milliseconds * @return Promise */ showDataItem(dataItem: DataItem, duration?: number): Promise; /** * Hides a data item and its bullets. * * @param dataItem Data item * @param duration Animation duration in milliseconds * @return Promise */ hideDataItem(dataItem: DataItem, duration?: number): Promise; protected _sequencedShowHide(show: boolean, duration?: number): Promise; /** * @ignore */ updateLegendValue(dataItem?: DataItem): void; /** * @ignore */ updateLegendMarker(_dataItem?: DataItem): void; protected _onHide(): void; /** * @ignore */ hoverDataItem(_dataItem: DataItem): void; /** * @ignore */ unhoverDataItem(_dataItem: DataItem): void; /** * @ignore */ _getBase(key: any): number; } export {}; //# sourceMappingURL=Series.d.ts.map