Polyline.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 graphic from '../../util/graphic.js';
  42. import { toggleHoverEmphasis } from '../../util/states.js';
  43. var Polyline =
  44. /** @class */
  45. function (_super) {
  46. __extends(Polyline, _super);
  47. function Polyline(lineData, idx, seriesScope) {
  48. var _this = _super.call(this) || this;
  49. _this._createPolyline(lineData, idx, seriesScope);
  50. return _this;
  51. }
  52. Polyline.prototype._createPolyline = function (lineData, idx, seriesScope) {
  53. // let seriesModel = lineData.hostModel;
  54. var points = lineData.getItemLayout(idx);
  55. var line = new graphic.Polyline({
  56. shape: {
  57. points: points
  58. }
  59. });
  60. this.add(line);
  61. this._updateCommonStl(lineData, idx, seriesScope);
  62. };
  63. ;
  64. Polyline.prototype.updateData = function (lineData, idx, seriesScope) {
  65. var seriesModel = lineData.hostModel;
  66. var line = this.childAt(0);
  67. var target = {
  68. shape: {
  69. points: lineData.getItemLayout(idx)
  70. }
  71. };
  72. graphic.updateProps(line, target, seriesModel, idx);
  73. this._updateCommonStl(lineData, idx, seriesScope);
  74. };
  75. ;
  76. Polyline.prototype._updateCommonStl = function (lineData, idx, seriesScope) {
  77. var line = this.childAt(0);
  78. var itemModel = lineData.getItemModel(idx);
  79. var emphasisLineStyle = seriesScope && seriesScope.emphasisLineStyle;
  80. var focus = seriesScope && seriesScope.focus;
  81. var blurScope = seriesScope && seriesScope.blurScope;
  82. var emphasisDisabled = seriesScope && seriesScope.emphasisDisabled;
  83. if (!seriesScope || lineData.hasItemOption) {
  84. var emphasisModel = itemModel.getModel('emphasis');
  85. emphasisLineStyle = emphasisModel.getModel('lineStyle').getLineStyle();
  86. emphasisDisabled = emphasisModel.get('disabled');
  87. focus = emphasisModel.get('focus');
  88. blurScope = emphasisModel.get('blurScope');
  89. }
  90. line.useStyle(lineData.getItemVisual(idx, 'style'));
  91. line.style.fill = null;
  92. line.style.strokeNoScale = true;
  93. var lineEmphasisState = line.ensureState('emphasis');
  94. lineEmphasisState.style = emphasisLineStyle;
  95. toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
  96. };
  97. ;
  98. Polyline.prototype.updateLayout = function (lineData, idx) {
  99. var polyline = this.childAt(0);
  100. polyline.setShape('points', lineData.getItemLayout(idx));
  101. };
  102. ;
  103. return Polyline;
  104. }(graphic.Group);
  105. export default Polyline;