51a6ea1faa2ee8015a9a2d67fa731157663d982cc6e48512ba61f6cdeba71f834ffa424bef69e39bbbe28b03ea2c57c0b3f958808d956615bfec64dcb23ecc 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322
  1. /**
  2. * [Notice]:
  3. * Consider custom bundle on demand, chart specified
  4. * or component specified types and constants should
  5. * not put here. Only common types and constants can
  6. * be put in this file.
  7. */
  8. import Group from 'zrender/lib/graphic/Group.js';
  9. import Element, { ElementEvent, ElementTextConfig } from 'zrender/lib/Element.js';
  10. import { DataFormatMixin } from '../model/mixin/dataFormat.js';
  11. import GlobalModel from '../model/Global.js';
  12. import ExtensionAPI from '../core/ExtensionAPI.js';
  13. import SeriesModel from '../model/Series.js';
  14. import { HashMap } from 'zrender/lib/core/util.js';
  15. import { TaskPlanCallbackReturn, TaskProgressParams } from '../core/task.js';
  16. import SeriesData from '../data/SeriesData.js';
  17. import { Dictionary, ElementEventName, ImageLike, TextAlign, TextVerticalAlign } from 'zrender/lib/core/types.js';
  18. import { PatternObject } from 'zrender/lib/graphic/Pattern.js';
  19. import { TooltipMarker } from './format.js';
  20. import { AnimationEasing } from 'zrender/lib/animation/easing.js';
  21. import { LinearGradientObject } from 'zrender/lib/graphic/LinearGradient.js';
  22. import { RadialGradientObject } from 'zrender/lib/graphic/RadialGradient.js';
  23. import { RectLike } from 'zrender/lib/core/BoundingRect.js';
  24. import { TSpanStyleProps } from 'zrender/lib/graphic/TSpan.js';
  25. import { PathStyleProps } from 'zrender/lib/graphic/Path.js';
  26. import { ImageStyleProps } from 'zrender/lib/graphic/Image.js';
  27. import ZRText, { TextStyleProps } from 'zrender/lib/graphic/Text.js';
  28. import { Source } from '../data/Source.js';
  29. import Model from '../model/Model.js';
  30. import { DataStoreDimensionType } from '../data/DataStore.js';
  31. import { DimensionUserOuputEncode } from '../data/helper/dimensionHelper.js';
  32. export { Dictionary };
  33. export declare type RendererType = 'canvas' | 'svg';
  34. export declare type NullUndefined = null | undefined;
  35. export declare type LayoutOrient = 'vertical' | 'horizontal';
  36. export declare type HorizontalAlign = 'left' | 'center' | 'right';
  37. export declare type VerticalAlign = 'top' | 'middle' | 'bottom';
  38. export declare type ColorString = string;
  39. export declare type ZRColor = ColorString | LinearGradientObject | RadialGradientObject | PatternObject;
  40. export declare type ZRLineType = 'solid' | 'dotted' | 'dashed' | number | number[];
  41. export declare type ZRFontStyle = 'normal' | 'italic' | 'oblique';
  42. export declare type ZRFontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | number;
  43. export declare type ZREasing = AnimationEasing;
  44. export declare type ZRTextAlign = TextAlign;
  45. export declare type ZRTextVerticalAlign = TextVerticalAlign;
  46. export declare type ZRElementEvent = ElementEvent;
  47. export declare type ZRRectLike = RectLike;
  48. export declare type ZRStyleProps = PathStyleProps | ImageStyleProps | TSpanStyleProps | TextStyleProps;
  49. export declare type ZRElementEventName = ElementEventName | 'globalout';
  50. export declare type ComponentFullType = string;
  51. export declare type ComponentMainType = keyof ECUnitOption & string;
  52. export declare type ComponentSubType = Exclude<ComponentOption['type'], undefined>;
  53. /**
  54. * Use `parseClassType` to parse componentType declaration to componentTypeInfo.
  55. * For example:
  56. * componentType declaration: 'a.b', get componentTypeInfo {main: 'a', sub: 'b'}.
  57. * componentType declaration: '', get componentTypeInfo {main: '', sub: ''}.
  58. */
  59. export interface ComponentTypeInfo {
  60. main: ComponentMainType;
  61. sub: ComponentSubType;
  62. }
  63. export interface ECElement extends Element {
  64. highDownSilentOnTouch?: boolean;
  65. onHoverStateChange?: (toState: DisplayState) => void;
  66. hoverState?: 0 | 1 | 2;
  67. selected?: boolean;
  68. z2EmphasisLift?: number;
  69. z2SelectLift?: number;
  70. /**
  71. * Force enable animation.
  72. * This property is useful when an ignored/invisible/removed element
  73. * should have label animation, like the case in the bar-racing charts.
  74. * `forceLabelAnimation` has higher priority than `disableLabelAnimation`.
  75. */
  76. forceLabelAnimation?: boolean;
  77. /**
  78. * Force disable animation.
  79. * `forceLabelAnimation` has higher priority than `disableLabelAnimation`.
  80. */
  81. disableLabelAnimation?: boolean;
  82. /**
  83. * Force disable overall layout
  84. */
  85. disableLabelLayout?: boolean;
  86. /**
  87. * Force disable morphing
  88. */
  89. disableMorphing?: boolean;
  90. }
  91. export interface DataHost {
  92. getData(dataType?: SeriesDataType): SeriesData;
  93. }
  94. export interface DataModel extends Model<unknown>, DataHost, DataFormatMixin {
  95. }
  96. interface PayloadItem {
  97. excludeSeriesId?: OptionId | OptionId[];
  98. animation?: PayloadAnimationPart;
  99. [other: string]: any;
  100. }
  101. export interface Payload extends PayloadItem {
  102. type: string;
  103. escapeConnect?: boolean;
  104. batch?: PayloadItem[];
  105. }
  106. export interface HighlightPayload extends Payload {
  107. type: 'highlight';
  108. notBlur?: boolean;
  109. }
  110. export interface DownplayPayload extends Payload {
  111. type: 'downplay';
  112. notBlur?: boolean;
  113. }
  114. export interface PayloadAnimationPart {
  115. duration?: number;
  116. easing?: AnimationEasing;
  117. delay?: number;
  118. }
  119. export interface SelectChangedPayload extends Payload {
  120. type: 'selectchanged';
  121. escapeConnect: boolean;
  122. isFromClick: boolean;
  123. fromAction: 'select' | 'unselect' | 'toggleSelected';
  124. fromActionPayload: Payload;
  125. selected: {
  126. seriesIndex: number;
  127. dataType?: SeriesDataType;
  128. dataIndex: number[];
  129. }[];
  130. }
  131. export interface ViewRootGroup extends Group {
  132. __ecComponentInfo?: {
  133. mainType: string;
  134. index: number;
  135. };
  136. }
  137. export interface ECElementEvent extends ECEventData, CallbackDataParams {
  138. type: ZRElementEventName;
  139. event?: ElementEvent;
  140. }
  141. /**
  142. * The echarts event type to user.
  143. * Also known as packedEvent.
  144. */
  145. export interface ECActionEvent extends ECEventData {
  146. type: string;
  147. componentType?: string;
  148. componentIndex?: number;
  149. seriesIndex?: number;
  150. escapeConnect?: boolean;
  151. batch?: ECEventData;
  152. }
  153. export interface ECEventData {
  154. [key: string]: any;
  155. }
  156. export interface EventQueryItem {
  157. [key: string]: any;
  158. }
  159. export interface NormalizedEventQuery {
  160. cptQuery: EventQueryItem;
  161. dataQuery: EventQueryItem;
  162. otherQuery: EventQueryItem;
  163. }
  164. export interface ActionInfo {
  165. type: string;
  166. event?: string;
  167. update?: string;
  168. }
  169. export interface ActionHandler {
  170. (payload: Payload, ecModel: GlobalModel, api: ExtensionAPI): void | ECEventData;
  171. }
  172. export interface OptionPreprocessor {
  173. (option: ECUnitOption, isTheme: boolean): void;
  174. }
  175. export interface PostUpdater {
  176. (ecModel: GlobalModel, api: ExtensionAPI): void;
  177. }
  178. export interface StageHandlerReset {
  179. (seriesModel: SeriesModel, ecModel: GlobalModel, api: ExtensionAPI, payload?: Payload): StageHandlerProgressExecutor | StageHandlerProgressExecutor[] | void;
  180. }
  181. export interface StageHandlerOverallReset {
  182. (ecModel: GlobalModel, api: ExtensionAPI, payload?: Payload): void;
  183. }
  184. export interface StageHandler {
  185. /**
  186. * Indicate that the task will be piped all series
  187. * (`performRawSeries` indicate whether includes filtered series).
  188. */
  189. createOnAllSeries?: boolean;
  190. /**
  191. * Indicate that the task will be only piped in the pipeline of this type of series.
  192. * (`performRawSeries` indicate whether includes filtered series).
  193. */
  194. seriesType?: string;
  195. /**
  196. * Indicate that the task will be only piped in the pipeline of the returned series.
  197. */
  198. getTargetSeries?: (ecModel: GlobalModel, api: ExtensionAPI) => HashMap<SeriesModel>;
  199. /**
  200. * If `true`, filtered series will also be "performed".
  201. */
  202. performRawSeries?: boolean;
  203. /**
  204. * Called only when this task in a pipeline.
  205. */
  206. plan?: StageHandlerPlan;
  207. /**
  208. * If `overallReset` specified, an "overall task" will be created.
  209. * "overall task" does not belong to a certain pipeline.
  210. * They always be "performed" in certain phase (depends on when they declared).
  211. * They has "stub"s to connect with pipelines (one stub for one pipeline),
  212. * delivering info like "dirty" and "output end".
  213. */
  214. overallReset?: StageHandlerOverallReset;
  215. /**
  216. * Called only when this task in a pipeline, and "dirty".
  217. */
  218. reset?: StageHandlerReset;
  219. }
  220. export interface StageHandlerInternal extends StageHandler {
  221. uid: string;
  222. visualType?: 'layout' | 'visual';
  223. __prio: number;
  224. __raw: StageHandler | StageHandlerOverallReset;
  225. isVisual?: boolean;
  226. isLayout?: boolean;
  227. }
  228. export declare type StageHandlerProgressParams = TaskProgressParams;
  229. export interface StageHandlerProgressExecutor {
  230. dataEach?: (data: SeriesData, idx: number) => void;
  231. progress?: (params: StageHandlerProgressParams, data: SeriesData) => void;
  232. }
  233. export declare type StageHandlerPlanReturn = TaskPlanCallbackReturn;
  234. export interface StageHandlerPlan {
  235. (seriesModel: SeriesModel, ecModel: GlobalModel, api: ExtensionAPI, payload?: Payload): StageHandlerPlanReturn;
  236. }
  237. export interface LoadingEffectCreator {
  238. (api: ExtensionAPI, cfg: object): LoadingEffect;
  239. }
  240. export interface LoadingEffect extends Element {
  241. resize: () => void;
  242. }
  243. /**
  244. * 'html' is used for rendering tooltip in extra DOM form, and the result
  245. * string is used as DOM HTML content.
  246. * 'richText' is used for rendering tooltip in rich text form, for those where
  247. * DOM operation is not supported.
  248. */
  249. export declare type TooltipRenderMode = 'html' | 'richText';
  250. export declare type TooltipOrderMode = 'valueAsc' | 'valueDesc' | 'seriesAsc' | 'seriesDesc';
  251. export declare type OrdinalRawValue = string | number;
  252. export declare type OrdinalNumber = number;
  253. /**
  254. * @usage For example,
  255. * ```js
  256. * { ordinalNumbers: [2, 5, 3, 4] }
  257. * ```
  258. * means that ordinal 2 should be diplayed on tick 0,
  259. * ordinal 5 should be displayed on tick 1, ...
  260. */
  261. export declare type OrdinalSortInfo = {
  262. ordinalNumbers: OrdinalNumber[];
  263. };
  264. /**
  265. * `OptionDataValue` is the primitive value in `series.data` or `dataset.source`.
  266. * `OptionDataValue` are parsed (see `src/data/helper/dataValueHelper.parseDataValue`)
  267. * into `ParsedValue` and stored into `data/SeriesData` storage.
  268. * Note:
  269. * (1) The term "parse" does not mean `src/scale/Scale['parse']`.
  270. * (2) If a category dimension is not mapped to any axis, its raw value will NOT be
  271. * parsed to `OrdinalNumber` but keep the original `OrdinalRawValue` in `src/data/SeriesData` storage.
  272. */
  273. export declare type ParsedValue = ParsedValueNumeric | OrdinalRawValue;
  274. export declare type ParsedValueNumeric = number | OrdinalNumber;
  275. /**
  276. * `ScaleDataValue` means that the user input primitive value to `src/scale/Scale`.
  277. * (For example, used in `axis.min`, `axis.max`, `convertToPixel`).
  278. * Note:
  279. * `ScaleDataValue` is a little different from `OptionDataValue`, because it will not go through
  280. * `src/data/helper/dataValueHelper.parseDataValue`, but go through `src/scale/Scale['parse']`.
  281. */
  282. export declare type ScaleDataValue = ParsedValueNumeric | OrdinalRawValue | Date;
  283. export interface ScaleTick {
  284. level?: number;
  285. value: number;
  286. }
  287. export interface TimeScaleTick extends ScaleTick {
  288. /**
  289. * Level information is used for label formatting.
  290. * For example, a time axis may contain labels like: Jan, 8th, 16th, 23th,
  291. * Feb, and etc. In this case, month labels like Jan and Feb should be
  292. * displayed in a more significant way than days.
  293. * `level` is set to be 0 when it's the most significant level, like month
  294. * labels in the above case.
  295. */
  296. level?: number;
  297. }
  298. export interface OrdinalScaleTick extends ScaleTick {
  299. /**
  300. * Represents where the tick will be placed visually.
  301. * Notice:
  302. * The value is not the raw ordinal value. And do not changed
  303. * after ordinal scale sorted.
  304. * We need to:
  305. * ```js
  306. * const coord = dataToCoord(ordinalScale.getRawOrdinalNumber(tick.value)).
  307. * ```
  308. * Why place the tick value here rather than the raw ordinal value (like LogScale did)?
  309. * Becuase ordinal scale sort is the different case from LogScale, where
  310. * axis tick, splitArea should better not to be sorted, especially in
  311. * anid(animation id) when `boundaryGap: true`.
  312. * Only axis label are sorted.
  313. */
  314. value: number;
  315. }
  316. export declare type DimensionIndex = number;
  317. export declare type DimensionIndexLoose = DimensionIndex | string;
  318. export declare type DimensionName = string;
  319. export declare type DimensionLoose = DimensionName | DimensionIndexLoose;
  320. export declare type DimensionType = DataStoreDimensionType;
  321. export declare const VISUAL_DIMENSIONS: HashMap<number, keyof DataVisualDimensions>;
  322. export interface DataVisualDimensions {
  323. tooltip?: DimensionIndex | false;
  324. label?: DimensionIndex;
  325. itemName?: DimensionIndex;
  326. itemId?: DimensionIndex;
  327. itemGroupId?: DimensionIndex;
  328. seriesName?: DimensionIndex;
  329. }
  330. export declare type DimensionDefinition = {
  331. type?: DataStoreDimensionType;
  332. name?: DimensionName;
  333. displayName?: string;
  334. };
  335. export declare type DimensionDefinitionLoose = DimensionDefinition['name'] | DimensionDefinition;
  336. export declare const SOURCE_FORMAT_ORIGINAL: "original";
  337. export declare const SOURCE_FORMAT_ARRAY_ROWS: "arrayRows";
  338. export declare const SOURCE_FORMAT_OBJECT_ROWS: "objectRows";
  339. export declare const SOURCE_FORMAT_KEYED_COLUMNS: "keyedColumns";
  340. export declare const SOURCE_FORMAT_TYPED_ARRAY: "typedArray";
  341. export declare const SOURCE_FORMAT_UNKNOWN: "unknown";
  342. export declare type SourceFormat = typeof SOURCE_FORMAT_ORIGINAL | typeof SOURCE_FORMAT_ARRAY_ROWS | typeof SOURCE_FORMAT_OBJECT_ROWS | typeof SOURCE_FORMAT_KEYED_COLUMNS | typeof SOURCE_FORMAT_TYPED_ARRAY | typeof SOURCE_FORMAT_UNKNOWN;
  343. export declare const SERIES_LAYOUT_BY_COLUMN: "column";
  344. export declare const SERIES_LAYOUT_BY_ROW: "row";
  345. export declare type SeriesLayoutBy = typeof SERIES_LAYOUT_BY_COLUMN | typeof SERIES_LAYOUT_BY_ROW;
  346. export declare type OptionSourceHeader = boolean | 'auto' | number;
  347. export declare type SeriesDataType = 'main' | 'node' | 'edge';
  348. /**
  349. * [ECUnitOption]:
  350. * An object that contains definitions of components
  351. * and other properties. For example:
  352. *
  353. * ```ts
  354. * let option: ECUnitOption = {
  355. *
  356. * // Single `title` component:
  357. * title: {...},
  358. *
  359. * // Two `visualMap` components:
  360. * visualMap: [{...}, {...}],
  361. *
  362. * // Two `series.bar` components
  363. * // and one `series.pie` component:
  364. * series: [
  365. * {type: 'bar', data: [...]},
  366. * {type: 'bar', data: [...]},
  367. * {type: 'pie', data: [...]}
  368. * ],
  369. *
  370. * // A property:
  371. * backgroundColor: '#421ae4'
  372. *
  373. * // A property object:
  374. * textStyle: {
  375. * color: 'red',
  376. * fontSize: 20
  377. * }
  378. * };
  379. * ```
  380. */
  381. export declare type ECUnitOption = {
  382. baseOption?: unknown;
  383. options?: unknown;
  384. media?: unknown;
  385. timeline?: ComponentOption | ComponentOption[];
  386. backgroundColor?: ZRColor;
  387. darkMode?: boolean | 'auto';
  388. textStyle?: Pick<LabelOption, 'color' | 'fontStyle' | 'fontWeight' | 'fontSize' | 'fontFamily'>;
  389. useUTC?: boolean;
  390. [key: string]: ComponentOption | ComponentOption[] | Dictionary<unknown> | unknown;
  391. stateAnimation?: AnimationOption;
  392. } & AnimationOptionMixin & ColorPaletteOptionMixin;
  393. /**
  394. * [ECOption]:
  395. * An object input to echarts.setOption(option).
  396. * May be an 'option: ECUnitOption',
  397. * or may be an object contains multi-options. For example:
  398. *
  399. * ```ts
  400. * let option: ECOption = {
  401. * baseOption: {
  402. * title: {...},
  403. * legend: {...},
  404. * series: [
  405. * {data: [...]},
  406. * {data: [...]},
  407. * ...
  408. * ]
  409. * },
  410. * timeline: {...},
  411. * options: [
  412. * {title: {...}, series: {data: [...]}},
  413. * {title: {...}, series: {data: [...]}},
  414. * ...
  415. * ],
  416. * media: [
  417. * {
  418. * query: {maxWidth: 320},
  419. * option: {series: {x: 20}, visualMap: {show: false}}
  420. * },
  421. * {
  422. * query: {minWidth: 320, maxWidth: 720},
  423. * option: {series: {x: 500}, visualMap: {show: true}}
  424. * },
  425. * {
  426. * option: {series: {x: 1200}, visualMap: {show: true}}
  427. * }
  428. * ]
  429. * };
  430. * ```
  431. */
  432. export interface ECBasicOption extends ECUnitOption {
  433. baseOption?: ECUnitOption;
  434. timeline?: ComponentOption | ComponentOption[];
  435. options?: ECUnitOption[];
  436. media?: MediaUnit[];
  437. }
  438. export declare type OptionSourceData<VAL extends OptionDataValue = OptionDataValue, ORIITEM extends OptionDataItemOriginal<VAL> = OptionDataItemOriginal<VAL>> = OptionSourceDataOriginal<VAL, ORIITEM> | OptionSourceDataObjectRows<VAL> | OptionSourceDataArrayRows<VAL> | OptionSourceDataKeyedColumns<VAL> | OptionSourceDataTypedArray;
  439. export declare type OptionDataItemOriginal<VAL extends OptionDataValue = OptionDataValue> = VAL | VAL[] | OptionDataItemObject<VAL>;
  440. export declare type OptionSourceDataOriginal<VAL extends OptionDataValue = OptionDataValue, ORIITEM extends OptionDataItemOriginal<VAL> = OptionDataItemOriginal<VAL>> = ArrayLike<ORIITEM>;
  441. export declare type OptionSourceDataObjectRows<VAL extends OptionDataValue = OptionDataValue> = Array<Dictionary<VAL>>;
  442. export declare type OptionSourceDataArrayRows<VAL extends OptionDataValue = OptionDataValue> = Array<Array<VAL>>;
  443. export declare type OptionSourceDataKeyedColumns<VAL extends OptionDataValue = OptionDataValue> = Dictionary<ArrayLike<VAL>>;
  444. export declare type OptionSourceDataTypedArray = ArrayLike<number>;
  445. export declare type OptionDataItem = OptionDataValue | Dictionary<OptionDataValue> | OptionDataValue[] | OptionDataItemObject<OptionDataValue>;
  446. export declare type OptionDataItemObject<T> = {
  447. id?: OptionId;
  448. name?: OptionName;
  449. groupId?: OptionId;
  450. value?: T[] | T;
  451. selected?: boolean;
  452. };
  453. export declare type OptionId = string | number;
  454. export declare type OptionName = string | number;
  455. export interface GraphEdgeItemObject<VAL extends OptionDataValue> extends OptionDataItemObject<VAL> {
  456. /**
  457. * Name or index of source node.
  458. */
  459. source?: string | number;
  460. /**
  461. * Name or index of target node.
  462. */
  463. target?: string | number;
  464. }
  465. export declare type OptionDataValue = string | number | Date;
  466. export declare type OptionDataValueNumeric = number | '-';
  467. export declare type OptionDataValueCategory = string;
  468. export declare type OptionDataValueDate = Date | string | number;
  469. export declare type ModelOption = any;
  470. export declare type ThemeOption = Dictionary<any>;
  471. export declare type DisplayState = 'normal' | 'emphasis' | 'blur' | 'select';
  472. export declare type DisplayStateNonNormal = Exclude<DisplayState, 'normal'>;
  473. export declare type DisplayStateHostOption = {
  474. emphasis?: Dictionary<any>;
  475. [key: string]: any;
  476. };
  477. export interface OptionEncodeVisualDimensions {
  478. tooltip?: OptionEncodeValue;
  479. label?: OptionEncodeValue;
  480. itemName?: OptionEncodeValue;
  481. itemId?: OptionEncodeValue;
  482. seriesName?: OptionEncodeValue;
  483. itemGroupId?: OptionEncodeValue;
  484. }
  485. export interface OptionEncode extends OptionEncodeVisualDimensions {
  486. [coordDim: string]: OptionEncodeValue | undefined;
  487. }
  488. export declare type OptionEncodeValue = DimensionLoose | DimensionLoose[];
  489. export declare type EncodeDefaulter = (source: Source, dimCount: number) => OptionEncode;
  490. export interface CallbackDataParams {
  491. componentType: string;
  492. componentSubType: string;
  493. componentIndex: number;
  494. seriesType?: string;
  495. seriesIndex?: number;
  496. seriesId?: string;
  497. seriesName?: string;
  498. name: string;
  499. dataIndex: number;
  500. data: OptionDataItem;
  501. dataType?: SeriesDataType;
  502. value: OptionDataItem | OptionDataValue;
  503. color?: ZRColor;
  504. borderColor?: string;
  505. dimensionNames?: DimensionName[];
  506. encode?: DimensionUserOuputEncode;
  507. marker?: TooltipMarker;
  508. status?: DisplayState;
  509. dimensionIndex?: number;
  510. percent?: number;
  511. $vars: string[];
  512. }
  513. export declare type InterpolatableValue = ParsedValue | ParsedValue[];
  514. export declare type DecalDashArrayX = number | (number | number[])[];
  515. export declare type DecalDashArrayY = number | number[];
  516. export interface DecalObject {
  517. symbol?: string | string[];
  518. symbolSize?: number;
  519. symbolKeepAspect?: boolean;
  520. color?: string;
  521. backgroundColor?: string;
  522. dashArrayX?: DecalDashArrayX;
  523. dashArrayY?: DecalDashArrayY;
  524. rotation?: number;
  525. maxTileWidth?: number;
  526. maxTileHeight?: number;
  527. }
  528. export interface InnerDecalObject extends DecalObject {
  529. dirty?: boolean;
  530. }
  531. export interface MediaQuery {
  532. minWidth?: number;
  533. maxWidth?: number;
  534. minHeight?: number;
  535. maxHeight?: number;
  536. minAspectRatio?: number;
  537. maxAspectRatio?: number;
  538. }
  539. export declare type MediaUnit = {
  540. query?: MediaQuery;
  541. option: ECUnitOption;
  542. };
  543. export declare type ComponentLayoutMode = {
  544. type?: 'box';
  545. ignoreSize?: boolean | boolean[];
  546. };
  547. /******************* Mixins for Common Option Properties ********************** */
  548. export declare type PaletteOptionMixin = ColorPaletteOptionMixin;
  549. export interface ColorPaletteOptionMixin {
  550. color?: ZRColor | ZRColor[];
  551. colorLayer?: ZRColor[][];
  552. }
  553. /**
  554. * Mixin of option set to control the box layout of each component.
  555. */
  556. export interface BoxLayoutOptionMixin {
  557. width?: number | string;
  558. height?: number | string;
  559. top?: number | string;
  560. right?: number | string;
  561. bottom?: number | string;
  562. left?: number | string;
  563. }
  564. export interface CircleLayoutOptionMixin {
  565. center?: (number | string)[];
  566. radius?: (number | string)[] | number | string;
  567. }
  568. export interface ShadowOptionMixin {
  569. shadowBlur?: number;
  570. shadowColor?: ColorString;
  571. shadowOffsetX?: number;
  572. shadowOffsetY?: number;
  573. }
  574. export interface BorderOptionMixin {
  575. borderColor?: ZRColor;
  576. borderWidth?: number;
  577. borderType?: ZRLineType;
  578. borderCap?: CanvasLineCap;
  579. borderJoin?: CanvasLineJoin;
  580. borderDashOffset?: number;
  581. borderMiterLimit?: number;
  582. }
  583. export declare type ColorBy = 'series' | 'data';
  584. export interface SunburstColorByMixin {
  585. colorBy?: ColorBy;
  586. }
  587. export declare type AnimationDelayCallbackParam = {
  588. count: number;
  589. index: number;
  590. };
  591. export declare type AnimationDurationCallback = (idx: number) => number;
  592. export declare type AnimationDelayCallback = (idx: number, params?: AnimationDelayCallbackParam) => number;
  593. export interface AnimationOption {
  594. duration?: number;
  595. easing?: AnimationEasing;
  596. delay?: number;
  597. }
  598. /**
  599. * Mixin of option set to control the animation of series.
  600. */
  601. export interface AnimationOptionMixin {
  602. /**
  603. * If enable animation
  604. */
  605. animation?: boolean;
  606. /**
  607. * Disable animation when the number of elements exceeds the threshold
  608. */
  609. animationThreshold?: number;
  610. /**
  611. * Duration of initialize animation.
  612. * Can be a callback to specify duration of each element
  613. */
  614. animationDuration?: number | AnimationDurationCallback;
  615. /**
  616. * Easing of initialize animation
  617. */
  618. animationEasing?: AnimationEasing;
  619. /**
  620. * Delay of initialize animation
  621. * Can be a callback to specify duration of each element
  622. */
  623. animationDelay?: number | AnimationDelayCallback;
  624. /**
  625. * Delay of data update animation.
  626. * Can be a callback to specify duration of each element
  627. */
  628. animationDurationUpdate?: number | AnimationDurationCallback;
  629. /**
  630. * Easing of data update animation.
  631. */
  632. animationEasingUpdate?: AnimationEasing;
  633. /**
  634. * Delay of data update animation.
  635. * Can be a callback to specify duration of each element
  636. */
  637. animationDelayUpdate?: number | AnimationDelayCallback;
  638. }
  639. export interface RoamOptionMixin {
  640. /**
  641. * If enable roam. can be specified 'scale' or 'move'
  642. */
  643. roam?: boolean | 'pan' | 'move' | 'zoom' | 'scale';
  644. /**
  645. * Current center position.
  646. */
  647. center?: (number | string)[];
  648. /**
  649. * Current zoom level. Default is 1
  650. */
  651. zoom?: number;
  652. scaleLimit?: {
  653. min?: number;
  654. max?: number;
  655. };
  656. }
  657. export declare type SymbolSizeCallback<T> = (rawValue: any, params: T) => number | number[];
  658. export declare type SymbolCallback<T> = (rawValue: any, params: T) => string;
  659. export declare type SymbolRotateCallback<T> = (rawValue: any, params: T) => number;
  660. export declare type SymbolOffsetCallback<T> = (rawValue: any, params: T) => string | number | (string | number)[];
  661. /**
  662. * Mixin of option set to control the element symbol.
  663. * Include type of symbol, and size of symbol.
  664. */
  665. export interface SymbolOptionMixin<T = never> {
  666. /**
  667. * type of symbol, like `cirlce`, `rect`, or custom path and image.
  668. */
  669. symbol?: string | (T extends never ? never : SymbolCallback<T>);
  670. /**
  671. * Size of symbol.
  672. */
  673. symbolSize?: number | number[] | (T extends never ? never : SymbolSizeCallback<T>);
  674. symbolRotate?: number | (T extends never ? never : SymbolRotateCallback<T>);
  675. symbolKeepAspect?: boolean;
  676. symbolOffset?: string | number | (string | number)[] | (T extends never ? never : SymbolOffsetCallback<T>);
  677. }
  678. /**
  679. * ItemStyleOption is a most common used set to config element styles.
  680. * It includes both fill and stroke style.
  681. */
  682. export interface ItemStyleOption<TCbParams = never> extends ShadowOptionMixin, BorderOptionMixin {
  683. color?: ZRColor | (TCbParams extends never ? never : ((params: TCbParams) => ZRColor));
  684. opacity?: number;
  685. decal?: DecalObject | 'none';
  686. }
  687. /**
  688. * ItemStyleOption is a option set to control styles on lines.
  689. * Used in the components or series like `line`, `axis`
  690. * It includes stroke style.
  691. */
  692. export interface LineStyleOption<Clr = ZRColor> extends ShadowOptionMixin {
  693. width?: number;
  694. color?: Clr;
  695. opacity?: number;
  696. type?: ZRLineType;
  697. cap?: CanvasLineCap;
  698. join?: CanvasLineJoin;
  699. dashOffset?: number;
  700. miterLimit?: number;
  701. }
  702. /**
  703. * ItemStyleOption is a option set to control styles on an area, like polygon, rectangle.
  704. * It only include fill style.
  705. */
  706. export interface AreaStyleOption<Clr = ZRColor> extends ShadowOptionMixin {
  707. color?: Clr;
  708. opacity?: number;
  709. }
  710. declare type Arrayable<T extends Dictionary<any>> = {
  711. [key in keyof T]: T[key] | T[key][];
  712. };
  713. declare type Dictionaryable<T extends Dictionary<any>> = {
  714. [key in keyof T]: T[key] | Dictionary<T[key]>;
  715. };
  716. export interface VisualOptionUnit {
  717. symbol?: string;
  718. symbolSize?: number;
  719. color?: ColorString;
  720. colorAlpha?: number;
  721. opacity?: number;
  722. colorLightness?: number;
  723. colorSaturation?: number;
  724. colorHue?: number;
  725. decal?: DecalObject;
  726. liftZ?: number;
  727. }
  728. export declare type VisualOptionFixed = VisualOptionUnit;
  729. /**
  730. * Option about visual properties used in piecewise mapping
  731. * Used in each piece.
  732. */
  733. export declare type VisualOptionPiecewise = VisualOptionUnit;
  734. /**
  735. * Option about visual properties used in linear mapping
  736. */
  737. export declare type VisualOptionLinear = Arrayable<VisualOptionUnit>;
  738. /**
  739. * Option about visual properties can be encoded from ordinal categories.
  740. * Each value can either be a dictonary to lookup with category name, or
  741. * be an array to lookup with category index. In this case the array length should
  742. * be same with categories
  743. */
  744. export declare type VisualOptionCategory = Arrayable<VisualOptionUnit> | Dictionaryable<VisualOptionUnit>;
  745. /**
  746. * All visual properties can be encoded.
  747. */
  748. export declare type BuiltinVisualProperty = keyof VisualOptionUnit;
  749. export interface TextCommonOption extends ShadowOptionMixin {
  750. color?: string;
  751. fontStyle?: ZRFontStyle;
  752. fontWeight?: ZRFontWeight;
  753. fontFamily?: string;
  754. fontSize?: number | string;
  755. align?: HorizontalAlign;
  756. verticalAlign?: VerticalAlign;
  757. baseline?: VerticalAlign;
  758. opacity?: number;
  759. lineHeight?: number;
  760. backgroundColor?: ColorString | {
  761. image: ImageLike | string;
  762. };
  763. borderColor?: string;
  764. borderWidth?: number;
  765. borderType?: ZRLineType;
  766. borderDashOffset?: number;
  767. borderRadius?: number | number[];
  768. padding?: number | number[];
  769. width?: number | string;
  770. height?: number;
  771. textBorderColor?: string;
  772. textBorderWidth?: number;
  773. textBorderType?: ZRLineType;
  774. textBorderDashOffset?: number;
  775. textShadowBlur?: number;
  776. textShadowColor?: string;
  777. textShadowOffsetX?: number;
  778. textShadowOffsetY?: number;
  779. tag?: string;
  780. }
  781. export interface LabelFormatterCallback<T = CallbackDataParams> {
  782. (params: T): string;
  783. }
  784. /**
  785. * LabelOption is an option set to control the style of labels.
  786. * Include color, background, shadow, truncate, rotation, distance, etc..
  787. */
  788. export interface LabelOption extends TextCommonOption {
  789. /**
  790. * If show label
  791. */
  792. show?: boolean;
  793. position?: ElementTextConfig['position'];
  794. distance?: number;
  795. rotate?: number;
  796. offset?: number[];
  797. /**
  798. * Min margin between labels. Used when label has layout.
  799. */
  800. minMargin?: number;
  801. overflow?: TextStyleProps['overflow'];
  802. silent?: boolean;
  803. precision?: number | 'auto';
  804. valueAnimation?: boolean;
  805. rich?: Dictionary<TextCommonOption>;
  806. }
  807. export interface SeriesLabelOption extends LabelOption {
  808. formatter?: string | LabelFormatterCallback<CallbackDataParams>;
  809. }
  810. /**
  811. * Option for labels on line, like markLine, lines
  812. */
  813. export interface LineLabelOption extends Omit<LabelOption, 'distance' | 'position'> {
  814. position?: 'start' | 'middle' | 'end' | 'insideStart' | 'insideStartTop' | 'insideStartBottom' | 'insideMiddle' | 'insideMiddleTop' | 'insideMiddleBottom' | 'insideEnd' | 'insideEndTop' | 'insideEndBottom' | 'insideMiddleBottom';
  815. /**
  816. * Distance can be an array.
  817. * Which will specify horizontal and vertical distance respectively
  818. */
  819. distance?: number | number[];
  820. }
  821. export interface LabelLineOption {
  822. show?: boolean;
  823. /**
  824. * If displayed above other elements
  825. */
  826. showAbove?: boolean;
  827. length?: number;
  828. length2?: number;
  829. smooth?: boolean | number;
  830. minTurnAngle?: number;
  831. lineStyle?: LineStyleOption;
  832. }
  833. export interface SeriesLineLabelOption extends LineLabelOption {
  834. formatter?: string | LabelFormatterCallback<CallbackDataParams>;
  835. }
  836. export interface LabelLayoutOptionCallbackParams {
  837. /**
  838. * Index of data which the label represents.
  839. * It can be null if label does't represent any data.
  840. */
  841. dataIndex?: number;
  842. /**
  843. * Type of data which the label represents.
  844. * It can be null if label does't represent any data.
  845. */
  846. dataType?: SeriesDataType;
  847. seriesIndex: number;
  848. text: string;
  849. align: ZRTextAlign;
  850. verticalAlign: ZRTextVerticalAlign;
  851. rect: RectLike;
  852. labelRect: RectLike;
  853. labelLinePoints?: number[][];
  854. }
  855. export interface LabelLayoutOption {
  856. /**
  857. * If move the overlapped label. If label is still overlapped after moved.
  858. * It will determine if to hide this label with `hideOverlap` policy.
  859. *
  860. * shiftX/Y will keep the order on x/y
  861. * shuffleX/y will move the label around the original position randomly.
  862. */
  863. moveOverlap?: 'shiftX' | 'shiftY' | 'shuffleX' | 'shuffleY';
  864. /**
  865. * If hide the overlapped label. It will be handled after move.
  866. * @default 'none'
  867. */
  868. hideOverlap?: boolean;
  869. /**
  870. * If label is draggable.
  871. */
  872. draggable?: boolean;
  873. /**
  874. * Can be absolute px number or percent string.
  875. */
  876. x?: number | string;
  877. y?: number | string;
  878. /**
  879. * offset on x based on the original position.
  880. */
  881. dx?: number;
  882. /**
  883. * offset on y based on the original position.
  884. */
  885. dy?: number;
  886. rotate?: number;
  887. align?: ZRTextAlign;
  888. verticalAlign?: ZRTextVerticalAlign;
  889. width?: number;
  890. height?: number;
  891. fontSize?: number;
  892. labelLinePoints?: number[][];
  893. }
  894. export declare type LabelLayoutOptionCallback = (params: LabelLayoutOptionCallbackParams) => LabelLayoutOption;
  895. export interface TooltipFormatterCallback<T> {
  896. /**
  897. * For sync callback
  898. * params will be an array on axis trigger.
  899. */
  900. (params: T, asyncTicket: string): string | HTMLElement | HTMLElement[];
  901. /**
  902. * For async callback.
  903. * Returned html string will be a placeholder when callback is not invoked.
  904. */
  905. (params: T, asyncTicket: string, callback: (cbTicket: string, htmlOrDomNodes: string | HTMLElement | HTMLElement[]) => void): string | HTMLElement | HTMLElement[];
  906. }
  907. declare type TooltipBuiltinPosition = 'inside' | 'top' | 'left' | 'right' | 'bottom';
  908. declare type TooltipBoxLayoutOption = Pick<BoxLayoutOptionMixin, 'top' | 'left' | 'right' | 'bottom'>;
  909. export declare type TooltipPositionCallbackParams = CallbackDataParams | CallbackDataParams[];
  910. /**
  911. * Position relative to the hoverred element. Only available when trigger is item.
  912. */
  913. export interface TooltipPositionCallback {
  914. (point: [number, number],
  915. /**
  916. * params will be an array on axis trigger.
  917. */
  918. params: TooltipPositionCallbackParams,
  919. /**
  920. * Will be HTMLDivElement when renderMode is html
  921. * Otherwise it's graphic.Text
  922. */
  923. el: HTMLDivElement | ZRText | null,
  924. /**
  925. * Rect of hover elements. Will be null if not hovered
  926. */
  927. rect: RectLike | null, size: {
  928. /**
  929. * Size of popup content
  930. */
  931. contentSize: [number, number];
  932. /**
  933. * Size of the chart view
  934. */
  935. viewSize: [number, number];
  936. }): Array<number | string> | TooltipBuiltinPosition | TooltipBoxLayoutOption;
  937. }
  938. /**
  939. * Common tooltip option
  940. * Can be configured on series, graphic elements
  941. */
  942. export interface CommonTooltipOption<FormatterParams> {
  943. show?: boolean;
  944. /**
  945. * When to trigger
  946. */
  947. triggerOn?: 'mousemove' | 'click' | 'none' | 'mousemove|click';
  948. /**
  949. * Whether to not hide popup content automatically
  950. */
  951. alwaysShowContent?: boolean;
  952. formatter?: string | TooltipFormatterCallback<FormatterParams>;
  953. /**
  954. * Formatter of value.
  955. *
  956. * Will be ignored if tooltip.formatter is specified.
  957. */
  958. valueFormatter?: (value: OptionDataValue | OptionDataValue[]) => string;
  959. /**
  960. * Absolution pixel [x, y] array. Or relative percent string [x, y] array.
  961. * If trigger is 'item'. position can be set to 'inside' / 'top' / 'left' / 'right' / 'bottom',
  962. * which is relative to the hovered element.
  963. *
  964. * Support to be a callback
  965. */
  966. position?: (number | string)[] | TooltipBuiltinPosition | TooltipPositionCallback | TooltipBoxLayoutOption;
  967. confine?: boolean;
  968. /**
  969. * Consider triggered from axisPointer handle, verticalAlign should be 'middle'
  970. */
  971. align?: HorizontalAlign;
  972. verticalAlign?: VerticalAlign;
  973. /**
  974. * Delay of show. milesecond.
  975. */
  976. showDelay?: number;
  977. /**
  978. * Delay of hide. milesecond.
  979. */
  980. hideDelay?: number;
  981. transitionDuration?: number;
  982. /**
  983. * Whether mouse is allowed to enter the floating layer of tooltip
  984. * If you need to interact in the tooltip like with links or buttons, it can be set as true.
  985. */
  986. enterable?: boolean;
  987. backgroundColor?: ColorString;
  988. borderColor?: ColorString;
  989. borderRadius?: number;
  990. borderWidth?: number;
  991. shadowBlur?: number;
  992. shadowColor?: string;
  993. shadowOffsetX?: number;
  994. shadowOffsetY?: number;
  995. /**
  996. * Padding between tooltip content and tooltip border.
  997. */
  998. padding?: number | number[];
  999. /**
  1000. * Available when renderMode is 'html'
  1001. */
  1002. extraCssText?: string;
  1003. textStyle?: Pick<LabelOption, 'color' | 'fontStyle' | 'fontWeight' | 'fontFamily' | 'fontSize' | 'lineHeight' | 'width' | 'height' | 'textBorderColor' | 'textBorderWidth' | 'textShadowColor' | 'textShadowBlur' | 'textShadowOffsetX' | 'textShadowOffsetY' | 'align'> & {
  1004. decoration?: string;
  1005. };
  1006. }
  1007. export declare type ComponentItemTooltipOption<T> = CommonTooltipOption<T> & {
  1008. content?: string;
  1009. formatterParams?: ComponentItemTooltipLabelFormatterParams;
  1010. };
  1011. export declare type ComponentItemTooltipLabelFormatterParams = {
  1012. componentType: string;
  1013. name: string;
  1014. $vars: string[];
  1015. } & {
  1016. [key in string]: unknown;
  1017. };
  1018. /**
  1019. * Tooltip option configured on each series
  1020. */
  1021. export declare type SeriesTooltipOption = CommonTooltipOption<CallbackDataParams> & {
  1022. trigger?: 'item' | 'axis' | boolean | 'none';
  1023. };
  1024. declare type LabelFormatterParams = {
  1025. value: ScaleDataValue;
  1026. axisDimension: string;
  1027. axisIndex: number;
  1028. seriesData: CallbackDataParams[];
  1029. };
  1030. /**
  1031. * Common axis option. can be configured on each axis
  1032. */
  1033. export interface CommonAxisPointerOption {
  1034. show?: boolean | 'auto';
  1035. z?: number;
  1036. zlevel?: number;
  1037. triggerOn?: 'click' | 'mousemove' | 'none' | 'mousemove|click';
  1038. type?: 'line' | 'shadow' | 'none';
  1039. snap?: boolean;
  1040. triggerTooltip?: boolean;
  1041. /**
  1042. * current value. When using axisPointer.handle, value can be set to define the initail position of axisPointer.
  1043. */
  1044. value?: ScaleDataValue;
  1045. status?: 'show' | 'hide';
  1046. label?: LabelOption & {
  1047. precision?: 'auto' | number;
  1048. margin?: number;
  1049. /**
  1050. * String template include variable {value} or callback function
  1051. */
  1052. formatter?: string | ((params: LabelFormatterParams) => string);
  1053. };
  1054. animation?: boolean | 'auto';
  1055. animationDurationUpdate?: number;
  1056. animationEasingUpdate?: ZREasing;
  1057. /**
  1058. * Available when type is 'line'
  1059. */
  1060. lineStyle?: LineStyleOption;
  1061. /**
  1062. * Available when type is 'shadow'
  1063. */
  1064. shadowStyle?: AreaStyleOption;
  1065. handle?: {
  1066. show?: boolean;
  1067. icon?: string;
  1068. /**
  1069. * The size of the handle
  1070. */
  1071. size?: number | number[];
  1072. /**
  1073. * Distance from handle center to axis.
  1074. */
  1075. margin?: number;
  1076. color?: ColorString;
  1077. /**
  1078. * Throttle for mobile performance
  1079. */
  1080. throttle?: number;
  1081. } & ShadowOptionMixin;
  1082. seriesDataIndices?: {
  1083. seriesIndex: number;
  1084. dataIndex: number;
  1085. dataIndexInside: number;
  1086. }[];
  1087. }
  1088. export interface ComponentOption {
  1089. mainType?: string;
  1090. type?: string;
  1091. id?: OptionId;
  1092. name?: OptionName;
  1093. z?: number;
  1094. zlevel?: number;
  1095. }
  1096. export declare type BlurScope = 'coordinateSystem' | 'series' | 'global';
  1097. /**
  1098. * can be array of data indices.
  1099. * Or may be an dictionary if have different types of data like in graph.
  1100. */
  1101. export declare type InnerFocus = DefaultEmphasisFocus | ArrayLike<number> | Dictionary<ArrayLike<number>>;
  1102. export interface DefaultStatesMixin {
  1103. emphasis?: any;
  1104. select?: any;
  1105. blur?: any;
  1106. }
  1107. export declare type DefaultEmphasisFocus = 'none' | 'self' | 'series';
  1108. export interface DefaultStatesMixinEmphasis {
  1109. /**
  1110. * self: Focus self and blur all others.
  1111. * series: Focus series and blur all other series.
  1112. */
  1113. focus?: DefaultEmphasisFocus;
  1114. }
  1115. export interface StatesMixinBase {
  1116. emphasis?: unknown;
  1117. select?: unknown;
  1118. blur?: unknown;
  1119. }
  1120. export interface StatesOptionMixin<StateOption, StatesMixin extends StatesMixinBase> {
  1121. /**
  1122. * Emphasis states
  1123. */
  1124. emphasis?: StateOption & StatesMixin['emphasis'] & {
  1125. /**
  1126. * Scope of blurred element when focus.
  1127. *
  1128. * coordinateSystem: blur others in the same coordinateSystem
  1129. * series: blur others in the same series
  1130. * global: blur all others
  1131. *
  1132. * Default to be coordinate system.
  1133. */
  1134. blurScope?: BlurScope;
  1135. /**
  1136. * If emphasis state is disabled.
  1137. */
  1138. disabled?: boolean;
  1139. };
  1140. /**
  1141. * Select states
  1142. */
  1143. select?: StateOption & StatesMixin['select'] & {
  1144. disabled?: boolean;
  1145. };
  1146. /**
  1147. * Blur states.
  1148. */
  1149. blur?: StateOption & StatesMixin['blur'];
  1150. }
  1151. export interface UniversalTransitionOption {
  1152. enabled?: boolean;
  1153. /**
  1154. * Animation delay of each divided element
  1155. */
  1156. delay?: (index: number, count: number) => number;
  1157. /**
  1158. * How to divide the shape in combine and split animation.
  1159. */
  1160. divideShape?: 'clone' | 'split';
  1161. /**
  1162. * Series will have transition between if they have same seriesKey.
  1163. * Usually it is a string. It can also be an array,
  1164. * which means it can be transition from or to multiple series with each key in this array item.
  1165. *
  1166. * Note:
  1167. * If two series have both array seriesKey. They will be compared after concated to a string(which is order independent)
  1168. * Transition between string key has higher priority.
  1169. *
  1170. * Default to use series id.
  1171. */
  1172. seriesKey?: string | string[];
  1173. }
  1174. export interface SeriesOption<StateOption = unknown, StatesMixin extends StatesMixinBase = DefaultStatesMixin> extends ComponentOption, AnimationOptionMixin, ColorPaletteOptionMixin, StatesOptionMixin<StateOption, StatesMixin> {
  1175. mainType?: 'series';
  1176. silent?: boolean;
  1177. blendMode?: string;
  1178. /**
  1179. * Cursor when mouse on the elements
  1180. */
  1181. cursor?: string;
  1182. /**
  1183. * groupId of data. can be used for doing drilldown / up animation
  1184. * It will be ignored if:
  1185. * - groupId is specified in each data
  1186. * - encode.itemGroupId is given.
  1187. */
  1188. dataGroupId?: OptionId;
  1189. data?: unknown;
  1190. colorBy?: ColorBy;
  1191. legendHoverLink?: boolean;
  1192. /**
  1193. * Configurations about progressive rendering
  1194. */
  1195. progressive?: number | false;
  1196. progressiveThreshold?: number;
  1197. progressiveChunkMode?: 'mod';
  1198. /**
  1199. * Not available on every series
  1200. */
  1201. coordinateSystem?: string;
  1202. hoverLayerThreshold?: number;
  1203. /**
  1204. * When dataset is used, seriesLayoutBy specifies whether the column or the row of dataset is mapped to the series
  1205. * namely, the series is "layout" on columns or rows
  1206. * @default 'column'
  1207. */
  1208. seriesLayoutBy?: 'column' | 'row';
  1209. labelLine?: LabelLineOption;
  1210. /**
  1211. * Overall label layout option in label layout stage.
  1212. */
  1213. labelLayout?: LabelLayoutOption | LabelLayoutOptionCallback;
  1214. /**
  1215. * Animation config for state transition.
  1216. */
  1217. stateAnimation?: AnimationOption;
  1218. /**
  1219. * If enabled universal transition cross series.
  1220. * @example
  1221. * universalTransition: true
  1222. * universalTransition: { enabled: true }
  1223. */
  1224. universalTransition?: boolean | UniversalTransitionOption;
  1225. /**
  1226. * Map of selected data
  1227. * key is name or index of data.
  1228. */
  1229. selectedMap?: Dictionary<boolean> | 'all';
  1230. selectedMode?: 'single' | 'multiple' | 'series' | boolean;
  1231. }
  1232. export interface SeriesOnCartesianOptionMixin {
  1233. xAxisIndex?: number;
  1234. yAxisIndex?: number;
  1235. xAxisId?: string;
  1236. yAxisId?: string;
  1237. }
  1238. export interface SeriesOnPolarOptionMixin {
  1239. polarIndex?: number;
  1240. polarId?: string;
  1241. }
  1242. export interface SeriesOnSingleOptionMixin {
  1243. singleAxisIndex?: number;
  1244. singleAxisId?: string;
  1245. }
  1246. export interface SeriesOnGeoOptionMixin {
  1247. geoIndex?: number;
  1248. geoId?: string;
  1249. }
  1250. export interface SeriesOnCalendarOptionMixin {
  1251. calendarIndex?: number;
  1252. calendarId?: string;
  1253. }
  1254. export interface SeriesLargeOptionMixin {
  1255. large?: boolean;
  1256. largeThreshold?: number;
  1257. }
  1258. export interface SeriesStackOptionMixin {
  1259. stack?: string;
  1260. stackStrategy?: 'samesign' | 'all' | 'positive' | 'negative';
  1261. }
  1262. declare type SamplingFunc = (frame: ArrayLike<number>) => number;
  1263. export interface SeriesSamplingOptionMixin {
  1264. sampling?: 'none' | 'average' | 'min' | 'max' | 'sum' | 'lttb' | SamplingFunc;
  1265. }
  1266. export interface SeriesEncodeOptionMixin {
  1267. datasetIndex?: number;
  1268. datasetId?: string | number;
  1269. seriesLayoutBy?: SeriesLayoutBy;
  1270. sourceHeader?: OptionSourceHeader;
  1271. dimensions?: DimensionDefinitionLoose[];
  1272. encode?: OptionEncode;
  1273. }
  1274. export declare type SeriesEncodableModel = SeriesModel<SeriesOption & SeriesEncodeOptionMixin>;
  1275. export interface AriaLabelOption {
  1276. enabled?: boolean;
  1277. description?: string;
  1278. general?: {
  1279. withTitle?: string;
  1280. withoutTitle?: string;
  1281. };
  1282. series?: {
  1283. maxCount?: number;
  1284. single?: {
  1285. prefix?: string;
  1286. withName?: string;
  1287. withoutName?: string;
  1288. };
  1289. multiple?: {
  1290. prefix?: string;
  1291. withName?: string;
  1292. withoutName?: string;
  1293. separator?: {
  1294. middle?: string;
  1295. end?: string;
  1296. };
  1297. };
  1298. };
  1299. data?: {
  1300. maxCount?: number;
  1301. allData?: string;
  1302. partialData?: string;
  1303. withName?: string;
  1304. withoutName?: string;
  1305. separator?: {
  1306. middle?: string;
  1307. end?: string;
  1308. };
  1309. };
  1310. }
  1311. export interface AriaOption extends AriaLabelOption {
  1312. mainType?: 'aria';
  1313. enabled?: boolean;
  1314. label?: AriaLabelOption;
  1315. decal?: {
  1316. show?: boolean;
  1317. decals?: DecalObject | DecalObject[];
  1318. };
  1319. }
  1320. export interface AriaOptionMixin {
  1321. aria?: AriaOption;
  1322. }