import type { Color } from "../util/Color"; import type { Percent } from "../util/Percent"; import type { DataItem, IComponentDataItem } from "./Component"; import type { Gradient } from "../render/gradients/Gradient"; import { Text } from "../render/Text"; import { Container, IContainerPrivate, IContainerSettings, IContainerEvents } from "./Container"; export interface ILabelSettings extends IContainerSettings { /** * The label's text. It can hold in-line formatting and, with * `populateText`, data placeholders. * * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/text-styling/} for text styling info * */ text?: string; /** * Text color. */ fill?: Color; /** * Text opacity, from `0` (transparent) to `1` (opaque). * * @default 1 * @since 5.2.39 */ fillOpacity?: number; /** * Fill gradient. * * @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/gradients/} for more information * @since 5.10.1 */ fillGradient?: Gradient; /** * Horizontal alignment of the text's lines. */ textAlign?: "start" | "end" | "left" | "right" | "center"; /** * Font family, or a comma-separated list of them. * * `"inherit"` uses the font of the chart's container element (since * `5.17.3`). */ fontFamily?: string; /** * Font size: a number in pixels, or any CSS size, such as `"1em"` or * `"12pt"`. */ fontSize?: string | number; /** * Font weight. */ fontWeight?: "normal" | "bold" | "bolder" | "lighter" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; /** * Font style. */ fontStyle?: "normal" | "italic" | "oblique"; /** * Font variant. */ fontVariant?: "normal" | "small-caps"; /** * Text decoration: `"underline"` or `"line-through"`. * * @since 5.0.15 */ textDecoration?: "underline" | "line-through"; /** * Line height as a multiple of the font's line height: a number, such as * `1.5`, or a percent, such as `am5.percent(150)`. If not set, it is `1.2`. */ lineHeight?: Percent | number; /** * Share of the line height that lies below the text's baseline. * * @default 0.19 */ baselineRatio?: number; /** * Opacity of the label, from `0` (transparent) to `1` (opaque). */ opacity?: number; /** * Text direction. * * @default "ltr" */ direction?: "ltr" | "rtl"; /** * The baseline the text is aligned to vertically, as in the canvas * `textBaseline`. */ textBaseline?: "top" | "hanging" | "middle" | "alphabetic" | "ideographic" | "bottom"; /** * What to do with text that does not fit the label's `maxWidth` (or * `maxHeight`): `"hide"` it, `"fit"` it by scaling it down, `"wrap"` it * onto more lines, wrap it without breaking words (`"wrap-no-break"`), or * `"truncate"` it with an ellipsis. * * LIMITATIONS: on circular labels, the only values supported are `"hide"` and * `"truncate"`. The latter will ignore `breakWords` setting. * * @see {@link https://www.amcharts.com/docs/v5/concepts/common-elements/labels/#Oversized_text} for more info */ oversizedBehavior?: "none" | "hide" | "fit" | "wrap" | "wrap-no-break" | "truncate"; /** * Lets truncation cut words in the middle. Wrapping does not use it. * * @default false */ breakWords?: boolean; /** * Characters added at the end of truncated text. * * The default Unicode ellipsis (`"…"`) is missing from some fonts. If it * looks broken, use other characters, e.g.: * * ```TypeScript * label.set("ellipsis", "..."); * ``` * ```JavaScript * label.set("ellipsis", "..."); * ``` * * * @default "…" */ ellipsis?: string; /** * Smallest scale, from `0` to `1`, that `oversizedBehavior: "fit"` may * shrink the text to. Text that would need to shrink more is hidden. */ minScale?: number; /** * Fills data placeholders in `text`, such as `{value}`, with values from * the label's data item. * * @see {@link https://www.amcharts.com/docs/v5/concepts/common-elements/labels/#Data_placeholders} for more info * * @default false */ populateText?: boolean; /** * Shows `text` exactly as it is, without applying in-line formatting * blocks such as `[bold]`. * * @default false */ ignoreFormatting?: boolean; /** * Color of the text's shadow. It shows only when `shadowBlur`, * `shadowOffsetX` or `shadowOffsetY` is set too. * * @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/shadows/} for more info */ shadowColor?: Color | null; /** * Blurriness of the shadow: the bigger the number, the blurrier the shadow. * * @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/shadows/} for more info */ shadowBlur?: number; /** * Horizontal shadow offset in pixels. * * @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/shadows/} for more info */ shadowOffsetX?: number; /** * Vertical shadow offset in pixels. * * @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/shadows/} for more info */ shadowOffsetY?: number; /** * Opacity of the shadow, from `0` to `1`. If not set, the shadow takes the * opacity of the text. * * @see {@link https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/shadows/} for more info */ shadowOpacity?: number; /** * Maximum number of characters in the label. A longer `text` is cut, using * the `breakWords` and `ellipsis` settings. * * @since 5.7.2 */ maxChars?: number; } export interface ILabelPrivate extends IContainerPrivate { } export interface ILabelEvents extends IContainerEvents { } /** * A text element with padding and an optional background. Its text can hold * in-line formatting and data placeholders. * * @see {@link https://www.amcharts.com/docs/v5/concepts/common-elements/labels/} for more info */ export declare class Label extends Container { _settings: ILabelSettings; _privateSettings: ILabelPrivate; _events: ILabelEvents; protected _text: Text; protected _textKeys: Array; static className: string; static classNames: Array; /** * @ignore Text is not to be used directly */ get text(): Text; protected _afterNew(): void; _makeText(): void; /** * Returns the value to push downstream to the [[Text]] for a given key. * * For the font settings (`fontFamily`/`fontSize`/`fontWeight`) the label's * own value is used only when it was explicitly set on the label * (`isUserSetting`) or when there is no matching `Root` setting. Otherwise a * `Root`-level default takes precedence, so it overrides theme values but * never an explicit per-label value. */ protected _getTextKeyValue(property: string): any; _updateChildren(): void; protected _maybeUpdateHTMLColor(): void; protected _setMaxDimentions(): void; _setDataItem(dataItem?: DataItem): void; /** * Returns the label's text, with data placeholders filled in when * `populateText` is `true`. * * @return Populated text */ getText(): string; /** * Returns "aria-label" text with populated placeholders and formatting * if `populateText` is set to `true`. * * @return Populated text */ getAccessibleText(): string; } //# sourceMappingURL=Label.d.ts.map