ParallelModel.js 4.4 KB

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