608dff897b3f520c9564b6bbb6dc9092a1506cabad7f7ee2a67a8b9613ebad3ffd06b3767f1173351639d8a73d7bfe9d5cfd5dd75eed28f06207e401924b79 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { Source } from '../Source.js';
  2. import { ArrayLike } from 'zrender/lib/core/types.js';
  3. import { DimensionName, DimensionIndex, OptionSourceData, OptionDataItem, OptionDataValue, SourceFormat, SeriesLayoutBy, ParsedValue, DimensionLoose, NullUndefined } from '../../util/types.js';
  4. import SeriesData from '../SeriesData.js';
  5. export interface DataProvider {
  6. /**
  7. * true: all of the value are in primitive type (in type `OptionDataValue`).
  8. * false: Not sure whether any of them is non primitive type (in type `OptionDataItemObject`).
  9. * Like `data: [ { value: xx, itemStyle: {...} }, ...]`
  10. * At present it only happen in `SOURCE_FORMAT_ORIGINAL`.
  11. */
  12. pure?: boolean;
  13. /**
  14. * If data is persistent and will not be released after use.
  15. */
  16. persistent?: boolean;
  17. getSource(): Source;
  18. count(): number;
  19. getItem(idx: number, out?: OptionDataItem): OptionDataItem;
  20. fillStorage?(start: number, end: number, out: ArrayLike<ParsedValue>[], extent: number[][]): void;
  21. appendData?(newData: ArrayLike<OptionDataItem>): void;
  22. clean?(): void;
  23. }
  24. export interface DefaultDataProvider {
  25. fillStorage?(start: number, end: number, out: ArrayLike<ParsedValue>[], extent: number[][]): void;
  26. }
  27. /**
  28. * If normal array used, mutable chunk size is supported.
  29. * If typed array used, chunk size must be fixed.
  30. */
  31. export declare class DefaultDataProvider implements DataProvider {
  32. private _source;
  33. private _data;
  34. private _offset;
  35. private _dimSize;
  36. pure: boolean;
  37. persistent: boolean;
  38. static protoInitialize: void;
  39. constructor(sourceParam: Source | OptionSourceData, dimSize?: number);
  40. getSource(): Source;
  41. count(): number;
  42. getItem(idx: number, out?: ArrayLike<OptionDataValue>): OptionDataItem;
  43. appendData(newData: OptionSourceData): void;
  44. clean(): void;
  45. private static internalField;
  46. }
  47. declare type RawSourceItemGetter = (rawData: OptionSourceData, startIndex: number, dimsDef: {
  48. name?: DimensionName;
  49. }[], idx: number, out?: ArrayLike<OptionDataValue>) => OptionDataItem | ArrayLike<OptionDataValue>;
  50. export declare function getRawSourceItemGetter(sourceFormat: SourceFormat, seriesLayoutBy: SeriesLayoutBy): RawSourceItemGetter;
  51. declare type RawSourceDataCounter = (rawData: OptionSourceData, startIndex: number, dimsDef: {
  52. name?: DimensionName;
  53. }[]) => number;
  54. export declare function getRawSourceDataCounter(sourceFormat: SourceFormat, seriesLayoutBy: SeriesLayoutBy): RawSourceDataCounter;
  55. declare type RawSourceValueGetter = (dataItem: OptionDataItem, dimIndex: DimensionIndex, property: DimensionName) => OptionDataValue;
  56. export declare function getRawSourceValueGetter(sourceFormat: SourceFormat): RawSourceValueGetter;
  57. export declare function retrieveRawValue(data: SeriesData, dataIndex: number, dim?: DimensionLoose | NullUndefined): OptionDataValue | OptionDataItem;
  58. /**
  59. * Compatible with some cases (in pie, map) like:
  60. * data: [{name: 'xx', value: 5, selected: true}, ...]
  61. * where only sourceFormat is 'original' and 'objectRows' supported.
  62. *
  63. * // TODO
  64. * Supported detail options in data item when using 'arrayRows'.
  65. *
  66. * @param data
  67. * @param dataIndex
  68. * @param attr like 'selected'
  69. */
  70. export declare function retrieveRawAttr(data: SeriesData, dataIndex: number, attr: string): any;
  71. export {};