574f286dafe602d1154b4e40f0c2bd7b96d61951d35df75fefac570b5a06a85ab90a3a4b1bac8e07cd242c8166ed46bff0a2b61c8969eb7f64edf03e6e895c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import Scale from '../scale/Scale.js';
  2. import { AxisBaseModel } from './AxisBaseModel.js';
  3. import { ScaleDataValue } from '../util/types.js';
  4. export interface ScaleRawExtentResult {
  5. readonly min: number;
  6. readonly max: number;
  7. readonly minFixed: boolean;
  8. readonly maxFixed: boolean;
  9. readonly isBlank: boolean;
  10. }
  11. export declare class ScaleRawExtentInfo {
  12. private _needCrossZero;
  13. private _isOrdinal;
  14. private _axisDataLen;
  15. private _boundaryGapInner;
  16. private _modelMinRaw;
  17. private _modelMaxRaw;
  18. private _modelMinNum;
  19. private _modelMaxNum;
  20. private _dataMin;
  21. private _dataMax;
  22. private _determinedMin;
  23. private _determinedMax;
  24. readonly frozen: boolean;
  25. constructor(scale: Scale, model: AxisBaseModel, originalExtent: number[]);
  26. /**
  27. * Parameters depending on ouside (like model, user callback)
  28. * are prepared and fixed here.
  29. */
  30. private _prepareParams;
  31. /**
  32. * Calculate extent by prepared parameters.
  33. * This method has no external dependency and can be called duplicatedly,
  34. * getting the same result.
  35. * If parameters changed, should call this method to recalcuate.
  36. */
  37. calculate(): ScaleRawExtentResult;
  38. modifyDataMinMax(minMaxName: 'min' | 'max', val: number): void;
  39. setDeterminedMinMax(minMaxName: 'min' | 'max', val: number): void;
  40. freeze(): void;
  41. }
  42. /**
  43. * Get scale min max and related info only depends on model settings.
  44. * This method can be called after coordinate system created.
  45. * For example, in data processing stage.
  46. *
  47. * Scale extent info probably be required multiple times during a workflow.
  48. * For example:
  49. * (1) `dataZoom` depends it to get the axis extent in "100%" state.
  50. * (2) `processor/extentCalculator` depends it to make sure whether axis extent is specified.
  51. * (3) `coordSys.update` use it to finally decide the scale extent.
  52. * But the callback of `min`/`max` should not be called multiple times.
  53. * The code below should not be implemented repeatedly either.
  54. * So we cache the result in the scale instance, which will be recreated at the begining
  55. * of the workflow (because `scale` instance will be recreated each round of the workflow).
  56. */
  57. export declare function ensureScaleRawExtentInfo(scale: Scale, model: AxisBaseModel, originalExtent: number[]): ScaleRawExtentInfo;
  58. export declare function parseAxisModelMinMax(scale: Scale, minMax: ScaleDataValue): number;