import type { DataItem } from "../../core/render/Component"; import { Series, ISeriesSettings, ISeriesDataItem, ISeriesPrivate, ISeriesEvents } from "./Series"; import { Container } from "../../core/render/Container"; import { Label } from "../../core/render/Label"; import { RoundedRectangle } from "../../core/render/RoundedRectangle"; import { ListTemplate } from "../../core/util/List"; import type { Entity, IEntitySettings } from "../../core/util/Entity"; import type { Color } from "../../core/util/Color"; export interface ILegendDataItem extends ISeriesDataItem { /** * The [[Container]] that holds all elements of the legend item. */ itemContainer: Container; /** * The marker's container. */ marker: Container; /** * The rectangle of the default marker. */ markerRectangle: RoundedRectangle; /** * The label with the item's name. */ label: Label; /** * The label with the item's value. */ valueLabel: Label; /** * Marker fill color. */ fill?: Color; /** * Marker stroke (outline) color. */ stroke?: Color; /** * Name of the legend item. */ name?: string; } export interface ILegendItemSettings extends IEntitySettings { visible?: boolean; } /** * @ignore */ export interface ILegendItem extends Entity { _settings: ILegendItemSettings; isHidden?: () => boolean; show?: () => void; hide?: () => void; createLegendMarker?: () => {}; component?: Series; updateLegendValue?: () => {}; } export interface ILegendSettings extends ISeriesSettings { /** * Shows a plain rectangle marker instead of one that mimics the look of * the item. * * @default false */ useDefaultMarker?: boolean; /** * Setting of each legend item (a series or a data item) to take its name * from. * * @default "name" */ nameField?: string; /** * Setting of each legend item to take its marker's fill color from. * * @default "fill" */ fillField?: string; /** * Setting of each legend item to take its marker's stroke color from. * * @default "stroke" */ strokeField?: string; /** * Which part of a legend item toggles the chart item when clicked: * * `"itemContainer"` - the whole legend item (default). * * `"marker"` - the marker only. * * `"none"` - nothing; the legend items cannot be toggled. * * @default "itemContainer" * @since 5.0.13 */ clickTarget?: "itemContainer" | "marker" | "none"; } export interface ILegendPrivate extends ISeriesPrivate { } export interface ILegendEvents extends ISeriesEvents { } /** * A list of items, one per series or data item, that can be clicked to show * or hide them. * * @important * @see {@link https://www.amcharts.com/docs/v5/concepts/legend/} for more info */ export declare class Legend extends Series { protected _afterNew(): void; static className: string; static classNames: Array; _settings: ILegendSettings; _privateSettings: ILegendPrivate; _dataItemSettings: ILegendDataItem; _events: ILegendEvents; /** * The containers of the legend items, one per item. */ readonly itemContainers: ListTemplate; /** * @ignore */ makeItemContainer(dataItem: DataItem): Container; /** * @ignore */ makeMarker(): Container; /** * The markers of the legend items. */ readonly markers: ListTemplate; /** * @ignore */ makeLabel(): Label; /** * The name labels of the legend items. */ readonly labels: ListTemplate