4295e26036df6607ccca3dd788a892eae0c21599b28b216f4957e7ea8273ccec170630e658e0419a0ead566e18eb51ef383ef6929358acb714fa77d5d4433f 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import * as graphic from '../../util/graphic.js';
  2. import SeriesData from '../../data/SeriesData.js';
  3. import { StageHandlerProgressParams, LineStyleOption, LineLabelOption, ColorString, AnimationOptionMixin, ZRStyleProps, StatesOptionMixin, DisplayState, LabelOption, DefaultEmphasisFocus, BlurScope } from '../../util/types.js';
  4. import Model from '../../model/Model.js';
  5. import Element from 'zrender/lib/Element.js';
  6. interface LineLike extends graphic.Group {
  7. updateData(data: SeriesData, idx: number, scope?: LineDrawSeriesScope): void;
  8. updateLayout(data: SeriesData, idx: number): void;
  9. fadeOut?(cb: () => void): void;
  10. }
  11. interface LineLikeCtor {
  12. new (data: SeriesData, idx: number, scope?: LineDrawSeriesScope): LineLike;
  13. }
  14. interface LineDrawStateOption {
  15. lineStyle?: LineStyleOption;
  16. label?: LineLabelOption;
  17. }
  18. export interface LineDrawModelOption extends LineDrawStateOption, StatesOptionMixin<LineDrawStateOption, {
  19. emphasis?: {
  20. focus?: DefaultEmphasisFocus;
  21. };
  22. }> {
  23. effect?: {
  24. show?: boolean;
  25. period?: number;
  26. delay?: number | ((idx: number) => number);
  27. /**
  28. * If move with constant speed px/sec
  29. * period will be ignored if this property is > 0,
  30. */
  31. constantSpeed?: number;
  32. symbol?: string;
  33. symbolSize?: number | number[];
  34. loop?: boolean;
  35. roundTrip?: boolean;
  36. /**
  37. * Length of trail, 0 - 1
  38. */
  39. trailLength?: number;
  40. /**
  41. * Default to be same with lineStyle.color
  42. */
  43. color?: ColorString;
  44. };
  45. }
  46. declare type ListForLineDraw = SeriesData<Model<LineDrawModelOption & AnimationOptionMixin>>;
  47. export interface LineDrawSeriesScope {
  48. lineStyle?: ZRStyleProps;
  49. emphasisLineStyle?: ZRStyleProps;
  50. blurLineStyle?: ZRStyleProps;
  51. selectLineStyle?: ZRStyleProps;
  52. labelStatesModels: Record<DisplayState, Model<LabelOption>>;
  53. focus?: DefaultEmphasisFocus;
  54. blurScope?: BlurScope;
  55. emphasisDisabled?: boolean;
  56. }
  57. declare class LineDraw {
  58. group: graphic.Group;
  59. private _LineCtor;
  60. private _lineData;
  61. private _seriesScope;
  62. private _progressiveEls;
  63. constructor(LineCtor?: LineLikeCtor);
  64. updateData(lineData: ListForLineDraw): void;
  65. updateLayout(): void;
  66. incrementalPrepareUpdate(lineData: ListForLineDraw): void;
  67. incrementalUpdate(taskParams: StageHandlerProgressParams, lineData: ListForLineDraw): void;
  68. remove(): void;
  69. eachRendered(cb: (el: Element) => boolean | void): void;
  70. private _doAdd;
  71. private _doUpdate;
  72. }
  73. export default LineDraw;