LineView.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. var _config = require("../../config");
  2. var __DEV__ = _config.__DEV__;
  3. var zrUtil = require("zrender/lib/core/util");
  4. var SymbolDraw = require("../helper/SymbolDraw");
  5. var SymbolClz = require("../helper/Symbol");
  6. var lineAnimationDiff = require("./lineAnimationDiff");
  7. var graphic = require("../../util/graphic");
  8. var modelUtil = require("../../util/model");
  9. var _poly = require("./poly");
  10. var Polyline = _poly.Polyline;
  11. var Polygon = _poly.Polygon;
  12. var ChartView = require("../../view/Chart");
  13. // FIXME step not support polar
  14. function isPointsSame(points1, points2) {
  15. if (points1.length !== points2.length) {
  16. return;
  17. }
  18. for (var i = 0; i < points1.length; i++) {
  19. var p1 = points1[i];
  20. var p2 = points2[i];
  21. if (p1[0] !== p2[0] || p1[1] !== p2[1]) {
  22. return;
  23. }
  24. }
  25. return true;
  26. }
  27. function getSmooth(smooth) {
  28. return typeof smooth === 'number' ? smooth : smooth ? 0.3 : 0;
  29. }
  30. function getAxisExtentWithGap(axis) {
  31. var extent = axis.getGlobalExtent();
  32. if (axis.onBand) {
  33. // Remove extra 1px to avoid line miter in clipped edge
  34. var halfBandWidth = axis.getBandWidth() / 2 - 1;
  35. var dir = extent[1] > extent[0] ? 1 : -1;
  36. extent[0] += dir * halfBandWidth;
  37. extent[1] -= dir * halfBandWidth;
  38. }
  39. return extent;
  40. }
  41. function sign(val) {
  42. return val >= 0 ? 1 : -1;
  43. }
  44. /**
  45. * @param {module:echarts/coord/cartesian/Cartesian2D|module:echarts/coord/polar/Polar} coordSys
  46. * @param {module:echarts/data/List} data
  47. * @param {Array.<Array.<number>>} points
  48. * @private
  49. */
  50. function getStackedOnPoints(coordSys, data) {
  51. var baseAxis = coordSys.getBaseAxis();
  52. var valueAxis = coordSys.getOtherAxis(baseAxis);
  53. var valueStart = 0;
  54. if (!baseAxis.onZero) {
  55. var extent = valueAxis.scale.getExtent();
  56. if (extent[0] > 0) {
  57. // Both positive
  58. valueStart = extent[0];
  59. } else if (extent[1] < 0) {
  60. // Both negative
  61. valueStart = extent[1];
  62. } // If is one positive, and one negative, onZero shall be true
  63. }
  64. var valueDim = valueAxis.dim;
  65. var baseDataOffset = valueDim === 'x' || valueDim === 'radius' ? 1 : 0;
  66. return data.mapArray([valueDim], function (val, idx) {
  67. var stackedOnSameSign;
  68. var stackedOn = data.stackedOn; // Find first stacked value with same sign
  69. while (stackedOn && sign(stackedOn.get(valueDim, idx)) === sign(val)) {
  70. stackedOnSameSign = stackedOn;
  71. break;
  72. }
  73. var stackedData = [];
  74. stackedData[baseDataOffset] = data.get(baseAxis.dim, idx);
  75. stackedData[1 - baseDataOffset] = stackedOnSameSign ? stackedOnSameSign.get(valueDim, idx, true) : valueStart;
  76. return coordSys.dataToPoint(stackedData);
  77. }, true);
  78. }
  79. function createGridClipShape(cartesian, hasAnimation, seriesModel) {
  80. var xExtent = getAxisExtentWithGap(cartesian.getAxis('x'));
  81. var yExtent = getAxisExtentWithGap(cartesian.getAxis('y'));
  82. var isHorizontal = cartesian.getBaseAxis().isHorizontal();
  83. var x = Math.min(xExtent[0], xExtent[1]);
  84. var y = Math.min(yExtent[0], yExtent[1]);
  85. var width = Math.max(xExtent[0], xExtent[1]) - x;
  86. var height = Math.max(yExtent[0], yExtent[1]) - y;
  87. var lineWidth = seriesModel.get('lineStyle.normal.width') || 2; // Expand clip shape to avoid clipping when line value exceeds axis
  88. var expandSize = seriesModel.get('clipOverflow') ? lineWidth / 2 : Math.max(width, height);
  89. if (isHorizontal) {
  90. y -= expandSize;
  91. height += expandSize * 2;
  92. } else {
  93. x -= expandSize;
  94. width += expandSize * 2;
  95. }
  96. var clipPath = new graphic.Rect({
  97. shape: {
  98. x: x,
  99. y: y,
  100. width: width,
  101. height: height
  102. }
  103. });
  104. if (hasAnimation) {
  105. clipPath.shape[isHorizontal ? 'width' : 'height'] = 0;
  106. graphic.initProps(clipPath, {
  107. shape: {
  108. width: width,
  109. height: height
  110. }
  111. }, seriesModel);
  112. }
  113. return clipPath;
  114. }
  115. function createPolarClipShape(polar, hasAnimation, seriesModel) {
  116. var angleAxis = polar.getAngleAxis();
  117. var radiusAxis = polar.getRadiusAxis();
  118. var radiusExtent = radiusAxis.getExtent();
  119. var angleExtent = angleAxis.getExtent();
  120. var RADIAN = Math.PI / 180;
  121. var clipPath = new graphic.Sector({
  122. shape: {
  123. cx: polar.cx,
  124. cy: polar.cy,
  125. r0: radiusExtent[0],
  126. r: radiusExtent[1],
  127. startAngle: -angleExtent[0] * RADIAN,
  128. endAngle: -angleExtent[1] * RADIAN,
  129. clockwise: angleAxis.inverse
  130. }
  131. });
  132. if (hasAnimation) {
  133. clipPath.shape.endAngle = -angleExtent[0] * RADIAN;
  134. graphic.initProps(clipPath, {
  135. shape: {
  136. endAngle: -angleExtent[1] * RADIAN
  137. }
  138. }, seriesModel);
  139. }
  140. return clipPath;
  141. }
  142. function createClipShape(coordSys, hasAnimation, seriesModel) {
  143. return coordSys.type === 'polar' ? createPolarClipShape(coordSys, hasAnimation, seriesModel) : createGridClipShape(coordSys, hasAnimation, seriesModel);
  144. }
  145. function turnPointsIntoStep(points, coordSys, stepTurnAt) {
  146. var baseAxis = coordSys.getBaseAxis();
  147. var baseIndex = baseAxis.dim === 'x' || baseAxis.dim === 'radius' ? 0 : 1;
  148. var stepPoints = [];
  149. for (var i = 0; i < points.length - 1; i++) {
  150. var nextPt = points[i + 1];
  151. var pt = points[i];
  152. stepPoints.push(pt);
  153. var stepPt = [];
  154. switch (stepTurnAt) {
  155. case 'end':
  156. stepPt[baseIndex] = nextPt[baseIndex];
  157. stepPt[1 - baseIndex] = pt[1 - baseIndex]; // default is start
  158. stepPoints.push(stepPt);
  159. break;
  160. case 'middle':
  161. // default is start
  162. var middle = (pt[baseIndex] + nextPt[baseIndex]) / 2;
  163. var stepPt2 = [];
  164. stepPt[baseIndex] = stepPt2[baseIndex] = middle;
  165. stepPt[1 - baseIndex] = pt[1 - baseIndex];
  166. stepPt2[1 - baseIndex] = nextPt[1 - baseIndex];
  167. stepPoints.push(stepPt);
  168. stepPoints.push(stepPt2);
  169. break;
  170. default:
  171. stepPt[baseIndex] = pt[baseIndex];
  172. stepPt[1 - baseIndex] = nextPt[1 - baseIndex]; // default is start
  173. stepPoints.push(stepPt);
  174. }
  175. } // Last points
  176. points[i] && stepPoints.push(points[i]);
  177. return stepPoints;
  178. }
  179. function getVisualGradient(data, coordSys) {
  180. var visualMetaList = data.getVisual('visualMeta');
  181. if (!visualMetaList || !visualMetaList.length || !data.count()) {
  182. // When data.count() is 0, gradient range can not be calculated.
  183. return;
  184. }
  185. var visualMeta;
  186. for (var i = visualMetaList.length - 1; i >= 0; i--) {
  187. // Can only be x or y
  188. if (visualMetaList[i].dimension < 2) {
  189. visualMeta = visualMetaList[i];
  190. break;
  191. }
  192. }
  193. if (!visualMeta || coordSys.type !== 'cartesian2d') {
  194. return;
  195. } // If the area to be rendered is bigger than area defined by LinearGradient,
  196. // the canvas spec prescribes that the color of the first stop and the last
  197. // stop should be used. But if two stops are added at offset 0, in effect
  198. // browsers use the color of the second stop to render area outside
  199. // LinearGradient. So we can only infinitesimally extend area defined in
  200. // LinearGradient to render `outerColors`.
  201. var dimension = visualMeta.dimension;
  202. var dimName = data.dimensions[dimension];
  203. var axis = coordSys.getAxis(dimName); // dataToCoor mapping may not be linear, but must be monotonic.
  204. var colorStops = zrUtil.map(visualMeta.stops, function (stop) {
  205. return {
  206. coord: axis.toGlobalCoord(axis.dataToCoord(stop.value)),
  207. color: stop.color
  208. };
  209. });
  210. var stopLen = colorStops.length;
  211. var outerColors = visualMeta.outerColors.slice();
  212. if (stopLen && colorStops[0].coord > colorStops[stopLen - 1].coord) {
  213. colorStops.reverse();
  214. outerColors.reverse();
  215. }
  216. var tinyExtent = 10; // Arbitrary value: 10px
  217. var minCoord = colorStops[0].coord - tinyExtent;
  218. var maxCoord = colorStops[stopLen - 1].coord + tinyExtent;
  219. var coordSpan = maxCoord - minCoord;
  220. if (coordSpan < 1e-3) {
  221. return 'transparent';
  222. }
  223. zrUtil.each(colorStops, function (stop) {
  224. stop.offset = (stop.coord - minCoord) / coordSpan;
  225. });
  226. colorStops.push({
  227. offset: stopLen ? colorStops[stopLen - 1].offset : 0.5,
  228. color: outerColors[1] || 'transparent'
  229. });
  230. colorStops.unshift({
  231. // notice colorStops.length have been changed.
  232. offset: stopLen ? colorStops[0].offset : 0.5,
  233. color: outerColors[0] || 'transparent'
  234. }); // zrUtil.each(colorStops, function (colorStop) {
  235. // // Make sure each offset has rounded px to avoid not sharp edge
  236. // colorStop.offset = (Math.round(colorStop.offset * (end - start) + start) - start) / (end - start);
  237. // });
  238. var gradient = new graphic.LinearGradient(0, 0, 0, 0, colorStops, true);
  239. gradient[dimName] = minCoord;
  240. gradient[dimName + '2'] = maxCoord;
  241. return gradient;
  242. }
  243. var _default = ChartView.extend({
  244. type: 'line',
  245. init: function () {
  246. var lineGroup = new graphic.Group();
  247. var symbolDraw = new SymbolDraw();
  248. this.group.add(symbolDraw.group);
  249. this._symbolDraw = symbolDraw;
  250. this._lineGroup = lineGroup;
  251. },
  252. render: function (seriesModel, ecModel, api) {
  253. var coordSys = seriesModel.coordinateSystem;
  254. var group = this.group;
  255. var data = seriesModel.getData();
  256. var lineStyleModel = seriesModel.getModel('lineStyle.normal');
  257. var areaStyleModel = seriesModel.getModel('areaStyle.normal');
  258. var points = data.mapArray(data.getItemLayout, true);
  259. var isCoordSysPolar = coordSys.type === 'polar';
  260. var prevCoordSys = this._coordSys;
  261. var symbolDraw = this._symbolDraw;
  262. var polyline = this._polyline;
  263. var polygon = this._polygon;
  264. var lineGroup = this._lineGroup;
  265. var hasAnimation = seriesModel.get('animation');
  266. var isAreaChart = !areaStyleModel.isEmpty();
  267. var stackedOnPoints = getStackedOnPoints(coordSys, data);
  268. var showSymbol = seriesModel.get('showSymbol');
  269. var isSymbolIgnore = showSymbol && !isCoordSysPolar && !seriesModel.get('showAllSymbol') && this._getSymbolIgnoreFunc(data, coordSys); // Remove temporary symbols
  270. var oldData = this._data;
  271. oldData && oldData.eachItemGraphicEl(function (el, idx) {
  272. if (el.__temp) {
  273. group.remove(el);
  274. oldData.setItemGraphicEl(idx, null);
  275. }
  276. }); // Remove previous created symbols if showSymbol changed to false
  277. if (!showSymbol) {
  278. symbolDraw.remove();
  279. }
  280. group.add(lineGroup); // FIXME step not support polar
  281. var step = !isCoordSysPolar && seriesModel.get('step'); // Initialization animation or coordinate system changed
  282. if (!(polyline && prevCoordSys.type === coordSys.type && step === this._step)) {
  283. showSymbol && symbolDraw.updateData(data, isSymbolIgnore);
  284. if (step) {
  285. // TODO If stacked series is not step
  286. points = turnPointsIntoStep(points, coordSys, step);
  287. stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step);
  288. }
  289. polyline = this._newPolyline(points, coordSys, hasAnimation);
  290. if (isAreaChart) {
  291. polygon = this._newPolygon(points, stackedOnPoints, coordSys, hasAnimation);
  292. }
  293. lineGroup.setClipPath(createClipShape(coordSys, true, seriesModel));
  294. } else {
  295. if (isAreaChart && !polygon) {
  296. // If areaStyle is added
  297. polygon = this._newPolygon(points, stackedOnPoints, coordSys, hasAnimation);
  298. } else if (polygon && !isAreaChart) {
  299. // If areaStyle is removed
  300. lineGroup.remove(polygon);
  301. polygon = this._polygon = null;
  302. } // Update clipPath
  303. lineGroup.setClipPath(createClipShape(coordSys, false, seriesModel)); // Always update, or it is wrong in the case turning on legend
  304. // because points are not changed
  305. showSymbol && symbolDraw.updateData(data, isSymbolIgnore); // Stop symbol animation and sync with line points
  306. // FIXME performance?
  307. data.eachItemGraphicEl(function (el) {
  308. el.stopAnimation(true);
  309. }); // In the case data zoom triggerred refreshing frequently
  310. // Data may not change if line has a category axis. So it should animate nothing
  311. if (!isPointsSame(this._stackedOnPoints, stackedOnPoints) || !isPointsSame(this._points, points)) {
  312. if (hasAnimation) {
  313. this._updateAnimation(data, stackedOnPoints, coordSys, api, step);
  314. } else {
  315. // Not do it in update with animation
  316. if (step) {
  317. // TODO If stacked series is not step
  318. points = turnPointsIntoStep(points, coordSys, step);
  319. stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step);
  320. }
  321. polyline.setShape({
  322. points: points
  323. });
  324. polygon && polygon.setShape({
  325. points: points,
  326. stackedOnPoints: stackedOnPoints
  327. });
  328. }
  329. }
  330. }
  331. var visualColor = getVisualGradient(data, coordSys) || data.getVisual('color');
  332. polyline.useStyle(zrUtil.defaults( // Use color in lineStyle first
  333. lineStyleModel.getLineStyle(), {
  334. fill: 'none',
  335. stroke: visualColor,
  336. lineJoin: 'bevel'
  337. }));
  338. var smooth = seriesModel.get('smooth');
  339. smooth = getSmooth(seriesModel.get('smooth'));
  340. polyline.setShape({
  341. smooth: smooth,
  342. smoothMonotone: seriesModel.get('smoothMonotone'),
  343. connectNulls: seriesModel.get('connectNulls')
  344. });
  345. if (polygon) {
  346. var stackedOn = data.stackedOn;
  347. var stackedOnSmooth = 0;
  348. polygon.useStyle(zrUtil.defaults(areaStyleModel.getAreaStyle(), {
  349. fill: visualColor,
  350. opacity: 0.7,
  351. lineJoin: 'bevel'
  352. }));
  353. if (stackedOn) {
  354. var stackedOnSeries = stackedOn.hostModel;
  355. stackedOnSmooth = getSmooth(stackedOnSeries.get('smooth'));
  356. }
  357. polygon.setShape({
  358. smooth: smooth,
  359. stackedOnSmooth: stackedOnSmooth,
  360. smoothMonotone: seriesModel.get('smoothMonotone'),
  361. connectNulls: seriesModel.get('connectNulls')
  362. });
  363. }
  364. this._data = data; // Save the coordinate system for transition animation when data changed
  365. this._coordSys = coordSys;
  366. this._stackedOnPoints = stackedOnPoints;
  367. this._points = points;
  368. this._step = step;
  369. },
  370. dispose: function () {},
  371. highlight: function (seriesModel, ecModel, api, payload) {
  372. var data = seriesModel.getData();
  373. var dataIndex = modelUtil.queryDataIndex(data, payload);
  374. if (!(dataIndex instanceof Array) && dataIndex != null && dataIndex >= 0) {
  375. var symbol = data.getItemGraphicEl(dataIndex);
  376. if (!symbol) {
  377. // Create a temporary symbol if it is not exists
  378. var pt = data.getItemLayout(dataIndex);
  379. if (!pt) {
  380. // Null data
  381. return;
  382. }
  383. symbol = new SymbolClz(data, dataIndex);
  384. symbol.position = pt;
  385. symbol.setZ(seriesModel.get('zlevel'), seriesModel.get('z'));
  386. symbol.ignore = isNaN(pt[0]) || isNaN(pt[1]);
  387. symbol.__temp = true;
  388. data.setItemGraphicEl(dataIndex, symbol); // Stop scale animation
  389. symbol.stopSymbolAnimation(true);
  390. this.group.add(symbol);
  391. }
  392. symbol.highlight();
  393. } else {
  394. // Highlight whole series
  395. ChartView.prototype.highlight.call(this, seriesModel, ecModel, api, payload);
  396. }
  397. },
  398. downplay: function (seriesModel, ecModel, api, payload) {
  399. var data = seriesModel.getData();
  400. var dataIndex = modelUtil.queryDataIndex(data, payload);
  401. if (dataIndex != null && dataIndex >= 0) {
  402. var symbol = data.getItemGraphicEl(dataIndex);
  403. if (symbol) {
  404. if (symbol.__temp) {
  405. data.setItemGraphicEl(dataIndex, null);
  406. this.group.remove(symbol);
  407. } else {
  408. symbol.downplay();
  409. }
  410. }
  411. } else {
  412. // FIXME
  413. // can not downplay completely.
  414. // Downplay whole series
  415. ChartView.prototype.downplay.call(this, seriesModel, ecModel, api, payload);
  416. }
  417. },
  418. /**
  419. * @param {module:zrender/container/Group} group
  420. * @param {Array.<Array.<number>>} points
  421. * @private
  422. */
  423. _newPolyline: function (points) {
  424. var polyline = this._polyline; // Remove previous created polyline
  425. if (polyline) {
  426. this._lineGroup.remove(polyline);
  427. }
  428. polyline = new Polyline({
  429. shape: {
  430. points: points
  431. },
  432. silent: true,
  433. z2: 10
  434. });
  435. this._lineGroup.add(polyline);
  436. this._polyline = polyline;
  437. return polyline;
  438. },
  439. /**
  440. * @param {module:zrender/container/Group} group
  441. * @param {Array.<Array.<number>>} stackedOnPoints
  442. * @param {Array.<Array.<number>>} points
  443. * @private
  444. */
  445. _newPolygon: function (points, stackedOnPoints) {
  446. var polygon = this._polygon; // Remove previous created polygon
  447. if (polygon) {
  448. this._lineGroup.remove(polygon);
  449. }
  450. polygon = new Polygon({
  451. shape: {
  452. points: points,
  453. stackedOnPoints: stackedOnPoints
  454. },
  455. silent: true
  456. });
  457. this._lineGroup.add(polygon);
  458. this._polygon = polygon;
  459. return polygon;
  460. },
  461. /**
  462. * @private
  463. */
  464. _getSymbolIgnoreFunc: function (data, coordSys) {
  465. var categoryAxis = coordSys.getAxesByScale('ordinal')[0]; // `getLabelInterval` is provided by echarts/component/axis
  466. if (categoryAxis && categoryAxis.isLabelIgnored) {
  467. return zrUtil.bind(categoryAxis.isLabelIgnored, categoryAxis);
  468. }
  469. },
  470. /**
  471. * @private
  472. */
  473. // FIXME Two value axis
  474. _updateAnimation: function (data, stackedOnPoints, coordSys, api, step) {
  475. var polyline = this._polyline;
  476. var polygon = this._polygon;
  477. var seriesModel = data.hostModel;
  478. var diff = lineAnimationDiff(this._data, data, this._stackedOnPoints, stackedOnPoints, this._coordSys, coordSys);
  479. var current = diff.current;
  480. var stackedOnCurrent = diff.stackedOnCurrent;
  481. var next = diff.next;
  482. var stackedOnNext = diff.stackedOnNext;
  483. if (step) {
  484. // TODO If stacked series is not step
  485. current = turnPointsIntoStep(diff.current, coordSys, step);
  486. stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, coordSys, step);
  487. next = turnPointsIntoStep(diff.next, coordSys, step);
  488. stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
  489. } // `diff.current` is subset of `current` (which should be ensured by
  490. // turnPointsIntoStep), so points in `__points` can be updated when
  491. // points in `current` are update during animation.
  492. polyline.shape.__points = diff.current;
  493. polyline.shape.points = current;
  494. graphic.updateProps(polyline, {
  495. shape: {
  496. points: next
  497. }
  498. }, seriesModel);
  499. if (polygon) {
  500. polygon.setShape({
  501. points: current,
  502. stackedOnPoints: stackedOnCurrent
  503. });
  504. graphic.updateProps(polygon, {
  505. shape: {
  506. points: next,
  507. stackedOnPoints: stackedOnNext
  508. }
  509. }, seriesModel);
  510. }
  511. var updatedDataInfo = [];
  512. var diffStatus = diff.status;
  513. for (var i = 0; i < diffStatus.length; i++) {
  514. var cmd = diffStatus[i].cmd;
  515. if (cmd === '=') {
  516. var el = data.getItemGraphicEl(diffStatus[i].idx1);
  517. if (el) {
  518. updatedDataInfo.push({
  519. el: el,
  520. ptIdx: i // Index of points
  521. });
  522. }
  523. }
  524. }
  525. if (polyline.animators && polyline.animators.length) {
  526. polyline.animators[0].during(function () {
  527. for (var i = 0; i < updatedDataInfo.length; i++) {
  528. var el = updatedDataInfo[i].el;
  529. el.attr('position', polyline.shape.__points[updatedDataInfo[i].ptIdx]);
  530. }
  531. });
  532. }
  533. },
  534. remove: function (ecModel) {
  535. var group = this.group;
  536. var oldData = this._data;
  537. this._lineGroup.removeAll();
  538. this._symbolDraw.remove(true); // Remove temporary created elements when highlighting
  539. oldData && oldData.eachItemGraphicEl(function (el, idx) {
  540. if (el.__temp) {
  541. group.remove(el);
  542. oldData.setItemGraphicEl(idx, null);
  543. }
  544. });
  545. this._polyline = this._polygon = this._coordSys = this._points = this._stackedOnPoints = this._data = null;
  546. }
  547. });
  548. module.exports = _default;