import ZRText, { TextStyleProps } from 'zrender/lib/graphic/Text.js'; import Element, { ElementTextConfig } from 'zrender/lib/Element.js'; import Model from '../model/Model.js'; import { LabelOption, DisplayState, TextCommonOption, StatesOptionMixin, DisplayStateNonNormal, ColorString, ZRStyleProps, AnimationOptionMixin, InterpolatableValue } from '../util/types.js'; import GlobalModel from '../model/Global.js'; import SeriesData from '../data/SeriesData.js'; declare type TextCommonParams = { /** * Whether disable drawing box of block (outer most). */ disableBox?: boolean; /** * Specify a color when color is 'inherit', * If inheritColor specified, it is used as default textFill. */ inheritColor?: ColorString; /** * Specify a opacity when opacity is not given. */ defaultOpacity?: number; defaultOutsidePosition?: LabelOption['position']; /** * If support legacy 'auto' for 'inherit' usage. */ textStyle?: ZRStyleProps; }; interface SetLabelStyleOpt extends TextCommonParams { defaultText?: string | ((labelDataIndex: TLabelDataIndex, opt: SetLabelStyleOpt, interpolatedValue?: InterpolatableValue) => string); labelFetcher?: { getFormattedLabel: (labelDataIndex: TLabelDataIndex, status: DisplayState, dataType?: string, labelDimIndex?: number, formatter?: string | ((params: object) => string), extendParams?: { interpolatedValue: InterpolatableValue; }) => string; }; labelDataIndex?: TLabelDataIndex; labelDimIndex?: number; /** * Inject a setter of text for the text animation case. */ enableTextSetter?: boolean; } declare type LabelModel = Model string); showDuringLabel?: boolean; }>; declare type LabelModelForText = Model & { formatter?: string | ((params: any) => string); }>; declare type LabelStatesModels = Partial> & { normal: LabelModel; }; export declare function setLabelText(label: ZRText, labelTexts: Record): void; /** * Set normal styles and emphasis styles about text on target element * If target is a ZRText. It will create a new style object. * If target is other Element. It will create or reuse ZRText which is attached on the target. * And create a new style object. * * NOTICE: Because the style on ZRText will be replaced with new(only x, y are keeped). * So please update the style on ZRText after use this method. */ declare function setLabelStyle(targetEl: ZRText, labelStatesModels: LabelStatesModels, opt?: SetLabelStyleOpt, stateSpecified?: Partial>): void; declare function setLabelStyle(targetEl: Element, labelStatesModels: LabelStatesModels, opt?: SetLabelStyleOpt, stateSpecified?: Partial>): void; export { setLabelStyle }; export declare function getLabelStatesModels(itemModel: Model & Partial>>, labelName?: LabelName): Record; /** * Set basic textStyle properties. */ export declare function createTextStyle(textStyleModel: Model, specifiedTextStyle?: TextStyleProps, // Fixed style in the code. Can't be set by model. opt?: Pick, isNotNormal?: boolean, isAttached?: boolean): TextStyleProps; export declare function createTextConfig(textStyleModel: Model, opt?: Pick, isNotNormal?: boolean): ElementTextConfig; export declare function getFont(opt: Pick, ecModel: GlobalModel): string; export declare const labelInner: (hostObj: ZRText) => { /** * Previous target value stored used for label. * It's mainly for text animation */ prevValue?: InterpolatableValue; /** * Target value stored used for label. */ value?: InterpolatableValue; /** * Current value in text animation. */ interpolatedValue?: InterpolatableValue; /** * If enable value animation */ valueAnimation?: boolean; /** * Label value precision during animation. */ precision?: number | 'auto'; /** * If enable value animation */ statesModels?: LabelStatesModels; /** * Default text getter during interpolation */ defaultInterpolatedText?: (value: InterpolatableValue) => string; /** * Change label text from interpolated text during animation */ setLabelText?: (interpolatedValue?: InterpolatableValue) => void; }; export declare function setLabelValueAnimation(label: ZRText, labelStatesModels: LabelStatesModels, value: InterpolatableValue, getDefaultText: (value: InterpolatableValue) => string): void; export declare function animateLabelValue(textEl: ZRText, dataIndex: number, data: SeriesData, animatableModel: Model, labelFetcher: SetLabelStyleOpt['labelFetcher']): void;