ParallelModel.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 * as zrUtil from 'zrender/lib/core/util.js';
  42. import ComponentModel from '../../model/Component.js';
  43. var ParallelModel = /** @class */function (_super) {
  44. __extends(ParallelModel, _super);
  45. function ParallelModel() {
  46. var _this = _super !== null && _super.apply(this, arguments) || this;
  47. _this.type = ParallelModel.type;
  48. return _this;
  49. }
  50. ParallelModel.prototype.init = function () {
  51. _super.prototype.init.apply(this, arguments);
  52. this.mergeOption({});
  53. };
  54. ParallelModel.prototype.mergeOption = function (newOption) {
  55. var thisOption = this.option;
  56. newOption && zrUtil.merge(thisOption, newOption, true);
  57. this._initDimensions();
  58. };
  59. /**
  60. * Whether series or axis is in this coordinate system.
  61. */
  62. ParallelModel.prototype.contains = function (model, ecModel) {
  63. var parallelIndex = model.get('parallelIndex');
  64. return parallelIndex != null && ecModel.getComponent('parallel', parallelIndex) === this;
  65. };
  66. ParallelModel.prototype.setAxisExpand = function (opt) {
  67. zrUtil.each(['axisExpandable', 'axisExpandCenter', 'axisExpandCount', 'axisExpandWidth', 'axisExpandWindow'], function (name) {
  68. if (opt.hasOwnProperty(name)) {
  69. // @ts-ignore FIXME: why "never" inferred in this.option[name]?
  70. this.option[name] = opt[name];
  71. }
  72. }, this);
  73. };
  74. ParallelModel.prototype._initDimensions = function () {
  75. var dimensions = this.dimensions = [];
  76. var parallelAxisIndex = this.parallelAxisIndex = [];
  77. var axisModels = zrUtil.filter(this.ecModel.queryComponents({
  78. mainType: 'parallelAxis'
  79. }), function (axisModel) {
  80. // Can not use this.contains here, because
  81. // initialization has not been completed yet.
  82. return (axisModel.get('parallelIndex') || 0) === this.componentIndex;
  83. }, this);
  84. zrUtil.each(axisModels, function (axisModel) {
  85. dimensions.push('dim' + axisModel.get('dim'));
  86. parallelAxisIndex.push(axisModel.componentIndex);
  87. });
  88. };
  89. ParallelModel.type = 'parallel';
  90. ParallelModel.dependencies = ['parallelAxis'];
  91. ParallelModel.layoutMode = 'box';
  92. ParallelModel.defaultOption = {
  93. // zlevel: 0,
  94. z: 0,
  95. left: 80,
  96. top: 60,
  97. right: 80,
  98. bottom: 60,
  99. // width: {totalWidth} - left - right,
  100. // height: {totalHeight} - top - bottom,
  101. layout: 'horizontal',
  102. // FIXME
  103. // naming?
  104. axisExpandable: false,
  105. axisExpandCenter: null,
  106. axisExpandCount: 0,
  107. axisExpandWidth: 50,
  108. axisExpandRate: 17,
  109. axisExpandDebounce: 50,
  110. // [out, in, jumpTarget]. In percentage. If use [null, 0.05], null means full.
  111. // Do not doc to user until necessary.
  112. axisExpandSlideTriggerArea: [-0.15, 0.05, 0.4],
  113. axisExpandTriggerOn: 'click',
  114. parallelAxisDefault: null
  115. };
  116. return ParallelModel;
  117. }(ComponentModel);
  118. export default ParallelModel;