MCPcopy
hub / github.com/apache/echarts / Matrix

Class Matrix

src/coord/matrix/Matrix.ts:55–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54
55class Matrix implements CoordinateSystem, CoordinateSystemMaster {
56
57 static readonly dimensions = ['x', 'y', 'value'];
58 /**
59 * @see fetchers in `model/referHelper.ts`,
60 * which is used to parse data in ordinal way.
61 * In most series only 'x' and 'y' is required,
62 * but some series, such as heatmap, can specify value.
63 */
64 static getDimensionsInfo() {
65 return [
66 {name: 'x', type: 'ordinal' as const},
67 {name: 'y', type: 'ordinal' as const},
68 {name: 'value'},
69 ];
70 }
71
72 readonly dimensions = Matrix.dimensions;
73 readonly type = 'matrix';
74
75 private _model: MatrixModel;
76 private _dimModels: {
77 x: MatrixDimensionModel;
78 y: MatrixDimensionModel;
79 };
80 private _dims: MatrixDimPair;
81
82 private _rect: LayoutRect;
83
84 static create(ecModel: GlobalModel, api: ExtensionAPI) {
85 const matrixList: Matrix[] = [];
86
87 ecModel.eachComponent('matrix', function (matrixModel: MatrixModel) {
88 const matrix = new Matrix(matrixModel, ecModel, api);
89 matrixList.push(matrix);
90 matrixModel.coordinateSystem = matrix;
91 });
92
93 // Inject coordinate system
94 // PENDING: optimize to not to travel all components?
95 // (collect relevant components in ecModel only when model update?)
96 ecModel.eachComponent((mainType, componentModel) => {
97 injectCoordSysByOption({
98 targetModel: componentModel,
99 coordSysType: 'matrix',
100 coordSysProvider: simpleCoordSysInjectionProvider,
101 });
102 });
103
104 return matrixList;
105 }
106
107 constructor(matrixModel: MatrixModel, ecModel: GlobalModel, api: ExtensionAPI) {
108 this._model = matrixModel;
109 const models = this._dimModels = {
110 x: matrixModel.getDimensionModel('x'),
111 y: matrixModel.getDimensionModel('y'),
112 };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…