LineSeries.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 createSeriesData from '../helper/createSeriesData.js';
  42. import SeriesModel from '../../model/Series.js';
  43. import { createSymbol } from '../../util/symbol.js';
  44. import { Group } from '../../util/graphic.js';
  45. var LineSeriesModel = /** @class */function (_super) {
  46. __extends(LineSeriesModel, _super);
  47. function LineSeriesModel() {
  48. var _this = _super !== null && _super.apply(this, arguments) || this;
  49. _this.type = LineSeriesModel.type;
  50. _this.hasSymbolVisual = true;
  51. return _this;
  52. }
  53. LineSeriesModel.prototype.getInitialData = function (option) {
  54. if (process.env.NODE_ENV !== 'production') {
  55. var coordSys = option.coordinateSystem;
  56. if (coordSys !== 'polar' && coordSys !== 'cartesian2d') {
  57. throw new Error('Line not support coordinateSystem besides cartesian and polar');
  58. }
  59. }
  60. return createSeriesData(null, this, {
  61. useEncodeDefaulter: true
  62. });
  63. };
  64. LineSeriesModel.prototype.getLegendIcon = function (opt) {
  65. var group = new Group();
  66. var line = createSymbol('line', 0, opt.itemHeight / 2, opt.itemWidth, 0, opt.lineStyle.stroke, false);
  67. group.add(line);
  68. line.setStyle(opt.lineStyle);
  69. var visualType = this.getData().getVisual('symbol');
  70. var visualRotate = this.getData().getVisual('symbolRotate');
  71. var symbolType = visualType === 'none' ? 'circle' : visualType;
  72. // Symbol size is 80% when there is a line
  73. var size = opt.itemHeight * 0.8;
  74. var symbol = createSymbol(symbolType, (opt.itemWidth - size) / 2, (opt.itemHeight - size) / 2, size, size, opt.itemStyle.fill);
  75. group.add(symbol);
  76. symbol.setStyle(opt.itemStyle);
  77. var symbolRotate = opt.iconRotate === 'inherit' ? visualRotate : opt.iconRotate || 0;
  78. symbol.rotation = symbolRotate * Math.PI / 180;
  79. symbol.setOrigin([opt.itemWidth / 2, opt.itemHeight / 2]);
  80. if (symbolType.indexOf('empty') > -1) {
  81. symbol.style.stroke = symbol.style.fill;
  82. symbol.style.fill = '#fff';
  83. symbol.style.lineWidth = 2;
  84. }
  85. return group;
  86. };
  87. LineSeriesModel.type = 'series.line';
  88. LineSeriesModel.dependencies = ['grid', 'polar'];
  89. LineSeriesModel.defaultOption = {
  90. // zlevel: 0,
  91. z: 3,
  92. coordinateSystem: 'cartesian2d',
  93. legendHoverLink: true,
  94. clip: true,
  95. label: {
  96. position: 'top'
  97. },
  98. // itemStyle: {
  99. // },
  100. endLabel: {
  101. show: false,
  102. valueAnimation: true,
  103. distance: 8
  104. },
  105. lineStyle: {
  106. width: 2,
  107. type: 'solid'
  108. },
  109. emphasis: {
  110. scale: true
  111. },
  112. // areaStyle: {
  113. // origin of areaStyle. Valid values:
  114. // `'auto'/null/undefined`: from axisLine to data
  115. // `'start'`: from min to data
  116. // `'end'`: from data to max
  117. // origin: 'auto'
  118. // },
  119. // false, 'start', 'end', 'middle'
  120. step: false,
  121. // Disabled if step is true
  122. smooth: false,
  123. smoothMonotone: null,
  124. symbol: 'emptyCircle',
  125. symbolSize: 4,
  126. symbolRotate: null,
  127. showSymbol: true,
  128. // `false`: follow the label interval strategy.
  129. // `true`: show all symbols.
  130. // `'auto'`: If possible, show all symbols, otherwise
  131. // follow the label interval strategy.
  132. showAllSymbol: 'auto',
  133. // Whether to connect break point.
  134. connectNulls: false,
  135. // Sampling for large data. Can be: 'average', 'max', 'min', 'sum', 'lttb'.
  136. sampling: 'none',
  137. animationEasing: 'linear',
  138. // Disable progressive
  139. progressive: 0,
  140. hoverLayerThreshold: Infinity,
  141. universalTransition: {
  142. divideShape: 'clone'
  143. },
  144. triggerLineEvent: false
  145. };
  146. return LineSeriesModel;
  147. }(SeriesModel);
  148. export default LineSeriesModel;