echarts 4.6.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/.github/pull_request_template.md +66 -0
  2. package/.github/workflows/nodejs.yml +12 -2
  3. package/CONTRIBUTING.md +16 -160
  4. package/NOTICE +1 -1
  5. package/README.md +2 -2
  6. package/dist/echarts-en.common.js +684 -300
  7. package/dist/echarts-en.common.min.js +1 -1
  8. package/dist/echarts-en.js +1070 -407
  9. package/dist/echarts-en.js.map +1 -1
  10. package/dist/echarts-en.min.js +1 -1
  11. package/dist/echarts-en.simple.js +499 -222
  12. package/dist/echarts-en.simple.min.js +1 -1
  13. package/dist/echarts.common.js +684 -300
  14. package/dist/echarts.common.min.js +1 -1
  15. package/dist/echarts.js +1070 -407
  16. package/dist/echarts.js.map +1 -1
  17. package/dist/echarts.min.js +1 -1
  18. package/dist/echarts.simple.js +499 -222
  19. package/dist/echarts.simple.min.js +1 -1
  20. package/lib/chart/bar/BarSeries.js +14 -1
  21. package/lib/chart/bar/BarView.js +134 -14
  22. package/lib/chart/candlestick/candlestickVisual.js +1 -1
  23. package/lib/chart/funnel/FunnelSeries.js +1 -3
  24. package/lib/chart/graph/GraphSeries.js +2 -1
  25. package/lib/chart/graph/GraphView.js +2 -4
  26. package/lib/chart/helper/EffectLine.js +23 -1
  27. package/lib/chart/helper/Line.js +94 -33
  28. package/lib/chart/helper/createRenderPlanner.js +6 -3
  29. package/lib/chart/pie/PieView.js +1 -1
  30. package/lib/chart/radar/RadarSeries.js +20 -0
  31. package/lib/chart/sankey/SankeySeries.js +13 -1
  32. package/lib/chart/sankey/SankeyView.js +42 -23
  33. package/lib/chart/sankey/sankeyLayout.js +4 -3
  34. package/lib/chart/tree/TreeSeries.js +3 -0
  35. package/lib/chart/tree/TreeView.js +151 -25
  36. package/lib/chart/treemap/TreemapView.js +57 -27
  37. package/lib/component/axis/AxisBuilder.js +0 -1
  38. package/lib/component/axis/CartesianAxisView.js +7 -84
  39. package/lib/component/axis/SingleAxisView.js +21 -6
  40. package/lib/component/axis/axisSplitHelper.js +132 -0
  41. package/lib/component/brush/BrushView.js +11 -1
  42. package/lib/component/brush/visualEncoding.js +13 -2
  43. package/lib/component/helper/MapDraw.js +6 -8
  44. package/lib/component/legend/ScrollableLegendView.js +18 -18
  45. package/lib/component/marker/MarkLineModel.js +2 -1
  46. package/lib/component/marker/markerHelper.js +7 -4
  47. package/lib/component/tooltip/TooltipContent.js +60 -23
  48. package/lib/component/tooltip/TooltipView.js +6 -7
  49. package/lib/coord/View.js +9 -0
  50. package/lib/coord/radar/Radar.js +4 -4
  51. package/lib/echarts.js +2 -2
  52. package/lib/layout/barGrid.js +17 -10
  53. package/lib/layout/barPolar.js +0 -5
  54. package/lib/scale/Interval.js +2 -2
  55. package/lib/stream/Scheduler.js +9 -1
  56. package/lib/util/graphic.js +2 -2
  57. package/map/js/china.js +1 -1
  58. package/map/js/province/chongqing.js +1 -1
  59. package/map/js/province/tianjin.js +1 -28
  60. package/map/json/china.json +1 -1
  61. package/map/json/province/chongqing.json +1 -1
  62. package/package.json +10 -6
  63. package/src/chart/bar/BarSeries.js +15 -1
  64. package/src/chart/bar/BarView.js +136 -12
  65. package/src/chart/candlestick/candlestickVisual.js +1 -1
  66. package/src/chart/funnel/FunnelSeries.js +1 -2
  67. package/src/chart/graph/GraphSeries.js +2 -1
  68. package/src/chart/graph/GraphView.js +2 -2
  69. package/src/chart/helper/EffectLine.js +23 -1
  70. package/src/chart/helper/Line.js +84 -26
  71. package/src/chart/helper/createRenderPlanner.js +5 -2
  72. package/src/chart/pie/PieView.js +1 -1
  73. package/src/chart/pie/labelLayout.js +1 -1
  74. package/src/chart/radar/RadarSeries.js +22 -0
  75. package/src/chart/sankey/SankeySeries.js +12 -1
  76. package/src/chart/sankey/SankeyView.js +49 -21
  77. package/src/chart/sankey/sankeyLayout.js +4 -3
  78. package/src/chart/tree/TreeSeries.js +5 -0
  79. package/src/chart/tree/TreeView.js +155 -22
  80. package/src/chart/treemap/TreemapView.js +57 -27
  81. package/src/component/axis/AxisBuilder.js +1 -1
  82. package/src/component/axis/CartesianAxisView.js +3 -86
  83. package/src/component/axis/SingleAxisView.js +21 -4
  84. package/src/component/axis/axisSplitHelper.js +114 -0
  85. package/src/component/brush/BrushView.js +8 -1
  86. package/src/component/brush/visualEncoding.js +6 -3
  87. package/src/component/helper/MapDraw.js +6 -6
  88. package/src/component/legend/ScrollableLegendView.js +18 -16
  89. package/src/component/marker/MarkLineModel.js +2 -1
  90. package/src/component/marker/markerHelper.js +8 -5
  91. package/src/component/tooltip/TooltipContent.js +59 -22
  92. package/src/component/tooltip/TooltipView.js +9 -7
  93. package/src/coord/View.js +10 -1
  94. package/src/coord/radar/Radar.js +5 -7
  95. package/src/echarts.js +2 -2
  96. package/src/layout/barGrid.js +14 -7
  97. package/src/layout/barPolar.js +0 -4
  98. package/src/scale/Interval.js +2 -2
  99. package/src/stream/Scheduler.js +8 -0
  100. package/src/util/graphic.js +2 -2
@@ -1285,7 +1285,11 @@ Draggable.prototype = {
1285
1285
 
1286
1286
  _dragStart: function (e) {
1287
1287
  var draggingTarget = e.target;
1288
- if (draggingTarget && draggingTarget.draggable) {
1288
+ // Find if there is draggable in the ancestor
1289
+ while (draggingTarget && !draggingTarget.draggable) {
1290
+ draggingTarget = draggingTarget.parent;
1291
+ }
1292
+ if (draggingTarget) {
1289
1293
  this._draggingTarget = draggingTarget;
1290
1294
  draggingTarget.dragging = true;
1291
1295
  this._x = e.offsetX;
@@ -1714,6 +1718,8 @@ function buildTransformer(src, dest) {
1714
1718
  var detCache = {};
1715
1719
  var det = determinant(mA, 8, 0, 0, 0, detCache);
1716
1720
  if (det === 0) {
1721
+ // can not make transformer when and only when
1722
+ // any three of the markers are collinear.
1717
1723
  return;
1718
1724
  }
1719
1725
 
@@ -1736,6 +1742,153 @@ function buildTransformer(src, dest) {
1736
1742
  };
1737
1743
  }
1738
1744
 
1745
+ var EVENT_SAVED_PROP = '___zrEVENTSAVED';
1746
+ var _calcOut$1 = [];
1747
+
1748
+ /**
1749
+ * Transform "local coord" from `elFrom` to `elTarget`.
1750
+ * "local coord": the coord based on the input `el`. The origin point is at
1751
+ * the position of "left: 0; top: 0;" in the `el`.
1752
+ *
1753
+ * Support when CSS transform is used.
1754
+ *
1755
+ * Having the `out` (that is, `[outX, outY]`), we can create an DOM element
1756
+ * and set the CSS style as "left: outX; top: outY;" and append it to `elTarge`
1757
+ * to locate the element.
1758
+ *
1759
+ * For example, this code below positions a child of `document.body` on the event
1760
+ * point, no matter whether `body` has `margin`/`paddin`/`transfrom`/... :
1761
+ * ```js
1762
+ * transformLocalCoord(out, container, document.body, event.offsetX, event.offsetY);
1763
+ * if (!eqNaN(out[0])) {
1764
+ * // Then locate the tip element on the event point.
1765
+ * var tipEl = document.createElement('div');
1766
+ * tipEl.style.cssText = 'position: absolute; left:' + out[0] + ';top:' + out[1] + ';';
1767
+ * document.body.appendChild(tipEl);
1768
+ * }
1769
+ * ```
1770
+ *
1771
+ * Notice: In some env this method is not supported. If called, `out` will be `[NaN, NaN]`.
1772
+ *
1773
+ * @param {Array.<number>} out [inX: number, inY: number] The output..
1774
+ * If can not transform, `out` will not be modified but return `false`.
1775
+ * @param {HTMLElement} elFrom The `[inX, inY]` is based on elFrom.
1776
+ * @param {HTMLElement} elTarget The `out` is based on elTarget.
1777
+ * @param {number} inX
1778
+ * @param {number} inY
1779
+ * @return {boolean} Whether transform successfully.
1780
+ */
1781
+ function transformLocalCoord(out, elFrom, elTarget, inX, inY) {
1782
+ return transformCoordWithViewport(_calcOut$1, elFrom, inX, inY, true)
1783
+ && transformCoordWithViewport(out, elTarget, _calcOut$1[0], _calcOut$1[1]);
1784
+ }
1785
+
1786
+ /**
1787
+ * Transform between a "viewport coord" and a "local coord".
1788
+ * "viewport coord": the coord based on the left-top corner of the viewport
1789
+ * of the browser.
1790
+ * "local coord": the coord based on the input `el`. The origin point is at
1791
+ * the position of "left: 0; top: 0;" in the `el`.
1792
+ *
1793
+ * Support the case when CSS transform is used on el.
1794
+ *
1795
+ * @param {Array.<number>} out [inX: number, inY: number] The output. If `inverse: false`,
1796
+ * it represents "local coord", otherwise "vireport coord".
1797
+ * If can not transform, `out` will not be modified but return `false`.
1798
+ * @param {HTMLElement} el The "local coord" is based on the `el`, see comment above.
1799
+ * @param {number} inX If `inverse: false`,
1800
+ * it represents "vireport coord", otherwise "local coord".
1801
+ * @param {number} inY If `inverse: false`,
1802
+ * it represents "vireport coord", otherwise "local coord".
1803
+ * @param {boolean} [inverse=false]
1804
+ * `true`: from "viewport coord" to "local coord".
1805
+ * `false`: from "local coord" to "viewport coord".
1806
+ * @return {boolean} Whether transform successfully.
1807
+ */
1808
+ function transformCoordWithViewport(out, el, inX, inY, inverse) {
1809
+ if (el.getBoundingClientRect && env$1.domSupported && !isCanvasEl(el)) {
1810
+ var saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
1811
+ var markers = prepareCoordMarkers(el, saved);
1812
+ var transformer = preparePointerTransformer(markers, saved, inverse);
1813
+ if (transformer) {
1814
+ transformer(out, inX, inY);
1815
+ return true;
1816
+ }
1817
+ }
1818
+ return false;
1819
+ }
1820
+
1821
+ function prepareCoordMarkers(el, saved) {
1822
+ var markers = saved.markers;
1823
+ if (markers) {
1824
+ return markers;
1825
+ }
1826
+
1827
+ markers = saved.markers = [];
1828
+ var propLR = ['left', 'right'];
1829
+ var propTB = ['top', 'bottom'];
1830
+
1831
+ for (var i = 0; i < 4; i++) {
1832
+ var marker = document.createElement('div');
1833
+ var stl = marker.style;
1834
+ var idxLR = i % 2;
1835
+ var idxTB = (i >> 1) % 2;
1836
+ stl.cssText = [
1837
+ 'position: absolute',
1838
+ 'visibility: hidden',
1839
+ 'padding: 0',
1840
+ 'margin: 0',
1841
+ 'border-width: 0',
1842
+ 'user-select: none',
1843
+ 'width:0',
1844
+ 'height:0',
1845
+ // 'width: 5px',
1846
+ // 'height: 5px',
1847
+ propLR[idxLR] + ':0',
1848
+ propTB[idxTB] + ':0',
1849
+ propLR[1 - idxLR] + ':auto',
1850
+ propTB[1 - idxTB] + ':auto',
1851
+ ''
1852
+ ].join('!important;');
1853
+ el.appendChild(marker);
1854
+ markers.push(marker);
1855
+ }
1856
+
1857
+ return markers;
1858
+ }
1859
+
1860
+ function preparePointerTransformer(markers, saved, inverse) {
1861
+ var transformerName = inverse ? 'invTrans' : 'trans';
1862
+ var transformer = saved[transformerName];
1863
+ var oldSrcCoords = saved.srcCoords;
1864
+ var oldCoordTheSame = true;
1865
+ var srcCoords = [];
1866
+ var destCoords = [];
1867
+
1868
+ for (var i = 0; i < 4; i++) {
1869
+ var rect = markers[i].getBoundingClientRect();
1870
+ var ii = 2 * i;
1871
+ var x = rect.left;
1872
+ var y = rect.top;
1873
+ srcCoords.push(x, y);
1874
+ oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
1875
+ destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
1876
+ }
1877
+ // Cache to avoid time consuming of `buildTransformer`.
1878
+ return (oldCoordTheSame && transformer)
1879
+ ? transformer
1880
+ : (
1881
+ saved.srcCoords = srcCoords,
1882
+ saved[transformerName] = inverse
1883
+ ? buildTransformer(destCoords, srcCoords)
1884
+ : buildTransformer(srcCoords, destCoords)
1885
+ );
1886
+ }
1887
+
1888
+ function isCanvasEl(el) {
1889
+ return el.nodeName.toUpperCase() === 'CANVAS';
1890
+ }
1891
+
1739
1892
  /**
1740
1893
  * Utilities for mouse or touch events.
1741
1894
  */
@@ -1743,7 +1896,6 @@ function buildTransformer(src, dest) {
1743
1896
  var isDomLevel2 = (typeof window !== 'undefined') && !!window.addEventListener;
1744
1897
 
1745
1898
  var MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;
1746
- var EVENT_SAVED_PROP = '___zrEVENTSAVED';
1747
1899
  var _calcOut = [];
1748
1900
 
1749
1901
  /**
@@ -1808,11 +1960,11 @@ function clientToLocal(el, e, out, calculate) {
1808
1960
 
1809
1961
  function calculateZrXY(el, e, out) {
1810
1962
  // BlackBerry 5, iOS 3 (original iPhone) don't have getBoundingRect.
1811
- if (el.getBoundingClientRect && env$1.domSupported) {
1963
+ if (env$1.domSupported && el.getBoundingClientRect) {
1812
1964
  var ex = e.clientX;
1813
1965
  var ey = e.clientY;
1814
1966
 
1815
- if (el.nodeName.toUpperCase() === 'CANVAS') {
1967
+ if (isCanvasEl(el)) {
1816
1968
  // Original approach, which do not support CSS transform.
1817
1969
  // marker can not be locationed in a canvas container
1818
1970
  // (getBoundingClientRect is always 0). We do not support
@@ -1824,10 +1976,7 @@ function calculateZrXY(el, e, out) {
1824
1976
  return;
1825
1977
  }
1826
1978
  else {
1827
- var saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
1828
- var transformer = preparePointerTransformer(prepareCoordMarkers(el, saved), saved);
1829
- if (transformer) {
1830
- transformer(_calcOut, ex, ey);
1979
+ if (transformCoordWithViewport(_calcOut, el, ex, ey)) {
1831
1980
  out.zrX = _calcOut[0];
1832
1981
  out.zrY = _calcOut[1];
1833
1982
  return;
@@ -1837,70 +1986,6 @@ function calculateZrXY(el, e, out) {
1837
1986
  out.zrX = out.zrY = 0;
1838
1987
  }
1839
1988
 
1840
- function prepareCoordMarkers(el, saved) {
1841
- var markers = saved.markers;
1842
- if (markers) {
1843
- return markers;
1844
- }
1845
-
1846
- markers = saved.markers = [];
1847
- var propLR = ['left', 'right'];
1848
- var propTB = ['top', 'bottom'];
1849
-
1850
- for (var i = 0; i < 4; i++) {
1851
- var marker = document.createElement('div');
1852
- var stl = marker.style;
1853
- var idxLR = i % 2;
1854
- var idxTB = (i >> 1) % 2;
1855
- stl.cssText = [
1856
- 'position:absolute',
1857
- 'visibility: hidden',
1858
- 'padding: 0',
1859
- 'margin: 0',
1860
- 'border-width: 0',
1861
- 'width:0',
1862
- 'height:0',
1863
- // 'width: 5px',
1864
- // 'height: 5px',
1865
- propLR[idxLR] + ':0',
1866
- propTB[idxTB] + ':0',
1867
- propLR[1 - idxLR] + ':auto',
1868
- propTB[1 - idxTB] + ':auto',
1869
- ''
1870
- ].join('!important;');
1871
- el.appendChild(marker);
1872
- markers.push(marker);
1873
- }
1874
-
1875
- return markers;
1876
- }
1877
-
1878
- function preparePointerTransformer(markers, saved) {
1879
- var transformer = saved.transformer;
1880
- var oldSrcCoords = saved.srcCoords;
1881
- var useOld = true;
1882
- var srcCoords = [];
1883
- var destCoords = [];
1884
-
1885
- for (var i = 0; i < 4; i++) {
1886
- var rect = markers[i].getBoundingClientRect();
1887
- var ii = 2 * i;
1888
- var x = rect.left;
1889
- var y = rect.top;
1890
- srcCoords.push(x, y);
1891
- useOld &= oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
1892
- destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
1893
- }
1894
-
1895
- // Cache to avoid time consuming of `buildTransformer`.
1896
- return useOld
1897
- ? transformer
1898
- : (
1899
- saved.srcCoords = srcCoords,
1900
- saved.transformer = buildTransformer(srcCoords, destCoords)
1901
- );
1902
- }
1903
-
1904
1989
  /**
1905
1990
  * Find native event compat for legency IE.
1906
1991
  * Should be called at the begining of a native event listener.
@@ -4770,7 +4855,7 @@ var Animator = function (target, loop, getter, setter) {
4770
4855
 
4771
4856
  Animator.prototype = {
4772
4857
  /**
4773
- * 设置动画关键帧
4858
+ * Set Animation keyframe
4774
4859
  * @param {number} time 关键帧时间,单位是ms
4775
4860
  * @param {Object} props 关键帧的属性值,key-value表示
4776
4861
  * @return {module:zrender/animation/Animator}
@@ -4849,7 +4934,7 @@ Animator.prototype = {
4849
4934
  }
4850
4935
  },
4851
4936
  /**
4852
- * 开始执行动画
4937
+ * Start the animation
4853
4938
  * @param {string|Function} [easing]
4854
4939
  * 动画缓动函数,详见{@link module:zrender/animation/easing}
4855
4940
  * @param {boolean} forceAnimate
@@ -4910,7 +4995,7 @@ Animator.prototype = {
4910
4995
  return this;
4911
4996
  },
4912
4997
  /**
4913
- * 停止动画
4998
+ * Stop animation
4914
4999
  * @param {boolean} forwardToLast If move to last frame before stop
4915
5000
  */
4916
5001
  stop: function (forwardToLast) {
@@ -4927,7 +5012,7 @@ Animator.prototype = {
4927
5012
  clipList.length = 0;
4928
5013
  },
4929
5014
  /**
4930
- * 设置动画延迟开始的时间
5015
+ * Set when animation delay starts
4931
5016
  * @param {number} time 单位ms
4932
5017
  * @return {module:zrender/animation/Animator}
4933
5018
  */
@@ -4936,7 +5021,7 @@ Animator.prototype = {
4936
5021
  return this;
4937
5022
  },
4938
5023
  /**
4939
- * 添加动画结束的回调
5024
+ * Add callback for animation end
4940
5025
  * @param {Function} cb
4941
5026
  * @return {module:zrender/animation/Animator}
4942
5027
  */
@@ -4988,7 +5073,7 @@ if (debugMode === 1) {
4988
5073
  var logError$1 = logError;
4989
5074
 
4990
5075
  /**
4991
- * @alias modue:zrender/mixin/Animatable
5076
+ * @alias module:zrender/mixin/Animatable
4992
5077
  * @constructor
4993
5078
  */
4994
5079
  var Animatable = function () {
@@ -10666,7 +10751,7 @@ Painter.prototype = {
10666
10751
  };
10667
10752
 
10668
10753
  /**
10669
- * 动画主类, 调度和管理所有动画控制器
10754
+ * Animation main class, dispatch and manage all animation controllers
10670
10755
  *
10671
10756
  * @module zrender/animation/Animation
10672
10757
  * @author pissang(https://github.com/pissang)
@@ -10731,14 +10816,14 @@ Animation.prototype = {
10731
10816
 
10732
10817
  constructor: Animation,
10733
10818
  /**
10734
- * 添加 clip
10819
+ * Add clip
10735
10820
  * @param {module:zrender/animation/Clip} clip
10736
10821
  */
10737
10822
  addClip: function (clip) {
10738
10823
  this._clips.push(clip);
10739
10824
  },
10740
10825
  /**
10741
- * 添加 animator
10826
+ * Add animator
10742
10827
  * @param {module:zrender/animation/Animator} animator
10743
10828
  */
10744
10829
  addAnimator: function (animator) {
@@ -10749,7 +10834,7 @@ Animation.prototype = {
10749
10834
  }
10750
10835
  },
10751
10836
  /**
10752
- * 删除动画片段
10837
+ * Delete animation clip
10753
10838
  * @param {module:zrender/animation/Clip} clip
10754
10839
  */
10755
10840
  removeClip: function (clip) {
@@ -10760,7 +10845,7 @@ Animation.prototype = {
10760
10845
  },
10761
10846
 
10762
10847
  /**
10763
- * 删除动画片段
10848
+ * Delete animation clip
10764
10849
  * @param {module:zrender/animation/Animator} animator
10765
10850
  */
10766
10851
  removeAnimator: function (animator) {
@@ -11027,13 +11112,16 @@ function normalizeGlobalEvent(instance, event) {
11027
11112
  * Detect whether the given el is in `painterRoot`.
11028
11113
  */
11029
11114
  function isLocalEl(instance, el) {
11115
+ var elTmp = el;
11030
11116
  var isLocal = false;
11031
- do {
11032
- el = el && el.parentNode;
11117
+ while (elTmp && elTmp.nodeType !== 9
11118
+ && !(
11119
+ isLocal = elTmp.domBelongToZr
11120
+ || (elTmp !== el && elTmp === instance.painterRoot)
11121
+ )
11122
+ ) {
11123
+ elTmp = elTmp.parentNode;
11033
11124
  }
11034
- while (el && el.nodeType !== 9 && !(
11035
- isLocal = el === instance.painterRoot
11036
- ));
11037
11125
  return isLocal;
11038
11126
  }
11039
11127
 
@@ -11488,7 +11576,7 @@ var instances$1 = {}; // ZRender实例map索引
11488
11576
  /**
11489
11577
  * @type {string}
11490
11578
  */
11491
- var version$1 = '4.2.0';
11579
+ var version$1 = '4.3.0';
11492
11580
 
11493
11581
  /**
11494
11582
  * Initializing a zrender instance
@@ -16433,12 +16521,10 @@ var round = Math.round;
16433
16521
  * @param {number} [inputShape.x2]
16434
16522
  * @param {number} [inputShape.y2]
16435
16523
  * @param {Object} [style]
16436
- * @param {number} [style.lineWidth]
16524
+ * @param {number} [style.lineWidth] If `null`/`undefined`/`0`, do not optimize.
16437
16525
  */
16438
16526
  function subPixelOptimizeLine$1(outputShape, inputShape, style) {
16439
- var lineWidth = style && style.lineWidth;
16440
-
16441
- if (!inputShape || !lineWidth) {
16527
+ if (!inputShape) {
16442
16528
  return;
16443
16529
  }
16444
16530
 
@@ -16447,20 +16533,22 @@ function subPixelOptimizeLine$1(outputShape, inputShape, style) {
16447
16533
  var y1 = inputShape.y1;
16448
16534
  var y2 = inputShape.y2;
16449
16535
 
16536
+ outputShape.x1 = x1;
16537
+ outputShape.x2 = x2;
16538
+ outputShape.y1 = y1;
16539
+ outputShape.y2 = y2;
16540
+
16541
+ var lineWidth = style && style.lineWidth;
16542
+ if (!lineWidth) {
16543
+ return;
16544
+ }
16545
+
16450
16546
  if (round(x1 * 2) === round(x2 * 2)) {
16451
16547
  outputShape.x1 = outputShape.x2 = subPixelOptimize$1(x1, lineWidth, true);
16452
16548
  }
16453
- else {
16454
- outputShape.x1 = x1;
16455
- outputShape.x2 = x2;
16456
- }
16457
16549
  if (round(y1 * 2) === round(y2 * 2)) {
16458
16550
  outputShape.y1 = outputShape.y2 = subPixelOptimize$1(y1, lineWidth, true);
16459
16551
  }
16460
- else {
16461
- outputShape.y1 = y1;
16462
- outputShape.y2 = y2;
16463
- }
16464
16552
  }
16465
16553
 
16466
16554
  /**
@@ -16476,12 +16564,10 @@ function subPixelOptimizeLine$1(outputShape, inputShape, style) {
16476
16564
  * @param {number} [inputShape.width]
16477
16565
  * @param {number} [inputShape.height]
16478
16566
  * @param {Object} [style]
16479
- * @param {number} [style.lineWidth]
16567
+ * @param {number} [style.lineWidth] If `null`/`undefined`/`0`, do not optimize.
16480
16568
  */
16481
16569
  function subPixelOptimizeRect$1(outputShape, inputShape, style) {
16482
- var lineWidth = style && style.lineWidth;
16483
-
16484
- if (!inputShape || !lineWidth) {
16570
+ if (!inputShape) {
16485
16571
  return;
16486
16572
  }
16487
16573
 
@@ -16490,6 +16576,16 @@ function subPixelOptimizeRect$1(outputShape, inputShape, style) {
16490
16576
  var originWidth = inputShape.width;
16491
16577
  var originHeight = inputShape.height;
16492
16578
 
16579
+ outputShape.x = originX;
16580
+ outputShape.y = originY;
16581
+ outputShape.width = originWidth;
16582
+ outputShape.height = originHeight;
16583
+
16584
+ var lineWidth = style && style.lineWidth;
16585
+ if (!lineWidth) {
16586
+ return;
16587
+ }
16588
+
16493
16589
  outputShape.x = subPixelOptimize$1(originX, lineWidth, true);
16494
16590
  outputShape.y = subPixelOptimize$1(originY, lineWidth, true);
16495
16591
  outputShape.width = Math.max(
@@ -16506,11 +16602,14 @@ function subPixelOptimizeRect$1(outputShape, inputShape, style) {
16506
16602
  * Sub pixel optimize for canvas
16507
16603
  *
16508
16604
  * @param {number} position Coordinate, such as x, y
16509
- * @param {number} lineWidth Should be nonnegative integer.
16605
+ * @param {number} lineWidth If `null`/`undefined`/`0`, do not optimize.
16510
16606
  * @param {boolean=} positiveOrNegative Default false (negative).
16511
16607
  * @return {number} Optimized position.
16512
16608
  */
16513
16609
  function subPixelOptimize$1(position, lineWidth, positiveOrNegative) {
16610
+ if (!lineWidth) {
16611
+ return position;
16612
+ }
16514
16613
  // Assure that (position + lineWidth / 2) is near integer edge,
16515
16614
  // otherwise line will be fuzzy in canvas.
16516
16615
  var doubledPosition = round(position * 2);
@@ -18211,7 +18310,7 @@ function animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, cb)
18211
18310
  * configuration in series.
18212
18311
  *
18213
18312
  * Caution: this method will stop previous animation.
18214
- * So if do not use this method to one element twice before
18313
+ * So do not use this method to one element twice before
18215
18314
  * animation starts, unless you know what you are doing.
18216
18315
  *
18217
18316
  * @param {module:zrender/Element} el
@@ -18237,7 +18336,7 @@ function updateProps(el, props, animatableModel, dataIndex, cb) {
18237
18336
  * configuration in series.
18238
18337
  *
18239
18338
  * Caution: this method will stop previous animation.
18240
- * So if do not use this method to one element twice before
18339
+ * So do not use this method to one element twice before
18241
18340
  * animation starts, unless you know what you are doing.
18242
18341
  *
18243
18342
  * @param {module:zrender/Element} el
@@ -25098,8 +25197,11 @@ var createRenderPlanner = function () {
25098
25197
  var originalLarge = fields.large;
25099
25198
  var originalProgressive = fields.progressiveRender;
25100
25199
 
25101
- var large = fields.large = pipelineContext.large;
25102
- var progressive = fields.progressiveRender = pipelineContext.progressiveRender;
25200
+ // FIXME: if the planner works on a filtered series, `pipelineContext` does not
25201
+ // exists. See #11611 . Probably we need to modify this structure, see the comment
25202
+ // on `performRawSeries` in `Schedular.js`.
25203
+ var large = fields.large = pipelineContext && pipelineContext.large;
25204
+ var progressive = fields.progressiveRender = pipelineContext && pipelineContext.progressiveRender;
25103
25205
 
25104
25206
  return !!((originalLarge ^ large) || (originalProgressive ^ progressive)) && 'reset';
25105
25207
  };
@@ -26248,6 +26350,14 @@ function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
26248
26350
  task.dirty();
26249
26351
  }
26250
26352
  var performArgs = scheduler.getPerformArgs(task, opt.block);
26353
+ // FIXME
26354
+ // if intending to decalare `performRawSeries` in handlers, only
26355
+ // stream-independent (specifically, data item independent) operations can be
26356
+ // performed. Because is a series is filtered, most of the tasks will not
26357
+ // be performed. A stream-dependent operation probably cause wrong biz logic.
26358
+ // Perhaps we should not provide a separate callback for this case instead
26359
+ // of providing the config `performRawSeries`. The stream-dependent operaions
26360
+ // and stream-independent operations should better not be mixed.
26251
26361
  performArgs.skip = !stageHandler.performRawSeries
26252
26362
  && ecModel.isSeriesFiltered(task.context.model);
26253
26363
  updatePayload(task, payload);
@@ -27626,10 +27736,10 @@ var isFunction = isFunction$1;
27626
27736
  var isObject = isObject$1;
27627
27737
  var parseClassType = ComponentModel.parseClassType;
27628
27738
 
27629
- var version = '4.6.0';
27739
+ var version = '4.7.0';
27630
27740
 
27631
27741
  var dependencies = {
27632
- zrender: '4.2.0'
27742
+ zrender: '4.3.0'
27633
27743
  };
27634
27744
 
27635
27745
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -33914,7 +34024,7 @@ var IntervalScale = Scale.extend({
33914
34024
 
33915
34025
  if (extent[0] < niceTickExtent[0]) {
33916
34026
  if (expandToNicedExtent) {
33917
- ticks.push(roundNumber(niceTickExtent[0] - interval));
34027
+ ticks.push(roundNumber(niceTickExtent[0] - interval, intervalPrecision));
33918
34028
  }
33919
34029
  else {
33920
34030
  ticks.push(extent[0]);
@@ -33940,7 +34050,7 @@ var IntervalScale = Scale.extend({
33940
34050
  var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
33941
34051
  if (extent[1] > lastNiceTick) {
33942
34052
  if (expandToNicedExtent) {
33943
- ticks.push(lastNiceTick + interval);
34053
+ ticks.push(roundNumber(lastNiceTick + interval, intervalPrecision));
33944
34054
  }
33945
34055
  else {
33946
34056
  ticks.push(extent[1]);
@@ -34515,11 +34625,6 @@ function layout(seriesType, ecModel) {
34515
34625
  var value = data.get(valueDim, idx);
34516
34626
  var baseValue = data.get(baseDim, idx);
34517
34627
 
34518
- // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
34519
- if (isNaN(value) || isNaN(baseValue)) {
34520
- continue;
34521
- }
34522
-
34523
34628
  var sign = value >= 0 ? 'p' : 'n';
34524
34629
  var baseCoord = valueAxisStart;
34525
34630
 
@@ -34552,7 +34657,10 @@ function layout(seriesType, ecModel) {
34552
34657
  if (Math.abs(width) < barMinHeight) {
34553
34658
  width = (width < 0 ? -1 : 1) * barMinHeight;
34554
34659
  }
34555
- stacked && (lastStackCoords[stackId][baseValue][sign] += width);
34660
+ // Ignore stack from NaN value
34661
+ if (!isNaN(width)) {
34662
+ stacked && (lastStackCoords[stackId][baseValue][sign] += width);
34663
+ }
34556
34664
  }
34557
34665
  else {
34558
34666
  var coord = cartesian.dataToPoint([baseValue, value]);
@@ -34565,7 +34673,10 @@ function layout(seriesType, ecModel) {
34565
34673
  // Include zero to has a positive bar
34566
34674
  height = (height <= 0 ? -1 : 1) * barMinHeight;
34567
34675
  }
34568
- stacked && (lastStackCoords[stackId][baseValue][sign] += height);
34676
+ // Ignore stack from NaN value
34677
+ if (!isNaN(height)) {
34678
+ stacked && (lastStackCoords[stackId][baseValue][sign] += height);
34679
+ }
34569
34680
  }
34570
34681
 
34571
34682
  data.setItemLayout(idx, {
@@ -34593,6 +34704,7 @@ var largeLayout = {
34593
34704
 
34594
34705
  var data = seriesModel.getData();
34595
34706
  var cartesian = seriesModel.coordinateSystem;
34707
+ var coordLayout = cartesian.grid.getRect();
34596
34708
  var baseAxis = cartesian.getBaseAxis();
34597
34709
  var valueAxis = cartesian.getOtherAxis(baseAxis);
34598
34710
  var valueDim = data.mapDimension(valueAxis.dim);
@@ -34612,6 +34724,7 @@ var largeLayout = {
34612
34724
  function progress(params, data) {
34613
34725
  var count = params.count;
34614
34726
  var largePoints = new LargeArr(count * 2);
34727
+ var largeBackgroundPoints = new LargeArr(count * 2);
34615
34728
  var largeDataIndices = new LargeArr(count);
34616
34729
  var dataIndex;
34617
34730
  var coord = [];
@@ -34625,7 +34738,9 @@ var largeLayout = {
34625
34738
 
34626
34739
  coord = cartesian.dataToPoint(valuePair, null, coord);
34627
34740
  // Data index might not be in order, depends on `progressiveChunkMode`.
34741
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
34628
34742
  largePoints[pointsOffset++] = coord[0];
34743
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
34629
34744
  largePoints[pointsOffset++] = coord[1];
34630
34745
  largeDataIndices[idxOffset++] = dataIndex;
34631
34746
  }
@@ -34633,8 +34748,10 @@ var largeLayout = {
34633
34748
  data.setLayout({
34634
34749
  largePoints: largePoints,
34635
34750
  largeDataIndices: largeDataIndices,
34751
+ largeBackgroundPoints: largeBackgroundPoints,
34636
34752
  barWidth: barWidth,
34637
34753
  valueAxisStart: getValueAxisStart(baseAxis, valueAxis, false),
34754
+ backgroundStart: valueAxisHorizontal ? coordLayout.x : coordLayout.y,
34638
34755
  valueAxisHorizontal: valueAxisHorizontal
34639
34756
  });
34640
34757
  }
@@ -42521,6 +42638,117 @@ function layout$1(gridModel, axisModel, opt) {
42521
42638
  * under the License.
42522
42639
  */
42523
42640
 
42641
+ function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
42642
+ var axis = axisModel.axis;
42643
+
42644
+ if (axis.scale.isBlank()) {
42645
+ return;
42646
+ }
42647
+
42648
+ var splitAreaModel = axisModel.getModel('splitArea');
42649
+ var areaStyleModel = splitAreaModel.getModel('areaStyle');
42650
+ var areaColors = areaStyleModel.get('color');
42651
+
42652
+ var gridRect = gridModel.coordinateSystem.getRect();
42653
+
42654
+ var ticksCoords = axis.getTicksCoords({
42655
+ tickModel: splitAreaModel,
42656
+ clamp: true
42657
+ });
42658
+
42659
+ if (!ticksCoords.length) {
42660
+ return;
42661
+ }
42662
+
42663
+ // For Making appropriate splitArea animation, the color and anid
42664
+ // should be corresponding to previous one if possible.
42665
+ var areaColorsLen = areaColors.length;
42666
+ var lastSplitAreaColors = axisView.__splitAreaColors;
42667
+ var newSplitAreaColors = createHashMap();
42668
+ var colorIndex = 0;
42669
+ if (lastSplitAreaColors) {
42670
+ for (var i = 0; i < ticksCoords.length; i++) {
42671
+ var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
42672
+ if (cIndex != null) {
42673
+ colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
42674
+ break;
42675
+ }
42676
+ }
42677
+ }
42678
+
42679
+ var prev = axis.toGlobalCoord(ticksCoords[0].coord);
42680
+
42681
+ var areaStyle = areaStyleModel.getAreaStyle();
42682
+ areaColors = isArray(areaColors) ? areaColors : [areaColors];
42683
+
42684
+ for (var i = 1; i < ticksCoords.length; i++) {
42685
+ var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
42686
+
42687
+ var x;
42688
+ var y;
42689
+ var width;
42690
+ var height;
42691
+ if (axis.isHorizontal()) {
42692
+ x = prev;
42693
+ y = gridRect.y;
42694
+ width = tickCoord - x;
42695
+ height = gridRect.height;
42696
+ prev = x + width;
42697
+ }
42698
+ else {
42699
+ x = gridRect.x;
42700
+ y = prev;
42701
+ width = gridRect.width;
42702
+ height = tickCoord - y;
42703
+ prev = y + height;
42704
+ }
42705
+
42706
+ var tickValue = ticksCoords[i - 1].tickValue;
42707
+ tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
42708
+
42709
+ axisGroup.add(new Rect({
42710
+ anid: tickValue != null ? 'area_' + tickValue : null,
42711
+ shape: {
42712
+ x: x,
42713
+ y: y,
42714
+ width: width,
42715
+ height: height
42716
+ },
42717
+ style: defaults({
42718
+ fill: areaColors[colorIndex]
42719
+ }, areaStyle),
42720
+ silent: true
42721
+ }));
42722
+
42723
+ colorIndex = (colorIndex + 1) % areaColorsLen;
42724
+ }
42725
+
42726
+ axisView.__splitAreaColors = newSplitAreaColors;
42727
+ }
42728
+
42729
+ function rectCoordAxisHandleRemove(axisView) {
42730
+ axisView.__splitAreaColors = null;
42731
+ }
42732
+
42733
+ /*
42734
+ * Licensed to the Apache Software Foundation (ASF) under one
42735
+ * or more contributor license agreements. See the NOTICE file
42736
+ * distributed with this work for additional information
42737
+ * regarding copyright ownership. The ASF licenses this file
42738
+ * to you under the Apache License, Version 2.0 (the
42739
+ * "License"); you may not use this file except in compliance
42740
+ * with the License. You may obtain a copy of the License at
42741
+ *
42742
+ * http://www.apache.org/licenses/LICENSE-2.0
42743
+ *
42744
+ * Unless required by applicable law or agreed to in writing,
42745
+ * software distributed under the License is distributed on an
42746
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
42747
+ * KIND, either express or implied. See the License for the
42748
+ * specific language governing permissions and limitations
42749
+ * under the License.
42750
+ */
42751
+
42524
42752
  var axisBuilderAttrs = [
42525
42753
  'axisLine', 'axisTickLabel', 'axisName'
42526
42754
  ];
@@ -42572,7 +42800,7 @@ var CartesianAxisView = AxisView.extend({
42572
42800
  },
42573
42801
 
42574
42802
  remove: function () {
42575
- this._splitAreaColors = null;
42803
+ rectCoordAxisHandleRemove(this);
42576
42804
  },
42577
42805
 
42578
42806
  /**
@@ -42704,91 +42932,7 @@ var CartesianAxisView = AxisView.extend({
42704
42932
  * @private
42705
42933
  */
42706
42934
  _splitArea: function (axisModel, gridModel) {
42707
- var axis = axisModel.axis;
42708
-
42709
- if (axis.scale.isBlank()) {
42710
- return;
42711
- }
42712
-
42713
- var splitAreaModel = axisModel.getModel('splitArea');
42714
- var areaStyleModel = splitAreaModel.getModel('areaStyle');
42715
- var areaColors = areaStyleModel.get('color');
42716
-
42717
- var gridRect = gridModel.coordinateSystem.getRect();
42718
-
42719
- var ticksCoords = axis.getTicksCoords({
42720
- tickModel: splitAreaModel,
42721
- clamp: true
42722
- });
42723
-
42724
- if (!ticksCoords.length) {
42725
- return;
42726
- }
42727
-
42728
- // For Making appropriate splitArea animation, the color and anid
42729
- // should be corresponding to previous one if possible.
42730
- var areaColorsLen = areaColors.length;
42731
- var lastSplitAreaColors = this._splitAreaColors;
42732
- var newSplitAreaColors = createHashMap();
42733
- var colorIndex = 0;
42734
- if (lastSplitAreaColors) {
42735
- for (var i = 0; i < ticksCoords.length; i++) {
42736
- var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
42737
- if (cIndex != null) {
42738
- colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
42739
- break;
42740
- }
42741
- }
42742
- }
42743
-
42744
- var prev = axis.toGlobalCoord(ticksCoords[0].coord);
42745
-
42746
- var areaStyle = areaStyleModel.getAreaStyle();
42747
- areaColors = isArray(areaColors) ? areaColors : [areaColors];
42748
-
42749
- for (var i = 1; i < ticksCoords.length; i++) {
42750
- var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
42751
-
42752
- var x;
42753
- var y;
42754
- var width;
42755
- var height;
42756
- if (axis.isHorizontal()) {
42757
- x = prev;
42758
- y = gridRect.y;
42759
- width = tickCoord - x;
42760
- height = gridRect.height;
42761
- prev = x + width;
42762
- }
42763
- else {
42764
- x = gridRect.x;
42765
- y = prev;
42766
- width = gridRect.width;
42767
- height = tickCoord - y;
42768
- prev = y + height;
42769
- }
42770
-
42771
- var tickValue = ticksCoords[i - 1].tickValue;
42772
- tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
42773
-
42774
- this._axisGroup.add(new Rect({
42775
- anid: tickValue != null ? 'area_' + tickValue : null,
42776
- shape: {
42777
- x: x,
42778
- y: y,
42779
- width: width,
42780
- height: height
42781
- },
42782
- style: defaults({
42783
- fill: areaColors[colorIndex]
42784
- }, areaStyle),
42785
- silent: true
42786
- }));
42787
-
42788
- colorIndex = (colorIndex + 1) % areaColorsLen;
42789
- }
42790
-
42791
- this._splitAreaColors = newSplitAreaColors;
42935
+ rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, gridModel);
42792
42936
  }
42793
42937
  });
42794
42938
 
@@ -43034,7 +43178,21 @@ BaseBarSeries.extend({
43034
43178
 
43035
43179
  // If use caps on two sides of bars
43036
43180
  // Only available on tangential polar bar
43037
- roundCap: false
43181
+ roundCap: false,
43182
+
43183
+ showBackground: false,
43184
+ backgroundStyle: {
43185
+ color: 'rgba(180, 180, 180, 0.2)',
43186
+ borderColor: null,
43187
+ borderWidth: 0,
43188
+ borderType: 'solid',
43189
+ borderRadius: 0,
43190
+ shadowBlur: 0,
43191
+ shadowColor: null,
43192
+ shadowOffsetX: 0,
43193
+ shadowOffsetY: 0,
43194
+ opacity: 1
43195
+ }
43038
43196
  }
43039
43197
  });
43040
43198
 
@@ -43339,15 +43497,28 @@ extendChartView({
43339
43497
 
43340
43498
  var roundCap = seriesModel.get('roundCap', true);
43341
43499
 
43500
+ var drawBackground = seriesModel.get('showBackground', true);
43501
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
43502
+
43503
+ var bgEls = [];
43504
+ var oldBgEls = this._backgroundEls || [];
43505
+
43342
43506
  data.diff(oldData)
43343
43507
  .add(function (dataIndex) {
43508
+ var itemModel = data.getItemModel(dataIndex);
43509
+ var layout = getLayout[coord.type](data, dataIndex, itemModel);
43510
+
43511
+ if (drawBackground) {
43512
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
43513
+ bgEl.useStyle(backgroundModel.getBarItemStyle());
43514
+ bgEls[dataIndex] = bgEl;
43515
+ }
43516
+
43517
+ // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
43344
43518
  if (!data.hasValue(dataIndex)) {
43345
43519
  return;
43346
43520
  }
43347
43521
 
43348
- var itemModel = data.getItemModel(dataIndex);
43349
- var layout = getLayout[coord.type](data, dataIndex, itemModel);
43350
-
43351
43522
  if (needsClip) {
43352
43523
  // Clip will modify the layout params.
43353
43524
  // And return a boolean to determine if the shape are fully clipped.
@@ -43370,16 +43541,24 @@ extendChartView({
43370
43541
  );
43371
43542
  })
43372
43543
  .update(function (newIndex, oldIndex) {
43373
- var el = oldData.getItemGraphicEl(oldIndex);
43544
+ var itemModel = data.getItemModel(newIndex);
43545
+ var layout = getLayout[coord.type](data, newIndex, itemModel);
43546
+
43547
+ if (drawBackground) {
43548
+ var bgEl = oldBgEls[oldIndex];
43549
+ bgEl.useStyle(backgroundModel.getBarItemStyle());
43550
+ bgEls[newIndex] = bgEl;
43374
43551
 
43552
+ var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
43553
+ updateProps(bgEl, { shape: shape }, animationModel, newIndex);
43554
+ }
43555
+
43556
+ var el = oldData.getItemGraphicEl(oldIndex);
43375
43557
  if (!data.hasValue(newIndex)) {
43376
43558
  group.remove(el);
43377
43559
  return;
43378
43560
  }
43379
43561
 
43380
- var itemModel = data.getItemModel(newIndex);
43381
- var layout = getLayout[coord.type](data, newIndex, itemModel);
43382
-
43383
43562
  if (needsClip) {
43384
43563
  var isClipped = clip[coord.type](coordSysClipArea, layout);
43385
43564
  if (isClipped) {
@@ -43417,6 +43596,15 @@ extendChartView({
43417
43596
  })
43418
43597
  .execute();
43419
43598
 
43599
+ var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());
43600
+ bgGroup.removeAll();
43601
+
43602
+ for (var i = 0; i < bgEls.length; ++i) {
43603
+ bgGroup.add(bgEls[i]);
43604
+ }
43605
+ group.add(bgGroup);
43606
+ this._backgroundEls = bgEls;
43607
+
43420
43608
  this._data = data;
43421
43609
  },
43422
43610
 
@@ -43437,6 +43625,7 @@ extendChartView({
43437
43625
  },
43438
43626
 
43439
43627
  _incrementalRenderLarge: function (params, seriesModel) {
43628
+ this._removeBackground();
43440
43629
  createLarge(seriesModel, this.group, true);
43441
43630
  },
43442
43631
 
@@ -43450,6 +43639,9 @@ extendChartView({
43450
43639
  var group = this.group;
43451
43640
  var data = this._data;
43452
43641
  if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
43642
+ this._removeBackground();
43643
+ this._backgroundEls = [];
43644
+
43453
43645
  data.eachItemGraphicEl(function (el) {
43454
43646
  if (el.type === 'sector') {
43455
43647
  removeSector(el.dataIndex, ecModel, el);
@@ -43463,6 +43655,11 @@ extendChartView({
43463
43655
  group.removeAll();
43464
43656
  }
43465
43657
  this._data = null;
43658
+ },
43659
+
43660
+ _removeBackground: function () {
43661
+ this.group.remove(this._backgroundGroup);
43662
+ this._backgroundGroup = null;
43466
43663
  }
43467
43664
 
43468
43665
  });
@@ -43520,7 +43717,12 @@ var elementCreator = {
43520
43717
  dataIndex, layout, isHorizontal,
43521
43718
  animationModel, isUpdate
43522
43719
  ) {
43523
- var rect = new Rect({shape: extend({}, layout)});
43720
+ var rect = new Rect({
43721
+ shape: extend({}, layout),
43722
+ z2: 1
43723
+ });
43724
+
43725
+ rect.name = 'item';
43524
43726
 
43525
43727
  // Animation
43526
43728
  if (animationModel) {
@@ -43550,9 +43752,12 @@ var elementCreator = {
43550
43752
  var ShapeClass = (!isRadial && roundCap) ? Sausage : Sector;
43551
43753
 
43552
43754
  var sector = new ShapeClass({
43553
- shape: defaults({clockwise: clockwise}, layout)
43755
+ shape: defaults({clockwise: clockwise}, layout),
43756
+ z2: 1
43554
43757
  });
43555
43758
 
43759
+ sector.name = 'item';
43760
+
43556
43761
  // Animation
43557
43762
  if (animationModel) {
43558
43763
  var sectorShape = sector.shape;
@@ -43672,7 +43877,10 @@ function updateStyle(
43672
43877
  // In case width or height are too small.
43673
43878
  function getLineWidth(itemModel, rawLayout) {
43674
43879
  var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
43675
- return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height));
43880
+ // width or height may be NaN for empty data
43881
+ var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
43882
+ var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
43883
+ return Math.min(lineWidth, width, height);
43676
43884
  }
43677
43885
 
43678
43886
 
@@ -43704,13 +43912,38 @@ function createLarge(seriesModel, group, incremental) {
43704
43912
  var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
43705
43913
  startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart');
43706
43914
 
43915
+ var largeDataIndices = data.getLayout('largeDataIndices');
43916
+ var barWidth = data.getLayout('barWidth');
43917
+
43918
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
43919
+ var drawBackground = seriesModel.get('showBackground', true);
43920
+
43921
+ if (drawBackground) {
43922
+ var points = data.getLayout('largeBackgroundPoints');
43923
+ var backgroundStartPoint = [];
43924
+ backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart');
43925
+
43926
+ var bgEl = new LargePath({
43927
+ shape: {points: points},
43928
+ incremental: !!incremental,
43929
+ __startPoint: backgroundStartPoint,
43930
+ __baseDimIdx: baseDimIdx,
43931
+ __largeDataIndices: largeDataIndices,
43932
+ __barWidth: barWidth,
43933
+ silent: true,
43934
+ z2: 0
43935
+ });
43936
+ setLargeBackgroundStyle(bgEl, backgroundModel, data);
43937
+ group.add(bgEl);
43938
+ }
43939
+
43707
43940
  var el = new LargePath({
43708
43941
  shape: {points: data.getLayout('largePoints')},
43709
43942
  incremental: !!incremental,
43710
43943
  __startPoint: startPoint,
43711
43944
  __baseDimIdx: baseDimIdx,
43712
- __largeDataIndices: data.getLayout('largeDataIndices'),
43713
- __barWidth: data.getLayout('barWidth')
43945
+ __largeDataIndices: largeDataIndices,
43946
+ __barWidth: barWidth
43714
43947
  });
43715
43948
  group.add(el);
43716
43949
  setLargeStyle(el, seriesModel, data);
@@ -43775,6 +44008,55 @@ function setLargeStyle(el, seriesModel, data) {
43775
44008
  el.style.lineWidth = data.getLayout('barWidth');
43776
44009
  }
43777
44010
 
44011
+ function setLargeBackgroundStyle(el, backgroundModel, data) {
44012
+ var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color');
44013
+ var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']);
44014
+
44015
+ el.useStyle(itemStyle);
44016
+ el.style.fill = null;
44017
+ el.style.stroke = borderColor;
44018
+ el.style.lineWidth = data.getLayout('barWidth');
44019
+ }
44020
+
44021
+ function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
44022
+ var coordLayout;
44023
+ var isPolar = coord.type === 'polar';
44024
+ if (isPolar) {
44025
+ coordLayout = coord.getArea();
44026
+ }
44027
+ else {
44028
+ coordLayout = coord.grid.getRect();
44029
+ }
44030
+
44031
+ if (isPolar) {
44032
+ return {
44033
+ cx: coordLayout.cx,
44034
+ cy: coordLayout.cy,
44035
+ r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0,
44036
+ r: isHorizontalOrRadial ? coordLayout.r : layout.r,
44037
+ startAngle: isHorizontalOrRadial ? layout.startAngle : 0,
44038
+ endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2
44039
+ };
44040
+ }
44041
+ else {
44042
+ return {
44043
+ x: isHorizontalOrRadial ? layout.x : coordLayout.x,
44044
+ y: isHorizontalOrRadial ? coordLayout.y : layout.y,
44045
+ width: isHorizontalOrRadial ? layout.width : coordLayout.width,
44046
+ height: isHorizontalOrRadial ? coordLayout.height : layout.height
44047
+ };
44048
+ }
44049
+ }
44050
+
44051
+ function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
44052
+ var ElementClz = coord.type === 'polar' ? Sector : Rect;
44053
+ return new ElementClz({
44054
+ shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
44055
+ silent: true,
44056
+ z2: 0
44057
+ });
44058
+ }
44059
+
43778
44060
  /*
43779
44061
  * Licensed to the Apache Software Foundation (ASF) under one
43780
44062
  * or more contributor license agreements. See the NOTICE file
@@ -44384,7 +44666,7 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
44384
44666
  toggleItemSelected(
44385
44667
  this,
44386
44668
  data.getItemLayout(idx),
44387
- seriesModel.isSelected(null, idx),
44669
+ seriesModel.isSelected(data.getName(idx)),
44388
44670
  seriesModel.get('selectedOffset'),
44389
44671
  seriesModel.get('animation')
44390
44672
  );
@@ -45136,7 +45418,7 @@ var labelLayout = function (seriesModel, r, viewWidth, viewHeight, viewLeft, vie
45136
45418
  inside: isLabelInside,
45137
45419
  labelDistance: labelDistance,
45138
45420
  labelAlignTo: labelAlignTo,
45139
- labelMargin:labelMargin,
45421
+ labelMargin: labelMargin,
45140
45422
  bleedMargin: bleedMargin,
45141
45423
  textRect: textRect,
45142
45424
  text: text,
@@ -46179,6 +46461,7 @@ Radar.prototype.update = function (ecModel, api) {
46179
46461
  var fixedMax = axisModel.getMax();
46180
46462
  var interval = scale.getInterval();
46181
46463
 
46464
+
46182
46465
  if (fixedMin != null && fixedMax != null) {
46183
46466
  // User set min, max, divide to get new interval
46184
46467
  scale.setExtent(+fixedMin, +fixedMax);
@@ -46214,13 +46497,10 @@ Radar.prototype.update = function (ecModel, api) {
46214
46497
  if (nicedSplitNumber > splitNumber) {
46215
46498
  interval = increaseInterval(interval);
46216
46499
  }
46217
- // PENDING
46218
- var center = Math.round((rawExtent[0] + rawExtent[1]) / 2 / interval) * interval;
46219
- var halfSplitNumber = Math.round(splitNumber / 2);
46220
- scale.setExtent(
46221
- round$1(center - halfSplitNumber * interval),
46222
- round$1(center + (splitNumber - halfSplitNumber) * interval)
46223
- );
46500
+ // TODO
46501
+ var max = Math.ceil(rawExtent[1] / interval) * interval;
46502
+ var min = round$1(max - interval * splitNumber);
46503
+ scale.setExtent(min, max);
46224
46504
  scale.setInterval(interval);
46225
46505
  }
46226
46506
  });
@@ -46668,6 +46948,28 @@ var RadarSeries = SeriesModel.extend({
46668
46948
  }).join('<br />');
46669
46949
  },
46670
46950
 
46951
+ /**
46952
+ * @implement
46953
+ */
46954
+ getTooltipPosition: function (dataIndex) {
46955
+ if (dataIndex != null) {
46956
+ var data = this.getData();
46957
+ var coordSys = this.coordinateSystem;
46958
+ var values = data.getValues(
46959
+ map(coordSys.dimensions, function (dim) {
46960
+ return data.mapDimension(dim);
46961
+ }), dataIndex, true
46962
+ );
46963
+
46964
+ for (var i = 0, len = values.length; i < len; i++) {
46965
+ if (!isNaN(values[i])) {
46966
+ var indicatorAxes = coordSys.getIndicatorAxes();
46967
+ return coordSys.coordToPoint(indicatorAxes[i].dataToCoord(values[i]), i);
46968
+ }
46969
+ }
46970
+ }
46971
+ },
46972
+
46671
46973
  defaultOption: {
46672
46974
  zlevel: 0,
46673
46975
  z: 2,
@@ -48442,13 +48744,13 @@ MapDraw.prototype = {
48442
48744
  var regionsGroup = this._regionsGroup;
48443
48745
  var group = this.group;
48444
48746
 
48445
- if (geo._roamTransformable.transform) {
48446
- group.transform = geo._roamTransformable.transform.slice();
48447
- group.decomposeTransform();
48448
- }
48747
+ var transformInfo = geo.getTransformInfo();
48748
+ group.transform = transformInfo.roamTransform;
48749
+ group.decomposeTransform();
48750
+ group.dirty();
48449
48751
 
48450
- var scale = geo._rawTransformable.scale;
48451
- var position = geo._rawTransformable.position;
48752
+ var scale = transformInfo.rawScale;
48753
+ var position = transformInfo.rawPosition;
48452
48754
 
48453
48755
  regionsGroup.removeAll();
48454
48756
 
@@ -49254,7 +49556,6 @@ View.prototype = {
49254
49556
  /**
49255
49557
  * Remove roam
49256
49558
  */
49257
-
49258
49559
  _updateCenterAndZoom: function () {
49259
49560
  // Must update after view transform updated
49260
49561
  var rawTransformMatrix = this._rawTransformable.getLocalTransform();
@@ -49298,6 +49599,16 @@ View.prototype = {
49298
49599
  this.decomposeTransform();
49299
49600
  },
49300
49601
 
49602
+ getTransformInfo: function () {
49603
+ var roamTransform = this._roamTransformable.transform;
49604
+ var rawTransformable = this._rawTransformable;
49605
+ return {
49606
+ roamTransform: roamTransform ? slice(roamTransform) : create$1(),
49607
+ rawScale: slice(rawTransformable.scale),
49608
+ rawPosition: slice(rawTransformable.position)
49609
+ };
49610
+ },
49611
+
49301
49612
  /**
49302
49613
  * @return {module:zrender/core/BoundingRect}
49303
49614
  */
@@ -50914,6 +51225,11 @@ SeriesModel.extend({
50914
51225
  // the layout of the tree, two value can be selected, 'orthogonal' or 'radial'
50915
51226
  layout: 'orthogonal',
50916
51227
 
51228
+ // value can be 'polyline'
51229
+ edgeShape: 'curve',
51230
+
51231
+ edgeForkPosition: '50%',
51232
+
50917
51233
  // true | false | 'move' | 'scale', see module:component/helper/RoamController.
50918
51234
  roam: false,
50919
51235
 
@@ -51318,6 +51634,58 @@ function defaultSeparation(node1, node2) {
51318
51634
  * under the License.
51319
51635
  */
51320
51636
 
51637
+ var TreeShape = extendShape({
51638
+ shape: {
51639
+ parentPoint: [],
51640
+ childPoints: [],
51641
+ orient: '',
51642
+ forkPosition: ''
51643
+ },
51644
+
51645
+ style: {
51646
+ stroke: '#000',
51647
+ fill: null
51648
+ },
51649
+
51650
+ buildPath: function (ctx, shape) {
51651
+ var childPoints = shape.childPoints;
51652
+ var childLen = childPoints.length;
51653
+ var parentPoint = shape.parentPoint;
51654
+ var firstChildPos = childPoints[0];
51655
+ var lastChildPos = childPoints[childLen - 1];
51656
+
51657
+ if (childLen === 1) {
51658
+ ctx.moveTo(parentPoint[0], parentPoint[1]);
51659
+ ctx.lineTo(firstChildPos[0], firstChildPos[1]);
51660
+ return;
51661
+ }
51662
+
51663
+ var orient = shape.orient;
51664
+ var forkDim = (orient === 'TB' || orient === 'BT') ? 0 : 1;
51665
+ var otherDim = 1 - forkDim;
51666
+ var forkPosition = parsePercent$1(shape.forkPosition, 1);
51667
+ var tmpPoint = [];
51668
+ tmpPoint[forkDim] = parentPoint[forkDim];
51669
+ tmpPoint[otherDim] = parentPoint[otherDim] + (lastChildPos[otherDim] - parentPoint[otherDim]) * forkPosition;
51670
+
51671
+ ctx.moveTo(parentPoint[0], parentPoint[1]);
51672
+ ctx.lineTo(tmpPoint[0], tmpPoint[1]);
51673
+ ctx.moveTo(firstChildPos[0], firstChildPos[1]);
51674
+ tmpPoint[forkDim] = firstChildPos[forkDim];
51675
+ ctx.lineTo(tmpPoint[0], tmpPoint[1]);
51676
+ tmpPoint[forkDim] = lastChildPos[forkDim];
51677
+ ctx.lineTo(tmpPoint[0], tmpPoint[1]);
51678
+ ctx.lineTo(lastChildPos[0], lastChildPos[1]);
51679
+
51680
+ for (var i = 1; i < childLen - 1; i++) {
51681
+ var point = childPoints[i];
51682
+ ctx.moveTo(point[0], point[1]);
51683
+ tmpPoint[forkDim] = point[forkDim];
51684
+ ctx.lineTo(tmpPoint[0], tmpPoint[1]);
51685
+ }
51686
+ }
51687
+ });
51688
+
51321
51689
  extendChartView({
51322
51690
 
51323
51691
  type: 'tree',
@@ -51377,6 +51745,8 @@ extendChartView({
51377
51745
  var seriesScope = {
51378
51746
  expandAndCollapse: seriesModel.get('expandAndCollapse'),
51379
51747
  layout: layout,
51748
+ edgeShape: seriesModel.get('edgeShape'),
51749
+ edgeForkPosition: seriesModel.get('edgeForkPosition'),
51380
51750
  orient: seriesModel.getOrient(),
51381
51751
  curvature: seriesModel.get('lineStyle.curveness'),
51382
51752
  symbolRotate: seriesModel.get('symbolRotate'),
@@ -51678,22 +52048,72 @@ function updateNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
51678
52048
  });
51679
52049
  }
51680
52050
 
51681
- if (node.parentNode && node.parentNode !== virtualRoot) {
51682
- var edge = symbolEl.__edge;
51683
- if (!edge) {
51684
- edge = symbolEl.__edge = new BezierCurve({
51685
- shape: getEdgeShape(seriesScope, sourceOldLayout, sourceOldLayout),
51686
- style: defaults({opacity: 0, strokeNoScale: true}, seriesScope.lineStyle)
51687
- });
51688
- }
52051
+ drawEdge(
52052
+ seriesModel, node, virtualRoot, symbolEl, sourceOldLayout,
52053
+ sourceLayout, targetLayout, group, seriesScope
52054
+ );
51689
52055
 
51690
- updateProps(edge, {
51691
- shape: getEdgeShape(seriesScope, sourceLayout, targetLayout),
51692
- style: {opacity: 1}
51693
- }, seriesModel);
52056
+ }
52057
+
52058
+ function drawEdge(
52059
+ seriesModel, node, virtualRoot, symbolEl, sourceOldLayout,
52060
+ sourceLayout, targetLayout, group, seriesScope
52061
+ ) {
52062
+
52063
+ var edgeShape = seriesScope.edgeShape;
52064
+ var edge = symbolEl.__edge;
52065
+ if (edgeShape === 'curve') {
52066
+ if (node.parentNode && node.parentNode !== virtualRoot) {
52067
+ if (!edge) {
52068
+ edge = symbolEl.__edge = new BezierCurve({
52069
+ shape: getEdgeShape(seriesScope, sourceOldLayout, sourceOldLayout),
52070
+ style: defaults({opacity: 0, strokeNoScale: true}, seriesScope.lineStyle)
52071
+ });
52072
+ }
52073
+
52074
+ updateProps(edge, {
52075
+ shape: getEdgeShape(seriesScope, sourceLayout, targetLayout),
52076
+ style: {opacity: 1}
52077
+ }, seriesModel);
52078
+ }
52079
+ }
52080
+ else if (edgeShape === 'polyline') {
52081
+ if (seriesScope.layout === 'orthogonal') {
52082
+ if (node !== virtualRoot && node.children && (node.children.length !== 0) && (node.isExpand === true)) {
52083
+ var children = node.children;
52084
+ var childPoints = [];
52085
+ for (var i = 0; i < children.length; i++) {
52086
+ var childLayout = children[i].getLayout();
52087
+ childPoints.push([childLayout.x, childLayout.y]);
52088
+ }
51694
52089
 
51695
- group.add(edge);
52090
+ if (!edge) {
52091
+ edge = symbolEl.__edge = new TreeShape({
52092
+ shape: {
52093
+ parentPoint: [targetLayout.x, targetLayout.y],
52094
+ childPoints: [[targetLayout.x, targetLayout.y]],
52095
+ orient: seriesScope.orient,
52096
+ forkPosition: seriesScope.edgeForkPosition
52097
+ },
52098
+ style: defaults({opacity: 0, strokeNoScale: true}, seriesScope.lineStyle)
52099
+ });
52100
+ }
52101
+ updateProps(edge, {
52102
+ shape: {
52103
+ parentPoint: [targetLayout.x, targetLayout.y],
52104
+ childPoints: childPoints
52105
+ },
52106
+ style: {opacity: 1}
52107
+ }, seriesModel);
52108
+ }
52109
+ }
52110
+ else {
52111
+ if (__DEV__) {
52112
+ throw new Error('The polyline edgeShape can only be used in orthogonal layout');
52113
+ }
52114
+ }
51696
52115
  }
52116
+ group.add(edge);
51697
52117
  }
51698
52118
 
51699
52119
  function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope) {
@@ -51703,6 +52123,7 @@ function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
51703
52123
  var seriesScope = getTreeNodeStyle(node, itemModel, seriesScope);
51704
52124
 
51705
52125
  var source = node.parentNode === virtualRoot ? node : node.parentNode || node;
52126
+ var edgeShape = seriesScope.edgeShape;
51706
52127
  var sourceLayout;
51707
52128
  while (sourceLayout = source.getLayout(), sourceLayout == null) {
51708
52129
  source = source.parentNode === virtualRoot ? source : source.parentNode || source;
@@ -51717,16 +52138,42 @@ function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
51717
52138
 
51718
52139
  symbolEl.fadeOut(null, {keepLabel: true});
51719
52140
 
51720
- var edge = symbolEl.__edge;
52141
+ var sourceSymbolEl = data.getItemGraphicEl(source.dataIndex);
52142
+ var sourceEdge = sourceSymbolEl.__edge;
52143
+
52144
+ // 1. when expand the sub tree, delete the children node should delete the edge of
52145
+ // the source at the same time. because the polyline edge shape is only owned by the source.
52146
+ // 2.when the node is the only children of the source, delete the node should delete the edge of
52147
+ // the source at the same time. the same reason as above.
52148
+ var edge = symbolEl.__edge
52149
+ || ((source.isExpand === false || source.children.length === 1) ? sourceEdge : undefined);
52150
+
52151
+ var edgeShape = seriesScope.edgeShape;
52152
+
51721
52153
  if (edge) {
51722
- updateProps(edge, {
51723
- shape: getEdgeShape(seriesScope, sourceLayout, sourceLayout),
51724
- style: {
51725
- opacity: 0
51726
- }
51727
- }, seriesModel, function () {
51728
- group.remove(edge);
51729
- });
52154
+ if (edgeShape === 'curve') {
52155
+ updateProps(edge, {
52156
+ shape: getEdgeShape(seriesScope, sourceLayout, sourceLayout),
52157
+ style: {
52158
+ opacity: 0
52159
+ }
52160
+ }, seriesModel, function () {
52161
+ group.remove(edge);
52162
+ });
52163
+ }
52164
+ else if (edgeShape === 'polyline' && seriesScope.layout === 'orthogonal') {
52165
+ updateProps(edge, {
52166
+ shape: {
52167
+ parentPoint: [sourceLayout.x, sourceLayout.y],
52168
+ childPoints: [[sourceLayout.x, sourceLayout.y]]
52169
+ },
52170
+ style: {
52171
+ opacity: 0
52172
+ }
52173
+ }, seriesModel, function () {
52174
+ group.remove(edge);
52175
+ });
52176
+ }
51730
52177
  }
51731
52178
  }
51732
52179
 
@@ -52968,6 +53415,7 @@ extendChartView({
52968
53415
  var thisStorage = createStorage();
52969
53416
  var oldStorage = this._storage;
52970
53417
  var willInvisibleEls = [];
53418
+
52971
53419
  var doRenderNode = curry(
52972
53420
  renderNode, seriesModel,
52973
53421
  thisStorage, oldStorage, reRoot,
@@ -53466,6 +53914,11 @@ function renderNode(
53466
53914
  // Start of closure variables available in "Procedures in renderNode".
53467
53915
 
53468
53916
  var thisLayout = thisNode.getLayout();
53917
+ var data = seriesModel.getData();
53918
+
53919
+ // Only for enabling highlight/downplay. Clear firstly.
53920
+ // Because some node will not be rendered.
53921
+ data.setItemGraphicEl(thisNode.dataIndex, null);
53469
53922
 
53470
53923
  if (!thisLayout || !thisLayout.isInView) {
53471
53924
  return;
@@ -53505,14 +53958,36 @@ function renderNode(
53505
53958
  return group;
53506
53959
  }
53507
53960
 
53961
+ var nodeModel = thisNode.getModel();
53962
+
53508
53963
  // Background
53509
53964
  var bg = giveGraphic('background', Rect$1, depth, Z_BG);
53510
53965
  bg && renderBackground(group, bg, isParent && thisLayout.upperHeight);
53511
53966
 
53512
53967
  // No children, render content.
53513
- if (!isParent) {
53968
+ if (isParent) {
53969
+ // Because of the implementation about "traverse" in graphic hover style, we
53970
+ // can not set hover listener on the "group" of non-leaf node. Otherwise the
53971
+ // hover event from the descendents will be listenered.
53972
+ if (isHighDownDispatcher(group)) {
53973
+ setAsHighDownDispatcher(group, false);
53974
+ }
53975
+ if (bg) {
53976
+ setAsHighDownDispatcher(bg, true);
53977
+ // Only for enabling highlight/downplay.
53978
+ data.setItemGraphicEl(thisNode.dataIndex, bg);
53979
+ }
53980
+ }
53981
+ else {
53514
53982
  var content = giveGraphic('content', Rect$1, depth, Z_CONTENT);
53515
53983
  content && renderContent(group, content);
53984
+
53985
+ if (bg && isHighDownDispatcher(bg)) {
53986
+ setAsHighDownDispatcher(bg, false);
53987
+ }
53988
+ setAsHighDownDispatcher(group, true);
53989
+ // Only for enabling highlight/downplay.
53990
+ data.setItemGraphicEl(thisNode.dataIndex, group);
53516
53991
  }
53517
53992
 
53518
53993
  return group;
@@ -53527,10 +54002,17 @@ function renderNode(
53527
54002
  bg.seriesIndex = seriesModel.seriesIndex;
53528
54003
 
53529
54004
  bg.setShape({x: 0, y: 0, width: thisWidth, height: thisHeight});
53530
- var visualBorderColor = thisNode.getVisual('borderColor', true);
53531
- var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');
53532
54005
 
53533
- updateStyle(bg, function () {
54006
+ if (thisInvisible) {
54007
+ // If invisible, do not set visual, otherwise the element will
54008
+ // change immediately before animation. We think it is OK to
54009
+ // remain its origin color when moving out of the view window.
54010
+ processInvisible(bg);
54011
+ }
54012
+ else {
54013
+ bg.invisible = false;
54014
+ var visualBorderColor = thisNode.getVisual('borderColor', true);
54015
+ var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');
53534
54016
  var normalStyle = getItemStyleNormal(itemStyleNormalModel);
53535
54017
  normalStyle.fill = visualBorderColor;
53536
54018
  var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
@@ -53550,8 +54032,8 @@ function renderNode(
53550
54032
  }
53551
54033
 
53552
54034
  bg.setStyle(normalStyle);
53553
- setHoverStyle(bg, emphasisStyle);
53554
- });
54035
+ setElementHoverStyle(bg, emphasisStyle);
54036
+ }
53555
54037
 
53556
54038
  group.add(bg);
53557
54039
  }
@@ -53572,8 +54054,15 @@ function renderNode(
53572
54054
  height: contentHeight
53573
54055
  });
53574
54056
 
53575
- var visualColor = thisNode.getVisual('color', true);
53576
- updateStyle(content, function () {
54057
+ if (thisInvisible) {
54058
+ // If invisible, do not set visual, otherwise the element will
54059
+ // change immediately before animation. We think it is OK to
54060
+ // remain its origin color when moving out of the view window.
54061
+ processInvisible(content);
54062
+ }
54063
+ else {
54064
+ content.invisible = false;
54065
+ var visualColor = thisNode.getVisual('color', true);
53577
54066
  var normalStyle = getItemStyleNormal(itemStyleNormalModel);
53578
54067
  normalStyle.fill = visualColor;
53579
54068
  var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
@@ -53581,32 +54070,19 @@ function renderNode(
53581
54070
  prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight);
53582
54071
 
53583
54072
  content.setStyle(normalStyle);
53584
- setHoverStyle(content, emphasisStyle);
53585
- });
54073
+ setElementHoverStyle(content, emphasisStyle);
54074
+ }
53586
54075
 
53587
54076
  group.add(content);
53588
54077
  }
53589
54078
 
53590
- function updateStyle(element, cb) {
53591
- if (!thisInvisible) {
53592
- // If invisible, do not set visual, otherwise the element will
53593
- // change immediately before animation. We think it is OK to
53594
- // remain its origin color when moving out of the view window.
53595
- cb();
53596
-
53597
- if (!element.__tmWillVisible) {
53598
- element.invisible = false;
53599
- }
53600
- }
53601
- else {
53602
- // Delay invisible setting utill animation finished,
53603
- // avoid element vanish suddenly before animation.
53604
- !element.invisible && willInvisibleEls.push(element);
53605
- }
54079
+ function processInvisible(element) {
54080
+ // Delay invisible setting utill animation finished,
54081
+ // avoid element vanish suddenly before animation.
54082
+ !element.invisible && willInvisibleEls.push(element);
53606
54083
  }
53607
54084
 
53608
54085
  function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
53609
- var nodeModel = thisNode.getModel();
53610
54086
  var text = retrieve(
53611
54087
  seriesModel.getFormattedLabel(
53612
54088
  thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'
@@ -53703,6 +54179,7 @@ function renderNode(
53703
54179
  // Fade in, user can be aware that these nodes are new.
53704
54180
  lastCfg.fadein = storageName !== 'nodeGroup';
53705
54181
  }
54182
+
53706
54183
  }
53707
54184
 
53708
54185
  // We can not set all backgroud with the same z, Because the behaviour of
@@ -56118,7 +56595,8 @@ var GraphSeries = extendSeriesModel({
56118
56595
  edgeSymbol: ['none', 'none'],
56119
56596
  edgeSymbolSize: 10,
56120
56597
  edgeLabel: {
56121
- position: 'middle'
56598
+ position: 'middle',
56599
+ distance: 5
56122
56600
  },
56123
56601
 
56124
56602
  draggable: false,
@@ -56372,39 +56850,90 @@ function updateSymbolAndLabelBeforeLineUpdate() {
56372
56850
  var textPosition;
56373
56851
  var textAlign;
56374
56852
  var textVerticalAlign;
56375
-
56376
- var distance$$1 = 5 * invScale;
56377
- // End
56378
- if (label.__position === 'end') {
56379
- textPosition = [d[0] * distance$$1 + toPos[0], d[1] * distance$$1 + toPos[1]];
56380
- textAlign = d[0] > 0.8 ? 'left' : (d[0] < -0.8 ? 'right' : 'center');
56381
- textVerticalAlign = d[1] > 0.8 ? 'top' : (d[1] < -0.8 ? 'bottom' : 'middle');
56382
- }
56383
- // Middle
56384
- else if (label.__position === 'middle') {
56385
- var halfPercent = percent / 2;
56386
- var tangent = line.tangentAt(halfPercent);
56387
- var n = [tangent[1], -tangent[0]];
56388
- var cp = line.pointAt(halfPercent);
56389
- if (n[1] > 0) {
56390
- n[0] = -n[0];
56391
- n[1] = -n[1];
56392
- }
56393
- textPosition = [cp[0] + n[0] * distance$$1, cp[1] + n[1] * distance$$1];
56394
- textAlign = 'center';
56395
- textVerticalAlign = 'bottom';
56853
+ var textOrigin;
56854
+
56855
+ var distance$$1 = label.__labelDistance;
56856
+ var distanceX = distance$$1[0] * invScale;
56857
+ var distanceY = distance$$1[1] * invScale;
56858
+ var halfPercent = percent / 2;
56859
+ var tangent = line.tangentAt(halfPercent);
56860
+ var n = [tangent[1], -tangent[0]];
56861
+ var cp = line.pointAt(halfPercent);
56862
+ if (n[1] > 0) {
56863
+ n[0] = -n[0];
56864
+ n[1] = -n[1];
56865
+ }
56866
+ var dir = tangent[0] < 0 ? -1 : 1;
56867
+
56868
+ if (label.__position !== 'start' && label.__position !== 'end') {
56396
56869
  var rotation = -Math.atan2(tangent[1], tangent[0]);
56397
56870
  if (toPos[0] < fromPos[0]) {
56398
56871
  rotation = Math.PI + rotation;
56399
56872
  }
56400
56873
  label.attr('rotation', rotation);
56401
56874
  }
56402
- // Start
56403
- else {
56404
- textPosition = [-d[0] * distance$$1 + fromPos[0], -d[1] * distance$$1 + fromPos[1]];
56405
- textAlign = d[0] > 0.8 ? 'right' : (d[0] < -0.8 ? 'left' : 'center');
56406
- textVerticalAlign = d[1] > 0.8 ? 'bottom' : (d[1] < -0.8 ? 'top' : 'middle');
56875
+
56876
+ var dy;
56877
+ switch (label.__position) {
56878
+ case 'insideStartTop':
56879
+ case 'insideMiddleTop':
56880
+ case 'insideEndTop':
56881
+ case 'middle':
56882
+ dy = -distanceY;
56883
+ textVerticalAlign = 'bottom';
56884
+ break;
56885
+
56886
+ case 'insideStartBottom':
56887
+ case 'insideMiddleBottom':
56888
+ case 'insideEndBottom':
56889
+ dy = distanceY;
56890
+ textVerticalAlign = 'top';
56891
+ break;
56892
+
56893
+ default:
56894
+ dy = 0;
56895
+ textVerticalAlign = 'middle';
56896
+ }
56897
+
56898
+ switch (label.__position) {
56899
+ case 'end':
56900
+ textPosition = [d[0] * distanceX + toPos[0], d[1] * distanceY + toPos[1]];
56901
+ textAlign = d[0] > 0.8 ? 'left' : (d[0] < -0.8 ? 'right' : 'center');
56902
+ textVerticalAlign = d[1] > 0.8 ? 'top' : (d[1] < -0.8 ? 'bottom' : 'middle');
56903
+ break;
56904
+
56905
+ case 'start':
56906
+ textPosition = [-d[0] * distanceX + fromPos[0], -d[1] * distanceY + fromPos[1]];
56907
+ textAlign = d[0] > 0.8 ? 'right' : (d[0] < -0.8 ? 'left' : 'center');
56908
+ textVerticalAlign = d[1] > 0.8 ? 'bottom' : (d[1] < -0.8 ? 'top' : 'middle');
56909
+ break;
56910
+
56911
+ case 'insideStartTop':
56912
+ case 'insideStart':
56913
+ case 'insideStartBottom':
56914
+ textPosition = [distanceX * dir + fromPos[0], fromPos[1] + dy];
56915
+ textAlign = tangent[0] < 0 ? 'right' : 'left';
56916
+ textOrigin = [-distanceX * dir, -dy];
56917
+ break;
56918
+
56919
+ case 'insideMiddleTop':
56920
+ case 'insideMiddle':
56921
+ case 'insideMiddleBottom':
56922
+ case 'middle':
56923
+ textPosition = [cp[0], cp[1] + dy];
56924
+ textAlign = 'center';
56925
+ textOrigin = [0, -dy];
56926
+ break;
56927
+
56928
+ case 'insideEndTop':
56929
+ case 'insideEnd':
56930
+ case 'insideEndBottom':
56931
+ textPosition = [-distanceX * dir + toPos[0], toPos[1] + dy];
56932
+ textAlign = tangent[0] >= 0 ? 'right' : 'left';
56933
+ textOrigin = [distanceX * dir, -dy];
56934
+ break;
56407
56935
  }
56936
+
56408
56937
  label.attr({
56409
56938
  style: {
56410
56939
  // Use the user specified text align and baseline first
@@ -56412,7 +56941,8 @@ function updateSymbolAndLabelBeforeLineUpdate() {
56412
56941
  textAlign: label.__textAlign || textAlign
56413
56942
  },
56414
56943
  position: textPosition,
56415
- scale: [invScale, invScale]
56944
+ scale: [invScale, invScale],
56945
+ origin: textOrigin
56416
56946
  });
56417
56947
  }
56418
56948
  }
@@ -56588,6 +57118,12 @@ lineProto._updateCommonStl = function (lineData, idx, seriesScope) {
56588
57118
  label.__verticalAlign = labelStyle.textVerticalAlign;
56589
57119
  // 'start', 'middle', 'end'
56590
57120
  label.__position = labelModel.get('position') || 'middle';
57121
+
57122
+ var distance$$1 = labelModel.get('distance');
57123
+ if (!isArray(distance$$1)) {
57124
+ distance$$1 = [distance$$1, distance$$1];
57125
+ }
57126
+ label.__labelDistance = distance$$1;
56591
57127
  }
56592
57128
 
56593
57129
  if (emphasisText != null) {
@@ -57282,7 +57818,7 @@ extendChartView({
57282
57818
  },
57283
57819
 
57284
57820
  focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
57285
- var data = this._model.getData();
57821
+ var data = seriesModel.getData();
57286
57822
  var graph = data.graph;
57287
57823
  var dataIndex = payload.dataIndex;
57288
57824
  var edgeDataIndex = payload.edgeDataIndex;
@@ -57320,7 +57856,7 @@ extendChartView({
57320
57856
  },
57321
57857
 
57322
57858
  unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
57323
- var graph = this._model.getData().graph;
57859
+ var graph = seriesModel.getData().graph;
57324
57860
 
57325
57861
  graph.eachNode(function (node) {
57326
57862
  fadeOutItem(node, nodeOpacityPath);
@@ -62836,6 +63372,17 @@ var SankeySeries = SeriesModel.extend({
62836
63372
  }
62837
63373
  },
62838
63374
 
63375
+ // Override Series.getDataParams()
63376
+ getDataParams: function (dataIndex, dataType) {
63377
+ var params = SankeySeries.superCall(this, 'getDataParams', dataIndex, dataType);
63378
+ if (params.value == null && dataType === 'node') {
63379
+ var node = this.getGraph().getNodeByIndex(dataIndex);
63380
+ var nodeValue = node.getLayout().value;
63381
+ params.value = nodeValue;
63382
+ }
63383
+ return params;
63384
+ },
63385
+
62839
63386
  defaultOption: {
62840
63387
  zlevel: 0,
62841
63388
  z: 2,
@@ -62896,7 +63443,7 @@ var SankeySeries = SeriesModel.extend({
62896
63443
  show: true
62897
63444
  },
62898
63445
  lineStyle: {
62899
- opacity: 0.6
63446
+ opacity: 0.5
62900
63447
  }
62901
63448
  },
62902
63449
 
@@ -62927,7 +63474,9 @@ var SankeySeries = SeriesModel.extend({
62927
63474
  */
62928
63475
 
62929
63476
  var nodeOpacityPath$1 = ['itemStyle', 'opacity'];
63477
+ var hoverNodeOpacityPath = ['emphasis', 'itemStyle', 'opacity'];
62930
63478
  var lineOpacityPath$1 = ['lineStyle', 'opacity'];
63479
+ var hoverLineOpacityPath = ['emphasis', 'lineStyle', 'opacity'];
62931
63480
 
62932
63481
  function getItemOpacity$1(item, opacityPath) {
62933
63482
  return item.getVisual('opacity') || item.getModel().get(opacityPath);
@@ -62935,8 +63484,8 @@ function getItemOpacity$1(item, opacityPath) {
62935
63484
 
62936
63485
  function fadeOutItem$1(item, opacityPath, opacityRatio) {
62937
63486
  var el = item.getGraphicEl();
62938
-
62939
63487
  var opacity = getItemOpacity$1(item, opacityPath);
63488
+
62940
63489
  if (opacityRatio != null) {
62941
63490
  opacity == null && (opacity = 1);
62942
63491
  opacity *= opacityRatio;
@@ -62954,12 +63503,14 @@ function fadeInItem$1(item, opacityPath) {
62954
63503
  var opacity = getItemOpacity$1(item, opacityPath);
62955
63504
  var el = item.getGraphicEl();
62956
63505
 
62957
- el.highlight && el.highlight();
62958
63506
  el.traverse(function (child) {
62959
63507
  if (child.type !== 'group') {
62960
63508
  child.setStyle('opacity', opacity);
62961
63509
  }
62962
63510
  });
63511
+
63512
+ // Support emphasis here.
63513
+ el.highlight && el.highlight();
62963
63514
  }
62964
63515
 
62965
63516
  var SankeyShape = extendShape({
@@ -62997,6 +63548,14 @@ var SankeyShape = extendShape({
62997
63548
  );
62998
63549
  }
62999
63550
  ctx.closePath();
63551
+ },
63552
+
63553
+ highlight: function () {
63554
+ this.trigger('emphasis');
63555
+ },
63556
+
63557
+ downplay: function () {
63558
+ this.trigger('normal');
63000
63559
  }
63001
63560
  });
63002
63561
 
@@ -63179,8 +63738,19 @@ extendChartView({
63179
63738
  el.cursor = 'move';
63180
63739
  }
63181
63740
 
63741
+ el.highlight = function () {
63742
+ this.trigger('emphasis');
63743
+ };
63744
+
63745
+ el.downplay = function () {
63746
+ this.trigger('normal');
63747
+ };
63748
+
63749
+ el.focusNodeAdjHandler && el.off('mouseover', el.focusNodeAdjHandler);
63750
+ el.unfocusNodeAdjHandler && el.off('mouseout', el.unfocusNodeAdjHandler);
63751
+
63182
63752
  if (itemModel.get('focusNodeAdjacency')) {
63183
- el.off('mouseover').on('mouseover', function () {
63753
+ el.on('mouseover', el.focusNodeAdjHandler = function () {
63184
63754
  if (!sankeyView._focusAdjacencyDisabled) {
63185
63755
  sankeyView._clearTimer();
63186
63756
  api.dispatchAction({
@@ -63190,7 +63760,8 @@ extendChartView({
63190
63760
  });
63191
63761
  }
63192
63762
  });
63193
- el.off('mouseout').on('mouseout', function () {
63763
+
63764
+ el.on('mouseout', el.unfocusNodeAdjHandler = function () {
63194
63765
  if (!sankeyView._focusAdjacencyDisabled) {
63195
63766
  sankeyView._dispatchUnfocus(api);
63196
63767
  }
@@ -63200,8 +63771,12 @@ extendChartView({
63200
63771
 
63201
63772
  edgeData.eachItemGraphicEl(function (el, dataIndex) {
63202
63773
  var edgeModel = edgeData.getItemModel(dataIndex);
63774
+
63775
+ el.focusNodeAdjHandler && el.off('mouseover', el.focusNodeAdjHandler);
63776
+ el.unfocusNodeAdjHandler && el.off('mouseout', el.unfocusNodeAdjHandler);
63777
+
63203
63778
  if (edgeModel.get('focusNodeAdjacency')) {
63204
- el.off('mouseover').on('mouseover', function () {
63779
+ el.on('mouseover', el.focusNodeAdjHandler = function () {
63205
63780
  if (!sankeyView._focusAdjacencyDisabled) {
63206
63781
  sankeyView._clearTimer();
63207
63782
  api.dispatchAction({
@@ -63211,7 +63786,8 @@ extendChartView({
63211
63786
  });
63212
63787
  }
63213
63788
  });
63214
- el.off('mouseout').on('mouseout', function () {
63789
+
63790
+ el.on('mouseout', el.unfocusNodeAdjHandler = function () {
63215
63791
  if (!sankeyView._focusAdjacencyDisabled) {
63216
63792
  sankeyView._dispatchUnfocus(api);
63217
63793
  }
@@ -63252,7 +63828,7 @@ extendChartView({
63252
63828
  },
63253
63829
 
63254
63830
  focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
63255
- var data = this._model.getData();
63831
+ var data = seriesModel.getData();
63256
63832
  var graph = data.graph;
63257
63833
  var dataIndex = payload.dataIndex;
63258
63834
  var itemModel = data.getItemModel(dataIndex);
@@ -63272,15 +63848,15 @@ extendChartView({
63272
63848
  });
63273
63849
 
63274
63850
  if (node) {
63275
- fadeInItem$1(node, nodeOpacityPath$1);
63851
+ fadeInItem$1(node, hoverNodeOpacityPath);
63276
63852
  var focusNodeAdj = itemModel.get('focusNodeAdjacency');
63277
63853
  if (focusNodeAdj === 'outEdges') {
63278
63854
  each$1(node.outEdges, function (edge) {
63279
63855
  if (edge.dataIndex < 0) {
63280
63856
  return;
63281
63857
  }
63282
- fadeInItem$1(edge, lineOpacityPath$1);
63283
- fadeInItem$1(edge.node2, nodeOpacityPath$1);
63858
+ fadeInItem$1(edge, hoverLineOpacityPath);
63859
+ fadeInItem$1(edge.node2, hoverNodeOpacityPath);
63284
63860
  });
63285
63861
  }
63286
63862
  else if (focusNodeAdj === 'inEdges') {
@@ -63288,8 +63864,8 @@ extendChartView({
63288
63864
  if (edge.dataIndex < 0) {
63289
63865
  return;
63290
63866
  }
63291
- fadeInItem$1(edge, lineOpacityPath$1);
63292
- fadeInItem$1(edge.node1, nodeOpacityPath$1);
63867
+ fadeInItem$1(edge, hoverLineOpacityPath);
63868
+ fadeInItem$1(edge.node1, hoverNodeOpacityPath);
63293
63869
  });
63294
63870
  }
63295
63871
  else if (focusNodeAdj === 'allEdges') {
@@ -63297,21 +63873,21 @@ extendChartView({
63297
63873
  if (edge.dataIndex < 0) {
63298
63874
  return;
63299
63875
  }
63300
- fadeInItem$1(edge, lineOpacityPath$1);
63301
- fadeInItem$1(edge.node1, nodeOpacityPath$1);
63302
- fadeInItem$1(edge.node2, nodeOpacityPath$1);
63876
+ fadeInItem$1(edge, hoverLineOpacityPath);
63877
+ (edge.node1 !== node) && fadeInItem$1(edge.node1, hoverNodeOpacityPath);
63878
+ (edge.node2 !== node) && fadeInItem$1(edge.node2, hoverNodeOpacityPath);
63303
63879
  });
63304
63880
  }
63305
63881
  }
63306
63882
  if (edge) {
63307
- fadeInItem$1(edge, lineOpacityPath$1);
63308
- fadeInItem$1(edge.node1, nodeOpacityPath$1);
63309
- fadeInItem$1(edge.node2, nodeOpacityPath$1);
63883
+ fadeInItem$1(edge, hoverLineOpacityPath);
63884
+ fadeInItem$1(edge.node1, hoverNodeOpacityPath);
63885
+ fadeInItem$1(edge.node2, hoverNodeOpacityPath);
63310
63886
  }
63311
63887
  },
63312
63888
 
63313
63889
  unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
63314
- var graph = this._model.getGraph();
63890
+ var graph = seriesModel.getGraph();
63315
63891
 
63316
63892
  graph.eachNode(function (node) {
63317
63893
  fadeOutItem$1(node, nodeOpacityPath$1);
@@ -63334,8 +63910,7 @@ function createGridClipShape$1(rect, seriesModel, cb) {
63334
63910
  });
63335
63911
  initProps(rectEl, {
63336
63912
  shape: {
63337
- width: rect.width + 20,
63338
- height: rect.height + 20
63913
+ width: rect.width + 20
63339
63914
  }
63340
63915
  }, seriesModel, cb);
63341
63916
 
@@ -63457,7 +64032,8 @@ function computeNodeValues(nodes) {
63457
64032
  each$1(nodes, function (node) {
63458
64033
  var value1 = sum(node.outEdges, getEdgeValue);
63459
64034
  var value2 = sum(node.inEdges, getEdgeValue);
63460
- var value = Math.max(value1, value2);
64035
+ var nodeRawValue = node.getValue() || 0;
64036
+ var value = Math.max(value1, value2, nodeRawValue);
63461
64037
  node.setLayout({value: value}, true);
63462
64038
  });
63463
64039
  }
@@ -63801,12 +64377,12 @@ function getEdgeValue(edge) {
63801
64377
  return edge.getValue();
63802
64378
  }
63803
64379
 
63804
- function sum(array, f, orient) {
64380
+ function sum(array, cb, orient) {
63805
64381
  var sum = 0;
63806
64382
  var len = array.length;
63807
64383
  var i = -1;
63808
64384
  while (++i < len) {
63809
- var value = +f.call(array, array[i], orient);
64385
+ var value = +cb.call(array, array[i], orient);
63810
64386
  if (!isNaN(value)) {
63811
64387
  sum += value;
63812
64388
  }
@@ -65107,7 +65683,6 @@ var candlestickVisual = {
65107
65683
  reset: function (seriesModel, ecModel) {
65108
65684
 
65109
65685
  var data = seriesModel.getData();
65110
- var isLargeRender = seriesModel.pipelineContext.large;
65111
65686
 
65112
65687
  data.setVisual({
65113
65688
  legendSymbol: 'roundRect',
@@ -65122,6 +65697,7 @@ var candlestickVisual = {
65122
65697
  return;
65123
65698
  }
65124
65699
 
65700
+ var isLargeRender = seriesModel.pipelineContext.large;
65125
65701
  return !isLargeRender && {progress: progress};
65126
65702
 
65127
65703
 
@@ -66218,6 +66794,7 @@ effectLineProto._updateEffectSymbol = function (lineData, idx) {
66218
66794
  symbol.attr('scale', size);
66219
66795
 
66220
66796
  this._symbolType = symbolType;
66797
+ this._symbolScale = size;
66221
66798
 
66222
66799
  this._updateEffectAnimation(lineData, effectModel, idx);
66223
66800
  };
@@ -66308,6 +66885,7 @@ effectLineProto.updateSymbolPosition = function (symbol) {
66308
66885
  var cp1 = symbol.__cp1;
66309
66886
  var t = symbol.__t;
66310
66887
  var pos = symbol.position;
66888
+ var lastPos = [pos[0], pos[1]];
66311
66889
  var quadraticAt$$1 = quadraticAt;
66312
66890
  var quadraticDerivativeAt$$1 = quadraticDerivativeAt;
66313
66891
  pos[0] = quadraticAt$$1(p1[0], cp1[0], p2[0], t);
@@ -66318,7 +66896,27 @@ effectLineProto.updateSymbolPosition = function (symbol) {
66318
66896
  var ty = quadraticDerivativeAt$$1(p1[1], cp1[1], p2[1], t);
66319
66897
 
66320
66898
  symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
66321
-
66899
+ // enable continuity trail for 'line', 'rect', 'roundRect' symbolType
66900
+ if (this._symbolType === 'line' || this._symbolType === 'rect' || this._symbolType === 'roundRect') {
66901
+ if (symbol.__lastT !== undefined && symbol.__lastT < symbol.__t) {
66902
+ var scaleY = dist(lastPos, pos) * 1.05;
66903
+ symbol.attr('scale', [symbol.scale[0], scaleY]);
66904
+ // make sure the last segment render within endPoint
66905
+ if (t === 1) {
66906
+ pos[0] = lastPos[0] + (pos[0] - lastPos[0]) / 2;
66907
+ pos[1] = lastPos[1] + (pos[1] - lastPos[1]) / 2;
66908
+ }
66909
+ }
66910
+ else if (symbol.__lastT === 1) {
66911
+ // After first loop, symbol.__t does NOT start with 0, so connect p1 to pos directly.
66912
+ var scaleY = 2 * dist(p1, pos);
66913
+ symbol.attr('scale', [symbol.scale[0], scaleY ]);
66914
+ }
66915
+ else {
66916
+ symbol.attr('scale', this._symbolScale);
66917
+ }
66918
+ }
66919
+ symbol.__lastT = symbol.__t;
66322
66920
  symbol.ignore = false;
66323
66921
  };
66324
66922
 
@@ -69144,7 +69742,7 @@ var axisBuilderAttrs$2 = [
69144
69742
  'axisLine', 'axisTickLabel', 'axisName'
69145
69743
  ];
69146
69744
 
69147
- var selfBuilderAttr = 'splitLine';
69745
+ var selfBuilderAttrs$1 = ['splitArea', 'splitLine'];
69148
69746
 
69149
69747
  var SingleAxisView = AxisView.extend({
69150
69748
 
@@ -69158,21 +69756,33 @@ var SingleAxisView = AxisView.extend({
69158
69756
 
69159
69757
  group.removeAll();
69160
69758
 
69759
+ var oldAxisGroup = this._axisGroup;
69760
+ this._axisGroup = new Group();
69761
+
69161
69762
  var layout = layout$2(axisModel);
69162
69763
 
69163
69764
  var axisBuilder = new AxisBuilder(axisModel, layout);
69164
69765
 
69165
69766
  each$1(axisBuilderAttrs$2, axisBuilder.add, axisBuilder);
69166
69767
 
69768
+ group.add(this._axisGroup);
69167
69769
  group.add(axisBuilder.getGroup());
69168
69770
 
69169
- if (axisModel.get(selfBuilderAttr + '.show')) {
69170
- this['_' + selfBuilderAttr](axisModel);
69171
- }
69771
+ each$1(selfBuilderAttrs$1, function (name) {
69772
+ if (axisModel.get(name + '.show')) {
69773
+ this['_' + name](axisModel);
69774
+ }
69775
+ }, this);
69776
+
69777
+ groupTransition(oldAxisGroup, this._axisGroup, axisModel);
69172
69778
 
69173
69779
  SingleAxisView.superCall(this, 'render', axisModel, ecModel, api, payload);
69174
69780
  },
69175
69781
 
69782
+ remove: function () {
69783
+ rectCoordAxisHandleRemove(this);
69784
+ },
69785
+
69176
69786
  _splitLine: function (axisModel) {
69177
69787
  var axis = axisModel.axis;
69178
69788
 
@@ -69241,6 +69851,10 @@ var SingleAxisView = AxisView.extend({
69241
69851
  silent: true
69242
69852
  }));
69243
69853
  }
69854
+ },
69855
+
69856
+ _splitArea: function (axisModel) {
69857
+ rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, axisModel);
69244
69858
  }
69245
69859
  });
69246
69860
 
@@ -74267,10 +74881,6 @@ function barLayoutPolar(seriesType, ecModel, api) {
74267
74881
  var value = data.get(valueDim, idx);
74268
74882
  var baseValue = data.get(baseDim, idx);
74269
74883
 
74270
- if (isNaN(value)) {
74271
- continue;
74272
- }
74273
-
74274
74884
  var sign = value >= 0 ? 'p' : 'n';
74275
74885
  var baseCoord = valueAxisStart;
74276
74886
 
@@ -75659,7 +76269,7 @@ AxisView.extend({
75659
76269
  var axisBuilderAttrs$3 = [
75660
76270
  'axisLine', 'axisTickLabel', 'axisName'
75661
76271
  ];
75662
- var selfBuilderAttrs$1 = [
76272
+ var selfBuilderAttrs$2 = [
75663
76273
  'splitLine', 'splitArea', 'minorSplitLine'
75664
76274
  ];
75665
76275
 
@@ -75687,7 +76297,7 @@ AxisView.extend({
75687
76297
  each$1(axisBuilderAttrs$3, axisBuilder.add, axisBuilder);
75688
76298
  this.group.add(axisBuilder.getGroup());
75689
76299
 
75690
- each$1(selfBuilderAttrs$1, function (name) {
76300
+ each$1(selfBuilderAttrs$2, function (name) {
75691
76301
  if (radiusAxisModel.get(name + '.show') && !radiusAxis.scale.isBlank()) {
75692
76302
  this['_' + name](radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords, minorTicksCoords);
75693
76303
  }
@@ -82090,24 +82700,63 @@ function assembleCssText(tooltipModel) {
82090
82700
  return cssText.join(';') + ';';
82091
82701
  }
82092
82702
 
82703
+ // If not able to make, do not modify the input `out`.
82704
+ function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
82705
+ var zrPainter = zr && zr.painter;
82706
+
82707
+ if (appendToBody) {
82708
+ var zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
82709
+ if (zrViewportRoot) {
82710
+ // Some APPs might use scale on body, so we support CSS transform here.
82711
+ transformLocalCoord(out, zrViewportRoot, document.body, zrX, zrY);
82712
+ }
82713
+ }
82714
+ else {
82715
+ out[0] = zrX;
82716
+ out[1] = zrY;
82717
+ // xy should be based on canvas root. But tooltipContent is
82718
+ // the sibling of canvas root. So padding of ec container
82719
+ // should be considered here.
82720
+ var viewportRootOffset = zrPainter && zrPainter.getViewportRootOffset();
82721
+ if (viewportRootOffset) {
82722
+ out[0] += viewportRootOffset.offsetLeft;
82723
+ out[1] += viewportRootOffset.offsetTop;
82724
+ }
82725
+ }
82726
+ }
82727
+
82093
82728
  /**
82094
82729
  * @alias module:echarts/component/tooltip/TooltipContent
82730
+ * @param {HTMLElement} container
82731
+ * @param {ExtensionAPI} api
82732
+ * @param {Object} [opt]
82733
+ * @param {boolean} [opt.appendToBody]
82734
+ * `false`: the DOM element will be inside the container. Default value.
82735
+ * `true`: the DOM element will be appended to HTML body, which avoid
82736
+ * some overflow clip but intrude outside of the container.
82095
82737
  * @constructor
82096
82738
  */
82097
- function TooltipContent(container, api) {
82739
+ function TooltipContent(container, api, opt) {
82098
82740
  if (env$1.wxa) {
82099
82741
  return null;
82100
82742
  }
82101
82743
 
82102
82744
  var el = document.createElement('div');
82745
+ el.domBelongToZr = true;
82746
+ this.el = el;
82103
82747
  var zr = this._zr = api.getZr();
82748
+ var appendToBody = this._appendToBody = opt && opt.appendToBody;
82104
82749
 
82105
- this.el = el;
82750
+ this._styleCoord = [0, 0];
82106
82751
 
82107
- this._x = api.getWidth() / 2;
82108
- this._y = api.getHeight() / 2;
82752
+ makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
82109
82753
 
82110
- container.appendChild(el);
82754
+ if (appendToBody) {
82755
+ document.body.appendChild(el);
82756
+ }
82757
+ else {
82758
+ container.appendChild(el);
82759
+ }
82111
82760
 
82112
82761
  this._container = container;
82113
82762
 
@@ -82141,7 +82790,8 @@ function TooltipContent(container, api) {
82141
82790
  // Try trigger zrender event to avoid mouse
82142
82791
  // in and out shape too frequently
82143
82792
  var handler = zr.handler;
82144
- normalizeEvent(container, e, true);
82793
+ var zrViewportRoot = zr.painter.getViewportRoot();
82794
+ normalizeEvent(zrViewportRoot, e, true);
82145
82795
  handler.dispatch('mousemove', e);
82146
82796
  }
82147
82797
  };
@@ -82186,12 +82836,13 @@ TooltipContent.prototype = {
82186
82836
  show: function (tooltipModel) {
82187
82837
  clearTimeout(this._hideTimeout);
82188
82838
  var el = this.el;
82839
+ var styleCoord = this._styleCoord;
82189
82840
 
82190
82841
  el.style.cssText = gCssText + assembleCssText(tooltipModel)
82191
82842
  // Because of the reason described in:
82192
82843
  // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore
82193
82844
  // we should set initial value to `left` and `top`.
82194
- + ';left:' + this._x + 'px;top:' + this._y + 'px;'
82845
+ + ';left:' + styleCoord[0] + 'px;top:' + styleCoord[1] + 'px;'
82195
82846
  + (tooltipModel.get('extraCssText') || '');
82196
82847
 
82197
82848
  el.style.display = el.innerHTML ? 'block' : 'none';
@@ -82219,23 +82870,13 @@ TooltipContent.prototype = {
82219
82870
  return [el.clientWidth, el.clientHeight];
82220
82871
  },
82221
82872
 
82222
- moveTo: function (x, y) {
82223
- // xy should be based on canvas root. But tooltipContent is
82224
- // the sibling of canvas root. So padding of ec container
82225
- // should be considered here.
82226
- var zr = this._zr;
82227
- var viewportRootOffset;
82228
- if (zr && zr.painter && (viewportRootOffset = zr.painter.getViewportRootOffset())) {
82229
- x += viewportRootOffset.offsetLeft;
82230
- y += viewportRootOffset.offsetTop;
82231
- }
82873
+ moveTo: function (zrX, zrY) {
82874
+ var styleCoord = this._styleCoord;
82875
+ makeStyleCoord(styleCoord, this._zr, this._appendToBody, zrX, zrY);
82232
82876
 
82233
82877
  var style = this.el.style;
82234
- style.left = x + 'px';
82235
- style.top = y + 'px';
82236
-
82237
- this._x = x;
82238
- this._y = y;
82878
+ style.left = styleCoord[0] + 'px';
82879
+ style.top = styleCoord[1] + 'px';
82239
82880
  },
82240
82881
 
82241
82882
  hide: function () {
@@ -82261,6 +82902,10 @@ TooltipContent.prototype = {
82261
82902
  return this._show;
82262
82903
  },
82263
82904
 
82905
+ dispose: function () {
82906
+ this.el.parentNode.removeChild(this.el);
82907
+ },
82908
+
82264
82909
  getOuterSize: function () {
82265
82910
  var width = this.el.clientWidth;
82266
82911
  var height = this.el.clientHeight;
@@ -82277,6 +82922,7 @@ TooltipContent.prototype = {
82277
82922
 
82278
82923
  return {width: width, height: height};
82279
82924
  }
82925
+
82280
82926
  };
82281
82927
 
82282
82928
  /*
@@ -82508,7 +83154,9 @@ extendComponentView({
82508
83154
 
82509
83155
  var tooltipContent;
82510
83156
  if (this._renderMode === 'html') {
82511
- tooltipContent = new TooltipContent(api.getDom(), api);
83157
+ tooltipContent = new TooltipContent(api.getDom(), api, {
83158
+ appendToBody: tooltipModel.get('appendToBody', true)
83159
+ });
82512
83160
  this._newLine = '<br/>';
82513
83161
  }
82514
83162
  else {
@@ -82661,7 +83309,6 @@ extendComponentView({
82661
83309
  offsetX: payload.x,
82662
83310
  offsetY: payload.y,
82663
83311
  position: payload.position,
82664
- event: {},
82665
83312
  dataByCoordSys: payload.dataByCoordSys,
82666
83313
  tooltipOption: payload.tooltipOption
82667
83314
  }, dispatchAction);
@@ -82680,8 +83327,7 @@ extendComponentView({
82680
83327
  offsetX: cx,
82681
83328
  offsetY: cy,
82682
83329
  position: payload.position,
82683
- target: pointInfo.el,
82684
- event: {}
83330
+ target: pointInfo.el
82685
83331
  }, dispatchAction);
82686
83332
  }
82687
83333
  }
@@ -82698,8 +83344,7 @@ extendComponentView({
82698
83344
  offsetX: payload.x,
82699
83345
  offsetY: payload.y,
82700
83346
  position: payload.position,
82701
- target: api.getZr().findHover(payload.x, payload.y).target,
82702
- event: {}
83347
+ target: api.getZr().findHover(payload.x, payload.y).target
82703
83348
  }, dispatchAction);
82704
83349
  }
82705
83350
  },
@@ -82805,7 +83450,9 @@ extendComponentView({
82805
83450
  _showAxisTooltip: function (dataByCoordSys, e) {
82806
83451
  var ecModel = this._ecModel;
82807
83452
  var globalTooltipModel = this._tooltipModel;
83453
+
82808
83454
  var point = [e.offsetX, e.offsetY];
83455
+
82809
83456
  var singleDefaultHTML = [];
82810
83457
  var singleParamsList = [];
82811
83458
  var singleTooltipModel = buildTooltipModel([
@@ -83061,6 +83708,7 @@ extendComponentView({
83061
83708
  _updatePosition: function (tooltipModel, positionExpr, x, y, content, params, el) {
83062
83709
  var viewWidth = this._api.getWidth();
83063
83710
  var viewHeight = this._api.getHeight();
83711
+
83064
83712
  positionExpr = positionExpr || tooltipModel.get('position');
83065
83713
 
83066
83714
  var contentSize = content.getSize();
@@ -83179,7 +83827,7 @@ extendComponentView({
83179
83827
  if (env$1.node) {
83180
83828
  return;
83181
83829
  }
83182
- this._tooltipContent.hide();
83830
+ this._tooltipContent.dispose();
83183
83831
  unregister('itemTooltip', api);
83184
83832
  }
83185
83833
  });
@@ -83764,16 +84412,19 @@ var PRIORITY_BRUSH = PRIORITY.VISUAL.BRUSH;
83764
84412
  */
83765
84413
  registerLayout(PRIORITY_BRUSH, function (ecModel, api, payload) {
83766
84414
  ecModel.eachComponent({mainType: 'brush'}, function (brushModel) {
83767
-
83768
84415
  payload && payload.type === 'takeGlobalCursor' && brushModel.setBrushOption(
83769
84416
  payload.key === 'brush' ? payload.brushOption : {brushType: false}
83770
84417
  );
84418
+ });
84419
+ layoutCovers(ecModel);
84420
+ });
83771
84421
 
84422
+ function layoutCovers(ecModel) {
84423
+ ecModel.eachComponent({mainType: 'brush'}, function (brushModel) {
83772
84424
  var brushTargetManager = brushModel.brushTargetManager = new BrushTargetManager(brushModel.option, ecModel);
83773
-
83774
84425
  brushTargetManager.setInputRanges(brushModel.areas, ecModel);
83775
84426
  });
83776
- });
84427
+ }
83777
84428
 
83778
84429
  /**
83779
84430
  * Register the visual encoding if this modules required.
@@ -84288,7 +84939,13 @@ extendComponentView({
84288
84939
  /**
84289
84940
  * @override
84290
84941
  */
84291
- updateTransform: updateController,
84942
+ updateTransform: function (brushModel, ecModel) {
84943
+ // PENDING: `updateTransform` is a little tricky, whose layout need
84944
+ // to be calculate mandatorily and other stages will not be performed.
84945
+ // Take care the correctness of the logic. See #11754 .
84946
+ layoutCovers(ecModel);
84947
+ return updateController.apply(this, arguments);
84948
+ },
84292
84949
 
84293
84950
  /**
84294
84951
  * @override
@@ -86380,8 +87037,8 @@ function markerTypeCalculatorWithExtent(
86380
87037
 
86381
87038
  var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];
86382
87039
  coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);
86383
- coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex);
86384
-
87040
+ coordArr[targetCoordIndex] = data.get(calcDataDim, dataIndex);
87041
+ var coordArrValue = data.get(targetDataDim, dataIndex);
86385
87042
  // Make it simple, do not visit all stacked value to count precision.
86386
87043
  var precision = getPrecision(data.get(targetDataDim, dataIndex));
86387
87044
  precision = Math.min(precision, 20);
@@ -86389,7 +87046,7 @@ function markerTypeCalculatorWithExtent(
86389
87046
  coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
86390
87047
  }
86391
87048
 
86392
- return coordArr;
87049
+ return [coordArr, coordArrValue];
86393
87050
  }
86394
87051
 
86395
87052
  var curry$5 = curry;
@@ -86452,12 +87109,15 @@ function dataTransform(seriesModel, item) {
86452
87109
  var otherCoordIndex = indexOf$2(dims, axisInfo.baseAxis.dim);
86453
87110
  var targetCoordIndex = indexOf$2(dims, axisInfo.valueAxis.dim);
86454
87111
 
86455
- item.coord = markerTypeCalculator[item.type](
87112
+ var coordInfo = markerTypeCalculator[item.type](
86456
87113
  data, axisInfo.baseDataDim, axisInfo.valueDataDim,
86457
87114
  otherCoordIndex, targetCoordIndex
86458
87115
  );
87116
+ item.coord = coordInfo[0];
86459
87117
  // Force to use the value of calculated value.
86460
- item.value = item.coord[targetCoordIndex];
87118
+ // let item use the value without stack.
87119
+ item.value = coordInfo[1];
87120
+
86461
87121
  }
86462
87122
  else {
86463
87123
  // FIXME Only has one of xAxis and yAxis.
@@ -86849,7 +87509,8 @@ MarkerModel.extend({
86849
87509
  },
86850
87510
  label: {
86851
87511
  show: true,
86852
- position: 'end'
87512
+ position: 'end',
87513
+ distance: 5
86853
87514
  },
86854
87515
  lineStyle: {
86855
87516
  type: 'dashed'
@@ -89299,26 +89960,28 @@ var ScrollableLegendView = LegendView.extend({
89299
89960
  },
89300
89961
 
89301
89962
  _findTargetItemIndex: function (targetDataIndex) {
89963
+ if (!this._showController) {
89964
+ return 0;
89965
+ }
89966
+
89302
89967
  var index;
89303
89968
  var contentGroup = this.getContentGroup();
89304
89969
  var defaultIndex;
89305
89970
 
89306
- if (this._showController) {
89307
- contentGroup.eachChild(function (child, idx) {
89308
- var legendDataIdx = child.__legendDataIndex;
89309
- // FIXME
89310
- // If the given targetDataIndex (from model) is illegal,
89311
- // we use defualtIndex. But the index on the legend model and
89312
- // action payload is still illegal. That case will not be
89313
- // changed until some scenario requires.
89314
- if (defaultIndex == null && legendDataIdx != null) {
89315
- defaultIndex = idx;
89316
- }
89317
- if (legendDataIdx === targetDataIndex) {
89318
- index = idx;
89319
- }
89320
- });
89321
- }
89971
+ contentGroup.eachChild(function (child, idx) {
89972
+ var legendDataIdx = child.__legendDataIndex;
89973
+ // FIXME
89974
+ // If the given targetDataIndex (from model) is illegal,
89975
+ // we use defualtIndex. But the index on the legend model and
89976
+ // action payload is still illegal. That case will not be
89977
+ // changed until some scenario requires.
89978
+ if (defaultIndex == null && legendDataIdx != null) {
89979
+ defaultIndex = idx;
89980
+ }
89981
+ if (legendDataIdx === targetDataIndex) {
89982
+ index = idx;
89983
+ }
89984
+ });
89322
89985
 
89323
89986
  return index != null ? index : defaultIndex;
89324
89987
  }