LineSeries.js 5.2 KB

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