646cc63181893cafce99bb1a92d35b7e16cf9f545cc625be22b80b6f6f35e2da4e3be875f02b3d6f75879f8b0de4e425d723266660c78bf96a7468970a1c2b 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import * as matrix from 'zrender/lib/core/matrix.js';
  2. import ParallelAxis from './ParallelAxis.js';
  3. import * as graphic from '../../util/graphic.js';
  4. import ParallelModel from './ParallelModel.js';
  5. import GlobalModel from '../../model/Global.js';
  6. import ExtensionAPI from '../../core/ExtensionAPI.js';
  7. import { DimensionName, ScaleDataValue } from '../../util/types.js';
  8. import { CoordinateSystem, CoordinateSystemMaster } from '../CoordinateSystem.js';
  9. import { ParallelActiveState } from './AxisModel.js';
  10. import SeriesData from '../../data/SeriesData.js';
  11. export interface ParallelAxisLayoutInfo {
  12. position: number[];
  13. rotation: number;
  14. transform: matrix.MatrixArray;
  15. axisNameAvailableWidth: number;
  16. axisLabelShow: boolean;
  17. nameTruncateMaxWidth: number;
  18. tickDirection: -1 | 1;
  19. labelDirection: -1 | 1;
  20. }
  21. declare type SlidedAxisExpandBehavior = 'none' | 'slide' | 'jump';
  22. declare class Parallel implements CoordinateSystemMaster, CoordinateSystem {
  23. readonly type = "parallel";
  24. /**
  25. * key: dimension
  26. */
  27. private _axesMap;
  28. /**
  29. * key: dimension
  30. * value: {position: [], rotation, }
  31. */
  32. private _axesLayout;
  33. /**
  34. * Always follow axis order.
  35. */
  36. readonly dimensions: ParallelModel['dimensions'];
  37. private _rect;
  38. private _model;
  39. name: string;
  40. model: ParallelModel;
  41. constructor(parallelModel: ParallelModel, ecModel: GlobalModel, api: ExtensionAPI);
  42. private _init;
  43. /**
  44. * Update axis scale after data processed
  45. */
  46. update(ecModel: GlobalModel, api: ExtensionAPI): void;
  47. containPoint(point: number[]): boolean;
  48. getModel(): ParallelModel;
  49. /**
  50. * Update properties from series
  51. */
  52. private _updateAxesFromSeries;
  53. /**
  54. * Resize the parallel coordinate system.
  55. */
  56. resize(parallelModel: ParallelModel, api: ExtensionAPI): void;
  57. getRect(): graphic.BoundingRect;
  58. private _makeLayoutInfo;
  59. private _layoutAxes;
  60. /**
  61. * Get axis by dim.
  62. */
  63. getAxis(dim: DimensionName): ParallelAxis;
  64. /**
  65. * Convert a dim value of a single item of series data to Point.
  66. */
  67. dataToPoint(value: ScaleDataValue, dim: DimensionName): number[];
  68. /**
  69. * Travel data for one time, get activeState of each data item.
  70. * @param start the start dataIndex that travel from.
  71. * @param end the next dataIndex of the last dataIndex will be travel.
  72. */
  73. eachActiveState(data: SeriesData, callback: (activeState: ParallelActiveState, dataIndex: number) => void, start?: number, end?: number): void;
  74. /**
  75. * Whether has any activeSet.
  76. */
  77. hasAxisBrushed(): boolean;
  78. /**
  79. * Convert coords of each axis to Point.
  80. * Return point. For example: [10, 20]
  81. */
  82. axisCoordToPoint(coord: number, dim: DimensionName): number[];
  83. /**
  84. * Get axis layout.
  85. */
  86. getAxisLayout(dim: DimensionName): ParallelAxisLayoutInfo;
  87. /**
  88. * @return {Object} {axisExpandWindow, delta, behavior: 'jump' | 'slide' | 'none'}.
  89. */
  90. getSlidedAxisExpandWindow(point: number[]): {
  91. axisExpandWindow: number[];
  92. behavior: SlidedAxisExpandBehavior;
  93. };
  94. }
  95. export default Parallel;