Polyline.js 3.9 KB

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