MatrixModel.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. /**
  20. * AUTO-GENERATED FILE. DO NOT MODIFY.
  21. */
  22. /*
  23. * Licensed to the Apache Software Foundation (ASF) under one
  24. * or more contributor license agreements. See the NOTICE file
  25. * distributed with this work for additional information
  26. * regarding copyright ownership. The ASF licenses this file
  27. * to you under the Apache License, Version 2.0 (the
  28. * "License"); you may not use this file except in compliance
  29. * with the License. You may obtain a copy of the License at
  30. *
  31. * http://www.apache.org/licenses/LICENSE-2.0
  32. *
  33. * Unless required by applicable law or agreed to in writing,
  34. * software distributed under the License is distributed on an
  35. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  36. * KIND, either express or implied. See the License for the
  37. * specific language governing permissions and limitations
  38. * under the License.
  39. */
  40. import { __extends } from "tslib";
  41. import ComponentModel from '../../model/Component.js';
  42. import Model from '../../model/Model.js';
  43. import { MatrixDim } from './MatrixDim.js';
  44. import { MatrixBodyCorner } from './MatrixBodyCorner.js';
  45. import tokens from '../../visual/tokens.js';
  46. var defaultLabelOption = {
  47. show: true,
  48. color: tokens.color.secondary,
  49. // overflow: 'truncate',
  50. overflow: 'break',
  51. lineOverflow: 'truncate',
  52. padding: [2, 3, 2, 3],
  53. // Prefer to use `padding`, rather than distance.
  54. distance: 0
  55. };
  56. function makeDefaultCellItemStyleOption(isCorner) {
  57. return {
  58. color: 'none',
  59. borderWidth: 1,
  60. borderColor: isCorner ? 'none' : tokens.color.borderTint
  61. };
  62. }
  63. ;
  64. var defaultDimOption = {
  65. show: true,
  66. label: defaultLabelOption,
  67. itemStyle: makeDefaultCellItemStyleOption(false),
  68. silent: undefined,
  69. dividerLineStyle: {
  70. width: 1,
  71. color: tokens.color.border
  72. }
  73. };
  74. var defaultBodyOption = {
  75. label: defaultLabelOption,
  76. itemStyle: makeDefaultCellItemStyleOption(false),
  77. silent: undefined
  78. };
  79. var defaultCornerOption = {
  80. label: defaultLabelOption,
  81. itemStyle: makeDefaultCellItemStyleOption(true),
  82. silent: undefined
  83. };
  84. var defaultMatrixOption = {
  85. // As a most basic coord sys, `z` should be lower than
  86. // other series and coord sys, such as, grid.
  87. z: -50,
  88. left: '10%',
  89. top: '10%',
  90. right: '10%',
  91. bottom: '10%',
  92. x: defaultDimOption,
  93. y: defaultDimOption,
  94. body: defaultBodyOption,
  95. corner: defaultCornerOption,
  96. backgroundStyle: {
  97. color: 'none',
  98. borderColor: tokens.color.axisLine,
  99. borderWidth: 1
  100. }
  101. };
  102. var MatrixModel = /** @class */function (_super) {
  103. __extends(MatrixModel, _super);
  104. function MatrixModel() {
  105. var _this = _super !== null && _super.apply(this, arguments) || this;
  106. _this.type = MatrixModel.type;
  107. return _this;
  108. }
  109. MatrixModel.prototype.optionUpdated = function () {
  110. // Simply re-create all to follow model changes.
  111. var dimModels = this._dimModels = {
  112. // Do not use matrixModel as the parent model, for preventing from cascade-fetching options to it.
  113. x: new MatrixDimensionModel(this.get('x', true) || {}),
  114. y: new MatrixDimensionModel(this.get('y', true) || {})
  115. };
  116. dimModels.x.option.type = dimModels.y.option.type = 'category';
  117. var xDim = dimModels.x.dim = new MatrixDim('x', dimModels.x);
  118. var yDim = dimModels.y.dim = new MatrixDim('y', dimModels.y);
  119. var dims = {
  120. x: xDim,
  121. y: yDim
  122. };
  123. this._body = new MatrixBodyCorner('body', new Model(this.getShallow('body')), dims);
  124. this._corner = new MatrixBodyCorner('corner', new Model(this.getShallow('corner')), dims);
  125. };
  126. MatrixModel.prototype.getDimensionModel = function (dim) {
  127. return this._dimModels[dim];
  128. };
  129. MatrixModel.prototype.getBody = function () {
  130. return this._body;
  131. };
  132. MatrixModel.prototype.getCorner = function () {
  133. return this._corner;
  134. };
  135. MatrixModel.type = 'matrix';
  136. MatrixModel.layoutMode = 'box';
  137. MatrixModel.defaultOption = defaultMatrixOption;
  138. return MatrixModel;
  139. }(ComponentModel);
  140. var MatrixDimensionModel = /** @class */function (_super) {
  141. __extends(MatrixDimensionModel, _super);
  142. function MatrixDimensionModel() {
  143. return _super !== null && _super.apply(this, arguments) || this;
  144. }
  145. MatrixDimensionModel.prototype.getOrdinalMeta = function () {
  146. return this.dim.getOrdinalMeta();
  147. };
  148. return MatrixDimensionModel;
  149. }(Model);
  150. export { MatrixDimensionModel };
  151. export default MatrixModel;