import Displayable from 'zrender/lib/graphic/Displayable'; import { ImageStyleProps } from 'zrender/lib/graphic/Image'; import { PathProps, PathStyleProps } from 'zrender/lib/graphic/Path'; import { ZRenderType } from 'zrender/lib/zrender'; import { BarGridLayoutOptionForCustomSeries, BarGridLayoutResult } from '../../layout/barGrid'; import { BlurScope, CallbackDataParams, Dictionary, DimensionLoose, ItemStyleOption, LabelOption, OptionDataValue, OrdinalRawValue, ParsedValue, SeriesDataType, SeriesEncodeOptionMixin, SeriesOnCalendarOptionMixin, SeriesOnCartesianOptionMixin, SeriesOnGeoOptionMixin, SeriesOnPolarOptionMixin, SeriesOnSingleOptionMixin, SeriesOption, TextCommonOption, ZRStyleProps } from '../../util/types'; import Element, { ElementProps } from 'zrender/lib/Element'; import SeriesData, { DefaultDataVisual } from '../../data/SeriesData'; import GlobalModel from '../../model/Global'; import { CoordinateSystem } from '../../coord/CoordinateSystem'; import SeriesModel from '../../model/Series'; import { Arc, BezierCurve, Circle, CompoundPath, Ellipse, Line, Polygon, Polyline, Rect, Ring, Sector } from '../../util/graphic'; import { TextStyleProps } from 'zrender/lib/graphic/Text'; export interface LooseElementProps extends ElementProps { style?: ZRStyleProps; shape?: Dictionary; } export declare type CustomExtraElementInfo = Dictionary; export declare const TRANSFORM_PROPS: { readonly x: 1; readonly y: 1; readonly scaleX: 1; readonly scaleY: 1; readonly originX: 1; readonly originY: 1; readonly rotation: 1; }; export declare type TransformProp = keyof typeof TRANSFORM_PROPS; export declare const STYLE_VISUAL_TYPE: { readonly color: "fill"; readonly borderColor: "stroke"; }; export declare type StyleVisualProps = keyof typeof STYLE_VISUAL_TYPE; export declare const NON_STYLE_VISUAL_PROPS: { readonly symbol: 1; readonly symbolSize: 1; readonly symbolKeepAspect: 1; readonly legendIcon: 1; readonly visualMeta: 1; readonly liftZ: 1; readonly decal: 1; }; export declare type NonStyleVisualProps = keyof typeof NON_STYLE_VISUAL_PROPS; export declare type TransitionAnyOption = { transition?: TransitionAnyProps; enterFrom?: Dictionary; leaveTo?: Dictionary; }; declare type TransitionAnyProps = string | string[]; declare type TransitionTransformOption = { transition?: ElementRootTransitionProp | ElementRootTransitionProp[]; enterFrom?: Dictionary; leaveTo?: Dictionary; }; declare type ElementRootTransitionProp = TransformProp | 'shape' | 'extra' | 'style'; declare type ShapeMorphingOption = { /** * If do shape morphing animation when type is changed. * Only available on path. */ morph?: boolean; }; export interface CustomBaseDuringAPI { setTransform(key: TransformProp, val: number): this; getTransform(key: TransformProp): number; setExtra(key: string, val: unknown): this; getExtra(key: string): unknown; } export interface CustomDuringAPI extends CustomBaseDuringAPI { setShape(key: T, val: ShapeOpt[T]): this; getShape(key: T): ShapeOpt[T]; setStyle(key: T, val: StyleOpt[T]): this; getStyle(key: T): StyleOpt[T]; } export interface CustomBaseElementOption extends Partial>, TransitionTransformOption { type: string; id?: string; name?: string; info?: CustomExtraElementInfo; textContent?: CustomTextOption | false; clipPath?: CustomBaseZRPathOption | false; extra?: Dictionary & TransitionAnyOption; during?(params: CustomBaseDuringAPI): void; } export interface CustomDisplayableOption extends CustomBaseElementOption, Partial> { style?: ZRStyleProps & TransitionAnyOption; during?(params: CustomDuringAPI): void; /** * @deprecated */ styleEmphasis?: ZRStyleProps | false; emphasis?: CustomDisplayableOptionOnState; blur?: CustomDisplayableOptionOnState; select?: CustomDisplayableOptionOnState; } export interface CustomDisplayableOptionOnState extends Partial> { style?: (ZRStyleProps & TransitionAnyOption) | false; during?(params: CustomDuringAPI): void; } export interface CustomGroupOption extends CustomBaseElementOption { type: 'group'; width?: number; height?: number; diffChildrenByName?: boolean; children: CustomElementOption[]; $mergeChildren?: false | 'byName' | 'byIndex'; } export interface CustomBaseZRPathOption extends CustomDisplayableOption, ShapeMorphingOption { autoBatch?: boolean; shape?: T & TransitionAnyOption; style?: PathProps['style']; during?(params: CustomDuringAPI): void; } interface BuiltinShapes { circle: Partial; rect: Partial; sector: Partial; polygon: Partial; polyline: Partial; line: Partial; arc: Partial; bezierCurve: Partial; ring: Partial; ellipse: Partial; compoundPath: Partial; } interface CustomSVGPathShapeOption { pathData?: string; d?: string; layout?: 'center' | 'cover'; x?: number; y?: number; width?: number; height?: number; } export interface CustomSVGPathOption extends CustomBaseZRPathOption { type: 'path'; } interface CustomBuitinPathOption extends CustomBaseZRPathOption { type: T; } declare type CreateCustomBuitinPathOption = T extends any ? CustomBuitinPathOption : never; export declare type CustomPathOption = CreateCustomBuitinPathOption | CustomSVGPathOption; export interface CustomImageOptionOnState extends CustomDisplayableOptionOnState { style?: ImageStyleProps & TransitionAnyOption; } export interface CustomImageOption extends CustomDisplayableOption { type: 'image'; style?: ImageStyleProps & TransitionAnyOption; emphasis?: CustomImageOptionOnState; blur?: CustomImageOptionOnState; select?: CustomImageOptionOnState; } export interface CustomTextOptionOnState extends CustomDisplayableOptionOnState { style?: TextStyleProps & TransitionAnyOption; } export interface CustomTextOption extends CustomDisplayableOption { type: 'text'; style?: TextStyleProps & TransitionAnyOption; emphasis?: CustomTextOptionOnState; blur?: CustomTextOptionOnState; select?: CustomTextOptionOnState; } export declare type CustomElementOption = CustomPathOption | CustomImageOption | CustomTextOption | CustomGroupOption; export declare type CustomRootElementOption = CustomElementOption & { focus?: 'none' | 'self' | 'series' | ArrayLike; blurScope?: BlurScope; }; export declare type CustomElementOptionOnState = CustomDisplayableOptionOnState | CustomImageOptionOnState; export interface CustomSeriesRenderItemAPI extends CustomSeriesRenderItemCoordinateSystemAPI { getWidth(): number; getHeight(): number; getZr(): ZRenderType; getDevicePixelRatio(): number; value(dim: DimensionLoose, dataIndexInside?: number): ParsedValue; ordinalRawValue(dim: DimensionLoose, dataIndexInside?: number): ParsedValue | OrdinalRawValue; /** * @deprecated */ style(userProps?: ZRStyleProps, dataIndexInside?: number): ZRStyleProps; /** * @deprecated */ styleEmphasis(userProps?: ZRStyleProps, dataIndexInside?: number): ZRStyleProps; visual(visualType: VT, dataIndexInside?: number): VT extends NonStyleVisualProps ? DefaultDataVisual[VT] : VT extends StyleVisualProps ? PathStyleProps[typeof STYLE_VISUAL_TYPE[VT]] : void; barLayout(opt: BarGridLayoutOptionForCustomSeries): BarGridLayoutResult; currentSeriesIndices(): number[]; font(opt: Pick): string; } export interface CustomSeriesRenderItemParamsCoordSys { type: string; } export interface CustomSeriesRenderItemCoordinateSystemAPI { coord(data: OptionDataValue | OptionDataValue[], clamp?: boolean): number[]; size?(dataSize: OptionDataValue | OptionDataValue[], dataItem?: OptionDataValue | OptionDataValue[]): number | number[]; } export declare type WrapEncodeDefRet = Dictionary; export interface CustomSeriesRenderItemParams { context: Dictionary; dataIndex: number; seriesId: string; seriesName: string; seriesIndex: number; coordSys: CustomSeriesRenderItemParamsCoordSys; encode: WrapEncodeDefRet; dataIndexInside: number; dataInsideLength: number; actionType?: string; } export declare type CustomSeriesRenderItemReturn = CustomRootElementOption | undefined | null; export declare type CustomSeriesRenderItem = (params: CustomSeriesRenderItemParams, api: CustomSeriesRenderItemAPI) => CustomSeriesRenderItemReturn; export interface CustomSeriesOption extends SeriesOption, // don't support StateOption in custom series. SeriesEncodeOptionMixin, SeriesOnCartesianOptionMixin, SeriesOnPolarOptionMixin, SeriesOnSingleOptionMixin, SeriesOnGeoOptionMixin, SeriesOnCalendarOptionMixin { type?: 'custom'; coordinateSystem?: string | 'none'; renderItem?: CustomSeriesRenderItem; /** * @deprecated */ itemStyle?: ItemStyleOption; /** * @deprecated */ label?: LabelOption; /** * @deprecated */ emphasis?: { /** * @deprecated */ itemStyle?: ItemStyleOption; /** * @deprecated */ label?: LabelOption; }; clip?: boolean; } export declare const customInnerStore: (hostObj: Element) => { info: CustomExtraElementInfo; customPathData: string; customGraphicType: string; customImagePath: CustomImageOption['style']['image']; txConZ2Set: number; leaveToProps: ElementProps; option: CustomElementOption; userDuring: CustomBaseElementOption['during']; }; export default class CustomSeriesModel extends SeriesModel { static type: string; readonly type: string; static dependencies: string[]; currentZLevel: number; currentZ: number; static defaultOption: CustomSeriesOption; optionUpdated(): void; getInitialData(option: CustomSeriesOption, ecModel: GlobalModel): SeriesData; getDataParams(dataIndex: number, dataType?: SeriesDataType, el?: Element): CallbackDataParams & { info: CustomExtraElementInfo; }; } export declare type PrepareCustomInfo = (coordSys: CoordinateSystem) => { coordSys: CustomSeriesRenderItemParamsCoordSys; api: CustomSeriesRenderItemCoordinateSystemAPI; }; export {};