GridModel.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 { getLayoutParams, mergeLayoutParam } from '../../util/layout.js';
  43. import tokens from '../../visual/tokens.js';
  44. // For backward compatibility, do not use a margin. Although the labels might touch the edge of
  45. // the canvas, the chart canvas probably does not have an border or a different background color within a page.
  46. export var OUTER_BOUNDS_DEFAULT = {
  47. left: 0,
  48. right: 0,
  49. top: 0,
  50. bottom: 0
  51. };
  52. export var OUTER_BOUNDS_CLAMP_DEFAULT = ['25%', '25%'];
  53. var GridModel = /** @class */function (_super) {
  54. __extends(GridModel, _super);
  55. function GridModel() {
  56. return _super !== null && _super.apply(this, arguments) || this;
  57. }
  58. GridModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {
  59. var outerBoundsCp = getLayoutParams(option.outerBounds);
  60. _super.prototype.mergeDefaultAndTheme.apply(this, arguments);
  61. if (outerBoundsCp && option.outerBounds) {
  62. mergeLayoutParam(option.outerBounds, outerBoundsCp);
  63. }
  64. };
  65. GridModel.prototype.mergeOption = function (newOption, ecModel) {
  66. _super.prototype.mergeOption.apply(this, arguments);
  67. if (this.option.outerBounds && newOption.outerBounds) {
  68. mergeLayoutParam(this.option.outerBounds, newOption.outerBounds);
  69. }
  70. };
  71. GridModel.type = 'grid';
  72. GridModel.dependencies = ['xAxis', 'yAxis'];
  73. GridModel.layoutMode = 'box';
  74. GridModel.defaultOption = {
  75. show: false,
  76. // zlevel: 0,
  77. z: 0,
  78. left: '15%',
  79. top: 65,
  80. right: '10%',
  81. bottom: 80,
  82. // If grid size contain label
  83. containLabel: false,
  84. outerBoundsMode: 'auto',
  85. outerBounds: OUTER_BOUNDS_DEFAULT,
  86. outerBoundsContain: 'all',
  87. outerBoundsClampWidth: OUTER_BOUNDS_CLAMP_DEFAULT[0],
  88. outerBoundsClampHeight: OUTER_BOUNDS_CLAMP_DEFAULT[1],
  89. // width: {totalWidth} - left - right,
  90. // height: {totalHeight} - top - bottom,
  91. backgroundColor: tokens.color.transparent,
  92. borderWidth: 1,
  93. borderColor: tokens.color.neutral30
  94. };
  95. return GridModel;
  96. }(ComponentModel);
  97. export default GridModel;