import {AnimationQueue} from '../anims' import {commonEvents, tooltipEvents} from '../core' import {LayerBase, LayerDict} from '../layers' import {AnimationOptions, UpdateAnimationOptions} from './animation' import {ChartContext} from './core' import {LegendData} from './data' import { DrawerDictProps, DrawerTarget, DrawerType, GraphDrawerProps, } from './draw' import {LayoutArea} from './layout' import {RawScale, ScaleNice} from './scale' import {TextStyle} from './styles' export type LayerType = Keys /** * Drawing data will be cached each time. * This cache use for show tooltip or support update animation etc. */ export type CacheLayerData = Record< Key, { data: Omit, 'className' | 'container' | 'theme'>[] /** * Mapping from dimension to group index. * In order to avoid wrong data update animation. */ order?: Map, number> } > export type CacheLayerAnimation = { /** * Mapping from sublayer to timer. * Loop animation should await for update animation after draw. */ timer: Record /** * Animation instance for control. */ animations: Partial>> /** * Animation options for config. * * There are three animation types: * - `enter`: Trigger when chart loaded. * - `loop`: Always running while chart available. * - `update`: Trigger when chart occur data updating. */ options: Partial< Record< Key, Partial< Record<'enter' | 'loop', MaybeGroup> & { update: Partial } > > > } /** * Cache all events to avoid double binding event listeners. * - `common`: Events that include normal interactions. * - `tooltip`: Events for tooltip only. * @internal */ export type CacheLayerEvent = Readonly< Record<`common.${Keys}`, Record> & Record<`tooltip.${Keys}`, AnyFunction> > export type LayerBaseProps = Readonly<{ options: LayerOptions /** * @see LayerBase.sublayers */ sublayers?: Key[] /** * @see LayerBase.interactive */ interactive?: Key[] }> export type DrawBasicProps = { /** * Basic element type, export type of drawer. */ type: T /** * Drawing data for a sublayer. */ data: (Omit< DrawerDictProps, 'className' | 'container' | 'theme' | 'source' > & { data: {meta?: GraphDrawerProps['source'][number]['meta']}[] disableUpdateAnimation?: boolean })[] /** * @see LayerBaseProps.sublayers */ key: Key } export type LayerOptions = ChartContext & { id: string type: T layout: LayoutArea /** * Determine the layer binding scaleY or scaleYR. */ axis?: 'main' | 'minor' /** * The sublayer needs the root of the parent layer to generate the root. * Chart methods do not return sublayers. * @internal */ sublayerConfig?: { root: DrawerTarget } } export type LayerScale = Partial<{ /** * Scale for horizontal, available in cartesian coordinate. */ scaleX: RawScale /** * Scale for vertical, available in cartesian coordinate. */ scaleY: RawScale /** * Scale for vertical, available in polar coordinate. */ scaleYR: RawScale /** * Scale for angle, available in polar coordinate. */ scaleAngle: RawScale /** * Scale for radius, available in polar coordinate. */ scaleRadius: RawScale scaleColor: RawScale nice: ScaleNice }> export type LayerInstance = LayerBase & { /** * If scale is declared, it will be captured by the axis layer. */ scale?: Maybe /** * If legend data is declared, it will be captured by the legend layer. */ legendData?: Maybe } export type CreateTextProps = { value: Maybe /** * Relative horizontal position of text. */ x: number /** * Relative vertical position of text. */ y: number /** * The text-associated style configuration. */ style?: TextStyle /** * The anchor of the text, defaults to 'leftBottom'. */ position?: Position9 /** * Single offset in one direction, different from `TextStyle.offset`. */ offset?: number } export type CreateLimitTextProps = CreateTextProps & { maxTextWidth: number } export type CreateColorMatrixProps = { layer: LayerInstance /** * The row number of colorMatrix. */ row: number /** * The column number of colorMatrix. */ column: number /** * The origin colors for `ColorMatrix`. */ theme: MaybeGroup }