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
package/dist/echarts.js CHANGED
@@ -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
  };
@@ -26274,6 +26376,14 @@ function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
26274
26376
  task.dirty();
26275
26377
  }
26276
26378
  var performArgs = scheduler.getPerformArgs(task, opt.block);
26379
+ // FIXME
26380
+ // if intending to decalare `performRawSeries` in handlers, only
26381
+ // stream-independent (specifically, data item independent) operations can be
26382
+ // performed. Because is a series is filtered, most of the tasks will not
26383
+ // be performed. A stream-dependent operation probably cause wrong biz logic.
26384
+ // Perhaps we should not provide a separate callback for this case instead
26385
+ // of providing the config `performRawSeries`. The stream-dependent operaions
26386
+ // and stream-independent operations should better not be mixed.
26277
26387
  performArgs.skip = !stageHandler.performRawSeries
26278
26388
  && ecModel.isSeriesFiltered(task.context.model);
26279
26389
  updatePayload(task, payload);
@@ -27652,10 +27762,10 @@ var isFunction = isFunction$1;
27652
27762
  var isObject = isObject$1;
27653
27763
  var parseClassType = ComponentModel.parseClassType;
27654
27764
 
27655
- var version = '4.6.0';
27765
+ var version = '4.7.0';
27656
27766
 
27657
27767
  var dependencies = {
27658
- zrender: '4.2.0'
27768
+ zrender: '4.3.0'
27659
27769
  };
27660
27770
 
27661
27771
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -33940,7 +34050,7 @@ var IntervalScale = Scale.extend({
33940
34050
 
33941
34051
  if (extent[0] < niceTickExtent[0]) {
33942
34052
  if (expandToNicedExtent) {
33943
- ticks.push(roundNumber(niceTickExtent[0] - interval));
34053
+ ticks.push(roundNumber(niceTickExtent[0] - interval, intervalPrecision));
33944
34054
  }
33945
34055
  else {
33946
34056
  ticks.push(extent[0]);
@@ -33966,7 +34076,7 @@ var IntervalScale = Scale.extend({
33966
34076
  var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
33967
34077
  if (extent[1] > lastNiceTick) {
33968
34078
  if (expandToNicedExtent) {
33969
- ticks.push(lastNiceTick + interval);
34079
+ ticks.push(roundNumber(lastNiceTick + interval, intervalPrecision));
33970
34080
  }
33971
34081
  else {
33972
34082
  ticks.push(extent[1]);
@@ -34541,11 +34651,6 @@ function layout(seriesType, ecModel) {
34541
34651
  var value = data.get(valueDim, idx);
34542
34652
  var baseValue = data.get(baseDim, idx);
34543
34653
 
34544
- // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
34545
- if (isNaN(value) || isNaN(baseValue)) {
34546
- continue;
34547
- }
34548
-
34549
34654
  var sign = value >= 0 ? 'p' : 'n';
34550
34655
  var baseCoord = valueAxisStart;
34551
34656
 
@@ -34578,7 +34683,10 @@ function layout(seriesType, ecModel) {
34578
34683
  if (Math.abs(width) < barMinHeight) {
34579
34684
  width = (width < 0 ? -1 : 1) * barMinHeight;
34580
34685
  }
34581
- stacked && (lastStackCoords[stackId][baseValue][sign] += width);
34686
+ // Ignore stack from NaN value
34687
+ if (!isNaN(width)) {
34688
+ stacked && (lastStackCoords[stackId][baseValue][sign] += width);
34689
+ }
34582
34690
  }
34583
34691
  else {
34584
34692
  var coord = cartesian.dataToPoint([baseValue, value]);
@@ -34591,7 +34699,10 @@ function layout(seriesType, ecModel) {
34591
34699
  // Include zero to has a positive bar
34592
34700
  height = (height <= 0 ? -1 : 1) * barMinHeight;
34593
34701
  }
34594
- stacked && (lastStackCoords[stackId][baseValue][sign] += height);
34702
+ // Ignore stack from NaN value
34703
+ if (!isNaN(height)) {
34704
+ stacked && (lastStackCoords[stackId][baseValue][sign] += height);
34705
+ }
34595
34706
  }
34596
34707
 
34597
34708
  data.setItemLayout(idx, {
@@ -34619,6 +34730,7 @@ var largeLayout = {
34619
34730
 
34620
34731
  var data = seriesModel.getData();
34621
34732
  var cartesian = seriesModel.coordinateSystem;
34733
+ var coordLayout = cartesian.grid.getRect();
34622
34734
  var baseAxis = cartesian.getBaseAxis();
34623
34735
  var valueAxis = cartesian.getOtherAxis(baseAxis);
34624
34736
  var valueDim = data.mapDimension(valueAxis.dim);
@@ -34638,6 +34750,7 @@ var largeLayout = {
34638
34750
  function progress(params, data) {
34639
34751
  var count = params.count;
34640
34752
  var largePoints = new LargeArr(count * 2);
34753
+ var largeBackgroundPoints = new LargeArr(count * 2);
34641
34754
  var largeDataIndices = new LargeArr(count);
34642
34755
  var dataIndex;
34643
34756
  var coord = [];
@@ -34651,7 +34764,9 @@ var largeLayout = {
34651
34764
 
34652
34765
  coord = cartesian.dataToPoint(valuePair, null, coord);
34653
34766
  // Data index might not be in order, depends on `progressiveChunkMode`.
34767
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
34654
34768
  largePoints[pointsOffset++] = coord[0];
34769
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
34655
34770
  largePoints[pointsOffset++] = coord[1];
34656
34771
  largeDataIndices[idxOffset++] = dataIndex;
34657
34772
  }
@@ -34659,8 +34774,10 @@ var largeLayout = {
34659
34774
  data.setLayout({
34660
34775
  largePoints: largePoints,
34661
34776
  largeDataIndices: largeDataIndices,
34777
+ largeBackgroundPoints: largeBackgroundPoints,
34662
34778
  barWidth: barWidth,
34663
34779
  valueAxisStart: getValueAxisStart(baseAxis, valueAxis, false),
34780
+ backgroundStart: valueAxisHorizontal ? coordLayout.x : coordLayout.y,
34664
34781
  valueAxisHorizontal: valueAxisHorizontal
34665
34782
  });
34666
34783
  }
@@ -42547,6 +42664,117 @@ function layout$1(gridModel, axisModel, opt) {
42547
42664
  * under the License.
42548
42665
  */
42549
42666
 
42667
+ function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
42668
+ var axis = axisModel.axis;
42669
+
42670
+ if (axis.scale.isBlank()) {
42671
+ return;
42672
+ }
42673
+
42674
+ var splitAreaModel = axisModel.getModel('splitArea');
42675
+ var areaStyleModel = splitAreaModel.getModel('areaStyle');
42676
+ var areaColors = areaStyleModel.get('color');
42677
+
42678
+ var gridRect = gridModel.coordinateSystem.getRect();
42679
+
42680
+ var ticksCoords = axis.getTicksCoords({
42681
+ tickModel: splitAreaModel,
42682
+ clamp: true
42683
+ });
42684
+
42685
+ if (!ticksCoords.length) {
42686
+ return;
42687
+ }
42688
+
42689
+ // For Making appropriate splitArea animation, the color and anid
42690
+ // should be corresponding to previous one if possible.
42691
+ var areaColorsLen = areaColors.length;
42692
+ var lastSplitAreaColors = axisView.__splitAreaColors;
42693
+ var newSplitAreaColors = createHashMap();
42694
+ var colorIndex = 0;
42695
+ if (lastSplitAreaColors) {
42696
+ for (var i = 0; i < ticksCoords.length; i++) {
42697
+ var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
42698
+ if (cIndex != null) {
42699
+ colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
42700
+ break;
42701
+ }
42702
+ }
42703
+ }
42704
+
42705
+ var prev = axis.toGlobalCoord(ticksCoords[0].coord);
42706
+
42707
+ var areaStyle = areaStyleModel.getAreaStyle();
42708
+ areaColors = isArray(areaColors) ? areaColors : [areaColors];
42709
+
42710
+ for (var i = 1; i < ticksCoords.length; i++) {
42711
+ var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
42712
+
42713
+ var x;
42714
+ var y;
42715
+ var width;
42716
+ var height;
42717
+ if (axis.isHorizontal()) {
42718
+ x = prev;
42719
+ y = gridRect.y;
42720
+ width = tickCoord - x;
42721
+ height = gridRect.height;
42722
+ prev = x + width;
42723
+ }
42724
+ else {
42725
+ x = gridRect.x;
42726
+ y = prev;
42727
+ width = gridRect.width;
42728
+ height = tickCoord - y;
42729
+ prev = y + height;
42730
+ }
42731
+
42732
+ var tickValue = ticksCoords[i - 1].tickValue;
42733
+ tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
42734
+
42735
+ axisGroup.add(new Rect({
42736
+ anid: tickValue != null ? 'area_' + tickValue : null,
42737
+ shape: {
42738
+ x: x,
42739
+ y: y,
42740
+ width: width,
42741
+ height: height
42742
+ },
42743
+ style: defaults({
42744
+ fill: areaColors[colorIndex]
42745
+ }, areaStyle),
42746
+ silent: true
42747
+ }));
42748
+
42749
+ colorIndex = (colorIndex + 1) % areaColorsLen;
42750
+ }
42751
+
42752
+ axisView.__splitAreaColors = newSplitAreaColors;
42753
+ }
42754
+
42755
+ function rectCoordAxisHandleRemove(axisView) {
42756
+ axisView.__splitAreaColors = null;
42757
+ }
42758
+
42759
+ /*
42760
+ * Licensed to the Apache Software Foundation (ASF) under one
42761
+ * or more contributor license agreements. See the NOTICE file
42762
+ * distributed with this work for additional information
42763
+ * regarding copyright ownership. The ASF licenses this file
42764
+ * to you under the Apache License, Version 2.0 (the
42765
+ * "License"); you may not use this file except in compliance
42766
+ * with the License. You may obtain a copy of the License at
42767
+ *
42768
+ * http://www.apache.org/licenses/LICENSE-2.0
42769
+ *
42770
+ * Unless required by applicable law or agreed to in writing,
42771
+ * software distributed under the License is distributed on an
42772
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
42773
+ * KIND, either express or implied. See the License for the
42774
+ * specific language governing permissions and limitations
42775
+ * under the License.
42776
+ */
42777
+
42550
42778
  var axisBuilderAttrs = [
42551
42779
  'axisLine', 'axisTickLabel', 'axisName'
42552
42780
  ];
@@ -42598,7 +42826,7 @@ var CartesianAxisView = AxisView.extend({
42598
42826
  },
42599
42827
 
42600
42828
  remove: function () {
42601
- this._splitAreaColors = null;
42829
+ rectCoordAxisHandleRemove(this);
42602
42830
  },
42603
42831
 
42604
42832
  /**
@@ -42730,91 +42958,7 @@ var CartesianAxisView = AxisView.extend({
42730
42958
  * @private
42731
42959
  */
42732
42960
  _splitArea: function (axisModel, gridModel) {
42733
- var axis = axisModel.axis;
42734
-
42735
- if (axis.scale.isBlank()) {
42736
- return;
42737
- }
42738
-
42739
- var splitAreaModel = axisModel.getModel('splitArea');
42740
- var areaStyleModel = splitAreaModel.getModel('areaStyle');
42741
- var areaColors = areaStyleModel.get('color');
42742
-
42743
- var gridRect = gridModel.coordinateSystem.getRect();
42744
-
42745
- var ticksCoords = axis.getTicksCoords({
42746
- tickModel: splitAreaModel,
42747
- clamp: true
42748
- });
42749
-
42750
- if (!ticksCoords.length) {
42751
- return;
42752
- }
42753
-
42754
- // For Making appropriate splitArea animation, the color and anid
42755
- // should be corresponding to previous one if possible.
42756
- var areaColorsLen = areaColors.length;
42757
- var lastSplitAreaColors = this._splitAreaColors;
42758
- var newSplitAreaColors = createHashMap();
42759
- var colorIndex = 0;
42760
- if (lastSplitAreaColors) {
42761
- for (var i = 0; i < ticksCoords.length; i++) {
42762
- var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
42763
- if (cIndex != null) {
42764
- colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
42765
- break;
42766
- }
42767
- }
42768
- }
42769
-
42770
- var prev = axis.toGlobalCoord(ticksCoords[0].coord);
42771
-
42772
- var areaStyle = areaStyleModel.getAreaStyle();
42773
- areaColors = isArray(areaColors) ? areaColors : [areaColors];
42774
-
42775
- for (var i = 1; i < ticksCoords.length; i++) {
42776
- var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
42777
-
42778
- var x;
42779
- var y;
42780
- var width;
42781
- var height;
42782
- if (axis.isHorizontal()) {
42783
- x = prev;
42784
- y = gridRect.y;
42785
- width = tickCoord - x;
42786
- height = gridRect.height;
42787
- prev = x + width;
42788
- }
42789
- else {
42790
- x = gridRect.x;
42791
- y = prev;
42792
- width = gridRect.width;
42793
- height = tickCoord - y;
42794
- prev = y + height;
42795
- }
42796
-
42797
- var tickValue = ticksCoords[i - 1].tickValue;
42798
- tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
42799
-
42800
- this._axisGroup.add(new Rect({
42801
- anid: tickValue != null ? 'area_' + tickValue : null,
42802
- shape: {
42803
- x: x,
42804
- y: y,
42805
- width: width,
42806
- height: height
42807
- },
42808
- style: defaults({
42809
- fill: areaColors[colorIndex]
42810
- }, areaStyle),
42811
- silent: true
42812
- }));
42813
-
42814
- colorIndex = (colorIndex + 1) % areaColorsLen;
42815
- }
42816
-
42817
- this._splitAreaColors = newSplitAreaColors;
42961
+ rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, gridModel);
42818
42962
  }
42819
42963
  });
42820
42964
 
@@ -43060,7 +43204,21 @@ BaseBarSeries.extend({
43060
43204
 
43061
43205
  // If use caps on two sides of bars
43062
43206
  // Only available on tangential polar bar
43063
- roundCap: false
43207
+ roundCap: false,
43208
+
43209
+ showBackground: false,
43210
+ backgroundStyle: {
43211
+ color: 'rgba(180, 180, 180, 0.2)',
43212
+ borderColor: null,
43213
+ borderWidth: 0,
43214
+ borderType: 'solid',
43215
+ borderRadius: 0,
43216
+ shadowBlur: 0,
43217
+ shadowColor: null,
43218
+ shadowOffsetX: 0,
43219
+ shadowOffsetY: 0,
43220
+ opacity: 1
43221
+ }
43064
43222
  }
43065
43223
  });
43066
43224
 
@@ -43365,15 +43523,28 @@ extendChartView({
43365
43523
 
43366
43524
  var roundCap = seriesModel.get('roundCap', true);
43367
43525
 
43526
+ var drawBackground = seriesModel.get('showBackground', true);
43527
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
43528
+
43529
+ var bgEls = [];
43530
+ var oldBgEls = this._backgroundEls || [];
43531
+
43368
43532
  data.diff(oldData)
43369
43533
  .add(function (dataIndex) {
43534
+ var itemModel = data.getItemModel(dataIndex);
43535
+ var layout = getLayout[coord.type](data, dataIndex, itemModel);
43536
+
43537
+ if (drawBackground) {
43538
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
43539
+ bgEl.useStyle(backgroundModel.getBarItemStyle());
43540
+ bgEls[dataIndex] = bgEl;
43541
+ }
43542
+
43543
+ // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
43370
43544
  if (!data.hasValue(dataIndex)) {
43371
43545
  return;
43372
43546
  }
43373
43547
 
43374
- var itemModel = data.getItemModel(dataIndex);
43375
- var layout = getLayout[coord.type](data, dataIndex, itemModel);
43376
-
43377
43548
  if (needsClip) {
43378
43549
  // Clip will modify the layout params.
43379
43550
  // And return a boolean to determine if the shape are fully clipped.
@@ -43396,16 +43567,24 @@ extendChartView({
43396
43567
  );
43397
43568
  })
43398
43569
  .update(function (newIndex, oldIndex) {
43399
- var el = oldData.getItemGraphicEl(oldIndex);
43570
+ var itemModel = data.getItemModel(newIndex);
43571
+ var layout = getLayout[coord.type](data, newIndex, itemModel);
43572
+
43573
+ if (drawBackground) {
43574
+ var bgEl = oldBgEls[oldIndex];
43575
+ bgEl.useStyle(backgroundModel.getBarItemStyle());
43576
+ bgEls[newIndex] = bgEl;
43400
43577
 
43578
+ var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
43579
+ updateProps(bgEl, { shape: shape }, animationModel, newIndex);
43580
+ }
43581
+
43582
+ var el = oldData.getItemGraphicEl(oldIndex);
43401
43583
  if (!data.hasValue(newIndex)) {
43402
43584
  group.remove(el);
43403
43585
  return;
43404
43586
  }
43405
43587
 
43406
- var itemModel = data.getItemModel(newIndex);
43407
- var layout = getLayout[coord.type](data, newIndex, itemModel);
43408
-
43409
43588
  if (needsClip) {
43410
43589
  var isClipped = clip[coord.type](coordSysClipArea, layout);
43411
43590
  if (isClipped) {
@@ -43443,6 +43622,15 @@ extendChartView({
43443
43622
  })
43444
43623
  .execute();
43445
43624
 
43625
+ var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());
43626
+ bgGroup.removeAll();
43627
+
43628
+ for (var i = 0; i < bgEls.length; ++i) {
43629
+ bgGroup.add(bgEls[i]);
43630
+ }
43631
+ group.add(bgGroup);
43632
+ this._backgroundEls = bgEls;
43633
+
43446
43634
  this._data = data;
43447
43635
  },
43448
43636
 
@@ -43463,6 +43651,7 @@ extendChartView({
43463
43651
  },
43464
43652
 
43465
43653
  _incrementalRenderLarge: function (params, seriesModel) {
43654
+ this._removeBackground();
43466
43655
  createLarge(seriesModel, this.group, true);
43467
43656
  },
43468
43657
 
@@ -43476,6 +43665,9 @@ extendChartView({
43476
43665
  var group = this.group;
43477
43666
  var data = this._data;
43478
43667
  if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
43668
+ this._removeBackground();
43669
+ this._backgroundEls = [];
43670
+
43479
43671
  data.eachItemGraphicEl(function (el) {
43480
43672
  if (el.type === 'sector') {
43481
43673
  removeSector(el.dataIndex, ecModel, el);
@@ -43489,6 +43681,11 @@ extendChartView({
43489
43681
  group.removeAll();
43490
43682
  }
43491
43683
  this._data = null;
43684
+ },
43685
+
43686
+ _removeBackground: function () {
43687
+ this.group.remove(this._backgroundGroup);
43688
+ this._backgroundGroup = null;
43492
43689
  }
43493
43690
 
43494
43691
  });
@@ -43546,7 +43743,12 @@ var elementCreator = {
43546
43743
  dataIndex, layout, isHorizontal,
43547
43744
  animationModel, isUpdate
43548
43745
  ) {
43549
- var rect = new Rect({shape: extend({}, layout)});
43746
+ var rect = new Rect({
43747
+ shape: extend({}, layout),
43748
+ z2: 1
43749
+ });
43750
+
43751
+ rect.name = 'item';
43550
43752
 
43551
43753
  // Animation
43552
43754
  if (animationModel) {
@@ -43576,9 +43778,12 @@ var elementCreator = {
43576
43778
  var ShapeClass = (!isRadial && roundCap) ? Sausage : Sector;
43577
43779
 
43578
43780
  var sector = new ShapeClass({
43579
- shape: defaults({clockwise: clockwise}, layout)
43781
+ shape: defaults({clockwise: clockwise}, layout),
43782
+ z2: 1
43580
43783
  });
43581
43784
 
43785
+ sector.name = 'item';
43786
+
43582
43787
  // Animation
43583
43788
  if (animationModel) {
43584
43789
  var sectorShape = sector.shape;
@@ -43698,7 +43903,10 @@ function updateStyle(
43698
43903
  // In case width or height are too small.
43699
43904
  function getLineWidth(itemModel, rawLayout) {
43700
43905
  var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
43701
- return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height));
43906
+ // width or height may be NaN for empty data
43907
+ var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
43908
+ var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
43909
+ return Math.min(lineWidth, width, height);
43702
43910
  }
43703
43911
 
43704
43912
 
@@ -43730,13 +43938,38 @@ function createLarge(seriesModel, group, incremental) {
43730
43938
  var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
43731
43939
  startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart');
43732
43940
 
43941
+ var largeDataIndices = data.getLayout('largeDataIndices');
43942
+ var barWidth = data.getLayout('barWidth');
43943
+
43944
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
43945
+ var drawBackground = seriesModel.get('showBackground', true);
43946
+
43947
+ if (drawBackground) {
43948
+ var points = data.getLayout('largeBackgroundPoints');
43949
+ var backgroundStartPoint = [];
43950
+ backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart');
43951
+
43952
+ var bgEl = new LargePath({
43953
+ shape: {points: points},
43954
+ incremental: !!incremental,
43955
+ __startPoint: backgroundStartPoint,
43956
+ __baseDimIdx: baseDimIdx,
43957
+ __largeDataIndices: largeDataIndices,
43958
+ __barWidth: barWidth,
43959
+ silent: true,
43960
+ z2: 0
43961
+ });
43962
+ setLargeBackgroundStyle(bgEl, backgroundModel, data);
43963
+ group.add(bgEl);
43964
+ }
43965
+
43733
43966
  var el = new LargePath({
43734
43967
  shape: {points: data.getLayout('largePoints')},
43735
43968
  incremental: !!incremental,
43736
43969
  __startPoint: startPoint,
43737
43970
  __baseDimIdx: baseDimIdx,
43738
- __largeDataIndices: data.getLayout('largeDataIndices'),
43739
- __barWidth: data.getLayout('barWidth')
43971
+ __largeDataIndices: largeDataIndices,
43972
+ __barWidth: barWidth
43740
43973
  });
43741
43974
  group.add(el);
43742
43975
  setLargeStyle(el, seriesModel, data);
@@ -43801,6 +44034,55 @@ function setLargeStyle(el, seriesModel, data) {
43801
44034
  el.style.lineWidth = data.getLayout('barWidth');
43802
44035
  }
43803
44036
 
44037
+ function setLargeBackgroundStyle(el, backgroundModel, data) {
44038
+ var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color');
44039
+ var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']);
44040
+
44041
+ el.useStyle(itemStyle);
44042
+ el.style.fill = null;
44043
+ el.style.stroke = borderColor;
44044
+ el.style.lineWidth = data.getLayout('barWidth');
44045
+ }
44046
+
44047
+ function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
44048
+ var coordLayout;
44049
+ var isPolar = coord.type === 'polar';
44050
+ if (isPolar) {
44051
+ coordLayout = coord.getArea();
44052
+ }
44053
+ else {
44054
+ coordLayout = coord.grid.getRect();
44055
+ }
44056
+
44057
+ if (isPolar) {
44058
+ return {
44059
+ cx: coordLayout.cx,
44060
+ cy: coordLayout.cy,
44061
+ r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0,
44062
+ r: isHorizontalOrRadial ? coordLayout.r : layout.r,
44063
+ startAngle: isHorizontalOrRadial ? layout.startAngle : 0,
44064
+ endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2
44065
+ };
44066
+ }
44067
+ else {
44068
+ return {
44069
+ x: isHorizontalOrRadial ? layout.x : coordLayout.x,
44070
+ y: isHorizontalOrRadial ? coordLayout.y : layout.y,
44071
+ width: isHorizontalOrRadial ? layout.width : coordLayout.width,
44072
+ height: isHorizontalOrRadial ? coordLayout.height : layout.height
44073
+ };
44074
+ }
44075
+ }
44076
+
44077
+ function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
44078
+ var ElementClz = coord.type === 'polar' ? Sector : Rect;
44079
+ return new ElementClz({
44080
+ shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
44081
+ silent: true,
44082
+ z2: 0
44083
+ });
44084
+ }
44085
+
43804
44086
  /*
43805
44087
  * Licensed to the Apache Software Foundation (ASF) under one
43806
44088
  * or more contributor license agreements. See the NOTICE file
@@ -44410,7 +44692,7 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
44410
44692
  toggleItemSelected(
44411
44693
  this,
44412
44694
  data.getItemLayout(idx),
44413
- seriesModel.isSelected(null, idx),
44695
+ seriesModel.isSelected(data.getName(idx)),
44414
44696
  seriesModel.get('selectedOffset'),
44415
44697
  seriesModel.get('animation')
44416
44698
  );
@@ -45162,7 +45444,7 @@ var labelLayout = function (seriesModel, r, viewWidth, viewHeight, viewLeft, vie
45162
45444
  inside: isLabelInside,
45163
45445
  labelDistance: labelDistance,
45164
45446
  labelAlignTo: labelAlignTo,
45165
- labelMargin:labelMargin,
45447
+ labelMargin: labelMargin,
45166
45448
  bleedMargin: bleedMargin,
45167
45449
  textRect: textRect,
45168
45450
  text: text,
@@ -46205,6 +46487,7 @@ Radar.prototype.update = function (ecModel, api) {
46205
46487
  var fixedMax = axisModel.getMax();
46206
46488
  var interval = scale.getInterval();
46207
46489
 
46490
+
46208
46491
  if (fixedMin != null && fixedMax != null) {
46209
46492
  // User set min, max, divide to get new interval
46210
46493
  scale.setExtent(+fixedMin, +fixedMax);
@@ -46240,13 +46523,10 @@ Radar.prototype.update = function (ecModel, api) {
46240
46523
  if (nicedSplitNumber > splitNumber) {
46241
46524
  interval = increaseInterval(interval);
46242
46525
  }
46243
- // PENDING
46244
- var center = Math.round((rawExtent[0] + rawExtent[1]) / 2 / interval) * interval;
46245
- var halfSplitNumber = Math.round(splitNumber / 2);
46246
- scale.setExtent(
46247
- round$1(center - halfSplitNumber * interval),
46248
- round$1(center + (splitNumber - halfSplitNumber) * interval)
46249
- );
46526
+ // TODO
46527
+ var max = Math.ceil(rawExtent[1] / interval) * interval;
46528
+ var min = round$1(max - interval * splitNumber);
46529
+ scale.setExtent(min, max);
46250
46530
  scale.setInterval(interval);
46251
46531
  }
46252
46532
  });
@@ -46694,6 +46974,28 @@ var RadarSeries = SeriesModel.extend({
46694
46974
  }).join('<br />');
46695
46975
  },
46696
46976
 
46977
+ /**
46978
+ * @implement
46979
+ */
46980
+ getTooltipPosition: function (dataIndex) {
46981
+ if (dataIndex != null) {
46982
+ var data = this.getData();
46983
+ var coordSys = this.coordinateSystem;
46984
+ var values = data.getValues(
46985
+ map(coordSys.dimensions, function (dim) {
46986
+ return data.mapDimension(dim);
46987
+ }), dataIndex, true
46988
+ );
46989
+
46990
+ for (var i = 0, len = values.length; i < len; i++) {
46991
+ if (!isNaN(values[i])) {
46992
+ var indicatorAxes = coordSys.getIndicatorAxes();
46993
+ return coordSys.coordToPoint(indicatorAxes[i].dataToCoord(values[i]), i);
46994
+ }
46995
+ }
46996
+ }
46997
+ },
46998
+
46697
46999
  defaultOption: {
46698
47000
  zlevel: 0,
46699
47001
  z: 2,
@@ -48468,13 +48770,13 @@ MapDraw.prototype = {
48468
48770
  var regionsGroup = this._regionsGroup;
48469
48771
  var group = this.group;
48470
48772
 
48471
- if (geo._roamTransformable.transform) {
48472
- group.transform = geo._roamTransformable.transform.slice();
48473
- group.decomposeTransform();
48474
- }
48773
+ var transformInfo = geo.getTransformInfo();
48774
+ group.transform = transformInfo.roamTransform;
48775
+ group.decomposeTransform();
48776
+ group.dirty();
48475
48777
 
48476
- var scale = geo._rawTransformable.scale;
48477
- var position = geo._rawTransformable.position;
48778
+ var scale = transformInfo.rawScale;
48779
+ var position = transformInfo.rawPosition;
48478
48780
 
48479
48781
  regionsGroup.removeAll();
48480
48782
 
@@ -49280,7 +49582,6 @@ View.prototype = {
49280
49582
  /**
49281
49583
  * Remove roam
49282
49584
  */
49283
-
49284
49585
  _updateCenterAndZoom: function () {
49285
49586
  // Must update after view transform updated
49286
49587
  var rawTransformMatrix = this._rawTransformable.getLocalTransform();
@@ -49324,6 +49625,16 @@ View.prototype = {
49324
49625
  this.decomposeTransform();
49325
49626
  },
49326
49627
 
49628
+ getTransformInfo: function () {
49629
+ var roamTransform = this._roamTransformable.transform;
49630
+ var rawTransformable = this._rawTransformable;
49631
+ return {
49632
+ roamTransform: roamTransform ? slice(roamTransform) : create$1(),
49633
+ rawScale: slice(rawTransformable.scale),
49634
+ rawPosition: slice(rawTransformable.position)
49635
+ };
49636
+ },
49637
+
49327
49638
  /**
49328
49639
  * @return {module:zrender/core/BoundingRect}
49329
49640
  */
@@ -50940,6 +51251,11 @@ SeriesModel.extend({
50940
51251
  // the layout of the tree, two value can be selected, 'orthogonal' or 'radial'
50941
51252
  layout: 'orthogonal',
50942
51253
 
51254
+ // value can be 'polyline'
51255
+ edgeShape: 'curve',
51256
+
51257
+ edgeForkPosition: '50%',
51258
+
50943
51259
  // true | false | 'move' | 'scale', see module:component/helper/RoamController.
50944
51260
  roam: false,
50945
51261
 
@@ -51344,6 +51660,58 @@ function defaultSeparation(node1, node2) {
51344
51660
  * under the License.
51345
51661
  */
51346
51662
 
51663
+ var TreeShape = extendShape({
51664
+ shape: {
51665
+ parentPoint: [],
51666
+ childPoints: [],
51667
+ orient: '',
51668
+ forkPosition: ''
51669
+ },
51670
+
51671
+ style: {
51672
+ stroke: '#000',
51673
+ fill: null
51674
+ },
51675
+
51676
+ buildPath: function (ctx, shape) {
51677
+ var childPoints = shape.childPoints;
51678
+ var childLen = childPoints.length;
51679
+ var parentPoint = shape.parentPoint;
51680
+ var firstChildPos = childPoints[0];
51681
+ var lastChildPos = childPoints[childLen - 1];
51682
+
51683
+ if (childLen === 1) {
51684
+ ctx.moveTo(parentPoint[0], parentPoint[1]);
51685
+ ctx.lineTo(firstChildPos[0], firstChildPos[1]);
51686
+ return;
51687
+ }
51688
+
51689
+ var orient = shape.orient;
51690
+ var forkDim = (orient === 'TB' || orient === 'BT') ? 0 : 1;
51691
+ var otherDim = 1 - forkDim;
51692
+ var forkPosition = parsePercent$1(shape.forkPosition, 1);
51693
+ var tmpPoint = [];
51694
+ tmpPoint[forkDim] = parentPoint[forkDim];
51695
+ tmpPoint[otherDim] = parentPoint[otherDim] + (lastChildPos[otherDim] - parentPoint[otherDim]) * forkPosition;
51696
+
51697
+ ctx.moveTo(parentPoint[0], parentPoint[1]);
51698
+ ctx.lineTo(tmpPoint[0], tmpPoint[1]);
51699
+ ctx.moveTo(firstChildPos[0], firstChildPos[1]);
51700
+ tmpPoint[forkDim] = firstChildPos[forkDim];
51701
+ ctx.lineTo(tmpPoint[0], tmpPoint[1]);
51702
+ tmpPoint[forkDim] = lastChildPos[forkDim];
51703
+ ctx.lineTo(tmpPoint[0], tmpPoint[1]);
51704
+ ctx.lineTo(lastChildPos[0], lastChildPos[1]);
51705
+
51706
+ for (var i = 1; i < childLen - 1; i++) {
51707
+ var point = childPoints[i];
51708
+ ctx.moveTo(point[0], point[1]);
51709
+ tmpPoint[forkDim] = point[forkDim];
51710
+ ctx.lineTo(tmpPoint[0], tmpPoint[1]);
51711
+ }
51712
+ }
51713
+ });
51714
+
51347
51715
  extendChartView({
51348
51716
 
51349
51717
  type: 'tree',
@@ -51403,6 +51771,8 @@ extendChartView({
51403
51771
  var seriesScope = {
51404
51772
  expandAndCollapse: seriesModel.get('expandAndCollapse'),
51405
51773
  layout: layout,
51774
+ edgeShape: seriesModel.get('edgeShape'),
51775
+ edgeForkPosition: seriesModel.get('edgeForkPosition'),
51406
51776
  orient: seriesModel.getOrient(),
51407
51777
  curvature: seriesModel.get('lineStyle.curveness'),
51408
51778
  symbolRotate: seriesModel.get('symbolRotate'),
@@ -51704,22 +52074,72 @@ function updateNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
51704
52074
  });
51705
52075
  }
51706
52076
 
51707
- if (node.parentNode && node.parentNode !== virtualRoot) {
51708
- var edge = symbolEl.__edge;
51709
- if (!edge) {
51710
- edge = symbolEl.__edge = new BezierCurve({
51711
- shape: getEdgeShape(seriesScope, sourceOldLayout, sourceOldLayout),
51712
- style: defaults({opacity: 0, strokeNoScale: true}, seriesScope.lineStyle)
51713
- });
51714
- }
52077
+ drawEdge(
52078
+ seriesModel, node, virtualRoot, symbolEl, sourceOldLayout,
52079
+ sourceLayout, targetLayout, group, seriesScope
52080
+ );
51715
52081
 
51716
- updateProps(edge, {
51717
- shape: getEdgeShape(seriesScope, sourceLayout, targetLayout),
51718
- style: {opacity: 1}
51719
- }, seriesModel);
52082
+ }
52083
+
52084
+ function drawEdge(
52085
+ seriesModel, node, virtualRoot, symbolEl, sourceOldLayout,
52086
+ sourceLayout, targetLayout, group, seriesScope
52087
+ ) {
52088
+
52089
+ var edgeShape = seriesScope.edgeShape;
52090
+ var edge = symbolEl.__edge;
52091
+ if (edgeShape === 'curve') {
52092
+ if (node.parentNode && node.parentNode !== virtualRoot) {
52093
+ if (!edge) {
52094
+ edge = symbolEl.__edge = new BezierCurve({
52095
+ shape: getEdgeShape(seriesScope, sourceOldLayout, sourceOldLayout),
52096
+ style: defaults({opacity: 0, strokeNoScale: true}, seriesScope.lineStyle)
52097
+ });
52098
+ }
52099
+
52100
+ updateProps(edge, {
52101
+ shape: getEdgeShape(seriesScope, sourceLayout, targetLayout),
52102
+ style: {opacity: 1}
52103
+ }, seriesModel);
52104
+ }
52105
+ }
52106
+ else if (edgeShape === 'polyline') {
52107
+ if (seriesScope.layout === 'orthogonal') {
52108
+ if (node !== virtualRoot && node.children && (node.children.length !== 0) && (node.isExpand === true)) {
52109
+ var children = node.children;
52110
+ var childPoints = [];
52111
+ for (var i = 0; i < children.length; i++) {
52112
+ var childLayout = children[i].getLayout();
52113
+ childPoints.push([childLayout.x, childLayout.y]);
52114
+ }
51720
52115
 
51721
- group.add(edge);
52116
+ if (!edge) {
52117
+ edge = symbolEl.__edge = new TreeShape({
52118
+ shape: {
52119
+ parentPoint: [targetLayout.x, targetLayout.y],
52120
+ childPoints: [[targetLayout.x, targetLayout.y]],
52121
+ orient: seriesScope.orient,
52122
+ forkPosition: seriesScope.edgeForkPosition
52123
+ },
52124
+ style: defaults({opacity: 0, strokeNoScale: true}, seriesScope.lineStyle)
52125
+ });
52126
+ }
52127
+ updateProps(edge, {
52128
+ shape: {
52129
+ parentPoint: [targetLayout.x, targetLayout.y],
52130
+ childPoints: childPoints
52131
+ },
52132
+ style: {opacity: 1}
52133
+ }, seriesModel);
52134
+ }
52135
+ }
52136
+ else {
52137
+ if (__DEV__) {
52138
+ throw new Error('The polyline edgeShape can only be used in orthogonal layout');
52139
+ }
52140
+ }
51722
52141
  }
52142
+ group.add(edge);
51723
52143
  }
51724
52144
 
51725
52145
  function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope) {
@@ -51729,6 +52149,7 @@ function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
51729
52149
  var seriesScope = getTreeNodeStyle(node, itemModel, seriesScope);
51730
52150
 
51731
52151
  var source = node.parentNode === virtualRoot ? node : node.parentNode || node;
52152
+ var edgeShape = seriesScope.edgeShape;
51732
52153
  var sourceLayout;
51733
52154
  while (sourceLayout = source.getLayout(), sourceLayout == null) {
51734
52155
  source = source.parentNode === virtualRoot ? source : source.parentNode || source;
@@ -51743,16 +52164,42 @@ function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope)
51743
52164
 
51744
52165
  symbolEl.fadeOut(null, {keepLabel: true});
51745
52166
 
51746
- var edge = symbolEl.__edge;
52167
+ var sourceSymbolEl = data.getItemGraphicEl(source.dataIndex);
52168
+ var sourceEdge = sourceSymbolEl.__edge;
52169
+
52170
+ // 1. when expand the sub tree, delete the children node should delete the edge of
52171
+ // the source at the same time. because the polyline edge shape is only owned by the source.
52172
+ // 2.when the node is the only children of the source, delete the node should delete the edge of
52173
+ // the source at the same time. the same reason as above.
52174
+ var edge = symbolEl.__edge
52175
+ || ((source.isExpand === false || source.children.length === 1) ? sourceEdge : undefined);
52176
+
52177
+ var edgeShape = seriesScope.edgeShape;
52178
+
51747
52179
  if (edge) {
51748
- updateProps(edge, {
51749
- shape: getEdgeShape(seriesScope, sourceLayout, sourceLayout),
51750
- style: {
51751
- opacity: 0
51752
- }
51753
- }, seriesModel, function () {
51754
- group.remove(edge);
51755
- });
52180
+ if (edgeShape === 'curve') {
52181
+ updateProps(edge, {
52182
+ shape: getEdgeShape(seriesScope, sourceLayout, sourceLayout),
52183
+ style: {
52184
+ opacity: 0
52185
+ }
52186
+ }, seriesModel, function () {
52187
+ group.remove(edge);
52188
+ });
52189
+ }
52190
+ else if (edgeShape === 'polyline' && seriesScope.layout === 'orthogonal') {
52191
+ updateProps(edge, {
52192
+ shape: {
52193
+ parentPoint: [sourceLayout.x, sourceLayout.y],
52194
+ childPoints: [[sourceLayout.x, sourceLayout.y]]
52195
+ },
52196
+ style: {
52197
+ opacity: 0
52198
+ }
52199
+ }, seriesModel, function () {
52200
+ group.remove(edge);
52201
+ });
52202
+ }
51756
52203
  }
51757
52204
  }
51758
52205
 
@@ -52994,6 +53441,7 @@ extendChartView({
52994
53441
  var thisStorage = createStorage();
52995
53442
  var oldStorage = this._storage;
52996
53443
  var willInvisibleEls = [];
53444
+
52997
53445
  var doRenderNode = curry(
52998
53446
  renderNode, seriesModel,
52999
53447
  thisStorage, oldStorage, reRoot,
@@ -53492,6 +53940,11 @@ function renderNode(
53492
53940
  // Start of closure variables available in "Procedures in renderNode".
53493
53941
 
53494
53942
  var thisLayout = thisNode.getLayout();
53943
+ var data = seriesModel.getData();
53944
+
53945
+ // Only for enabling highlight/downplay. Clear firstly.
53946
+ // Because some node will not be rendered.
53947
+ data.setItemGraphicEl(thisNode.dataIndex, null);
53495
53948
 
53496
53949
  if (!thisLayout || !thisLayout.isInView) {
53497
53950
  return;
@@ -53531,14 +53984,36 @@ function renderNode(
53531
53984
  return group;
53532
53985
  }
53533
53986
 
53987
+ var nodeModel = thisNode.getModel();
53988
+
53534
53989
  // Background
53535
53990
  var bg = giveGraphic('background', Rect$1, depth, Z_BG);
53536
53991
  bg && renderBackground(group, bg, isParent && thisLayout.upperHeight);
53537
53992
 
53538
53993
  // No children, render content.
53539
- if (!isParent) {
53994
+ if (isParent) {
53995
+ // Because of the implementation about "traverse" in graphic hover style, we
53996
+ // can not set hover listener on the "group" of non-leaf node. Otherwise the
53997
+ // hover event from the descendents will be listenered.
53998
+ if (isHighDownDispatcher(group)) {
53999
+ setAsHighDownDispatcher(group, false);
54000
+ }
54001
+ if (bg) {
54002
+ setAsHighDownDispatcher(bg, true);
54003
+ // Only for enabling highlight/downplay.
54004
+ data.setItemGraphicEl(thisNode.dataIndex, bg);
54005
+ }
54006
+ }
54007
+ else {
53540
54008
  var content = giveGraphic('content', Rect$1, depth, Z_CONTENT);
53541
54009
  content && renderContent(group, content);
54010
+
54011
+ if (bg && isHighDownDispatcher(bg)) {
54012
+ setAsHighDownDispatcher(bg, false);
54013
+ }
54014
+ setAsHighDownDispatcher(group, true);
54015
+ // Only for enabling highlight/downplay.
54016
+ data.setItemGraphicEl(thisNode.dataIndex, group);
53542
54017
  }
53543
54018
 
53544
54019
  return group;
@@ -53553,10 +54028,17 @@ function renderNode(
53553
54028
  bg.seriesIndex = seriesModel.seriesIndex;
53554
54029
 
53555
54030
  bg.setShape({x: 0, y: 0, width: thisWidth, height: thisHeight});
53556
- var visualBorderColor = thisNode.getVisual('borderColor', true);
53557
- var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');
53558
54031
 
53559
- updateStyle(bg, function () {
54032
+ if (thisInvisible) {
54033
+ // If invisible, do not set visual, otherwise the element will
54034
+ // change immediately before animation. We think it is OK to
54035
+ // remain its origin color when moving out of the view window.
54036
+ processInvisible(bg);
54037
+ }
54038
+ else {
54039
+ bg.invisible = false;
54040
+ var visualBorderColor = thisNode.getVisual('borderColor', true);
54041
+ var emphasisBorderColor = itemStyleEmphasisModel.get('borderColor');
53560
54042
  var normalStyle = getItemStyleNormal(itemStyleNormalModel);
53561
54043
  normalStyle.fill = visualBorderColor;
53562
54044
  var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
@@ -53576,8 +54058,8 @@ function renderNode(
53576
54058
  }
53577
54059
 
53578
54060
  bg.setStyle(normalStyle);
53579
- setHoverStyle(bg, emphasisStyle);
53580
- });
54061
+ setElementHoverStyle(bg, emphasisStyle);
54062
+ }
53581
54063
 
53582
54064
  group.add(bg);
53583
54065
  }
@@ -53598,8 +54080,15 @@ function renderNode(
53598
54080
  height: contentHeight
53599
54081
  });
53600
54082
 
53601
- var visualColor = thisNode.getVisual('color', true);
53602
- updateStyle(content, function () {
54083
+ if (thisInvisible) {
54084
+ // If invisible, do not set visual, otherwise the element will
54085
+ // change immediately before animation. We think it is OK to
54086
+ // remain its origin color when moving out of the view window.
54087
+ processInvisible(content);
54088
+ }
54089
+ else {
54090
+ content.invisible = false;
54091
+ var visualColor = thisNode.getVisual('color', true);
53603
54092
  var normalStyle = getItemStyleNormal(itemStyleNormalModel);
53604
54093
  normalStyle.fill = visualColor;
53605
54094
  var emphasisStyle = getItemStyleEmphasis(itemStyleEmphasisModel);
@@ -53607,32 +54096,19 @@ function renderNode(
53607
54096
  prepareText(normalStyle, emphasisStyle, visualColor, contentWidth, contentHeight);
53608
54097
 
53609
54098
  content.setStyle(normalStyle);
53610
- setHoverStyle(content, emphasisStyle);
53611
- });
54099
+ setElementHoverStyle(content, emphasisStyle);
54100
+ }
53612
54101
 
53613
54102
  group.add(content);
53614
54103
  }
53615
54104
 
53616
- function updateStyle(element, cb) {
53617
- if (!thisInvisible) {
53618
- // If invisible, do not set visual, otherwise the element will
53619
- // change immediately before animation. We think it is OK to
53620
- // remain its origin color when moving out of the view window.
53621
- cb();
53622
-
53623
- if (!element.__tmWillVisible) {
53624
- element.invisible = false;
53625
- }
53626
- }
53627
- else {
53628
- // Delay invisible setting utill animation finished,
53629
- // avoid element vanish suddenly before animation.
53630
- !element.invisible && willInvisibleEls.push(element);
53631
- }
54105
+ function processInvisible(element) {
54106
+ // Delay invisible setting utill animation finished,
54107
+ // avoid element vanish suddenly before animation.
54108
+ !element.invisible && willInvisibleEls.push(element);
53632
54109
  }
53633
54110
 
53634
54111
  function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
53635
- var nodeModel = thisNode.getModel();
53636
54112
  var text = retrieve(
53637
54113
  seriesModel.getFormattedLabel(
53638
54114
  thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'
@@ -53729,6 +54205,7 @@ function renderNode(
53729
54205
  // Fade in, user can be aware that these nodes are new.
53730
54206
  lastCfg.fadein = storageName !== 'nodeGroup';
53731
54207
  }
54208
+
53732
54209
  }
53733
54210
 
53734
54211
  // We can not set all backgroud with the same z, Because the behaviour of
@@ -56144,7 +56621,8 @@ var GraphSeries = extendSeriesModel({
56144
56621
  edgeSymbol: ['none', 'none'],
56145
56622
  edgeSymbolSize: 10,
56146
56623
  edgeLabel: {
56147
- position: 'middle'
56624
+ position: 'middle',
56625
+ distance: 5
56148
56626
  },
56149
56627
 
56150
56628
  draggable: false,
@@ -56398,39 +56876,90 @@ function updateSymbolAndLabelBeforeLineUpdate() {
56398
56876
  var textPosition;
56399
56877
  var textAlign;
56400
56878
  var textVerticalAlign;
56401
-
56402
- var distance$$1 = 5 * invScale;
56403
- // End
56404
- if (label.__position === 'end') {
56405
- textPosition = [d[0] * distance$$1 + toPos[0], d[1] * distance$$1 + toPos[1]];
56406
- textAlign = d[0] > 0.8 ? 'left' : (d[0] < -0.8 ? 'right' : 'center');
56407
- textVerticalAlign = d[1] > 0.8 ? 'top' : (d[1] < -0.8 ? 'bottom' : 'middle');
56408
- }
56409
- // Middle
56410
- else if (label.__position === 'middle') {
56411
- var halfPercent = percent / 2;
56412
- var tangent = line.tangentAt(halfPercent);
56413
- var n = [tangent[1], -tangent[0]];
56414
- var cp = line.pointAt(halfPercent);
56415
- if (n[1] > 0) {
56416
- n[0] = -n[0];
56417
- n[1] = -n[1];
56418
- }
56419
- textPosition = [cp[0] + n[0] * distance$$1, cp[1] + n[1] * distance$$1];
56420
- textAlign = 'center';
56421
- textVerticalAlign = 'bottom';
56879
+ var textOrigin;
56880
+
56881
+ var distance$$1 = label.__labelDistance;
56882
+ var distanceX = distance$$1[0] * invScale;
56883
+ var distanceY = distance$$1[1] * invScale;
56884
+ var halfPercent = percent / 2;
56885
+ var tangent = line.tangentAt(halfPercent);
56886
+ var n = [tangent[1], -tangent[0]];
56887
+ var cp = line.pointAt(halfPercent);
56888
+ if (n[1] > 0) {
56889
+ n[0] = -n[0];
56890
+ n[1] = -n[1];
56891
+ }
56892
+ var dir = tangent[0] < 0 ? -1 : 1;
56893
+
56894
+ if (label.__position !== 'start' && label.__position !== 'end') {
56422
56895
  var rotation = -Math.atan2(tangent[1], tangent[0]);
56423
56896
  if (toPos[0] < fromPos[0]) {
56424
56897
  rotation = Math.PI + rotation;
56425
56898
  }
56426
56899
  label.attr('rotation', rotation);
56427
56900
  }
56428
- // Start
56429
- else {
56430
- textPosition = [-d[0] * distance$$1 + fromPos[0], -d[1] * distance$$1 + fromPos[1]];
56431
- textAlign = d[0] > 0.8 ? 'right' : (d[0] < -0.8 ? 'left' : 'center');
56432
- textVerticalAlign = d[1] > 0.8 ? 'bottom' : (d[1] < -0.8 ? 'top' : 'middle');
56901
+
56902
+ var dy;
56903
+ switch (label.__position) {
56904
+ case 'insideStartTop':
56905
+ case 'insideMiddleTop':
56906
+ case 'insideEndTop':
56907
+ case 'middle':
56908
+ dy = -distanceY;
56909
+ textVerticalAlign = 'bottom';
56910
+ break;
56911
+
56912
+ case 'insideStartBottom':
56913
+ case 'insideMiddleBottom':
56914
+ case 'insideEndBottom':
56915
+ dy = distanceY;
56916
+ textVerticalAlign = 'top';
56917
+ break;
56918
+
56919
+ default:
56920
+ dy = 0;
56921
+ textVerticalAlign = 'middle';
56922
+ }
56923
+
56924
+ switch (label.__position) {
56925
+ case 'end':
56926
+ textPosition = [d[0] * distanceX + toPos[0], d[1] * distanceY + toPos[1]];
56927
+ textAlign = d[0] > 0.8 ? 'left' : (d[0] < -0.8 ? 'right' : 'center');
56928
+ textVerticalAlign = d[1] > 0.8 ? 'top' : (d[1] < -0.8 ? 'bottom' : 'middle');
56929
+ break;
56930
+
56931
+ case 'start':
56932
+ textPosition = [-d[0] * distanceX + fromPos[0], -d[1] * distanceY + fromPos[1]];
56933
+ textAlign = d[0] > 0.8 ? 'right' : (d[0] < -0.8 ? 'left' : 'center');
56934
+ textVerticalAlign = d[1] > 0.8 ? 'bottom' : (d[1] < -0.8 ? 'top' : 'middle');
56935
+ break;
56936
+
56937
+ case 'insideStartTop':
56938
+ case 'insideStart':
56939
+ case 'insideStartBottom':
56940
+ textPosition = [distanceX * dir + fromPos[0], fromPos[1] + dy];
56941
+ textAlign = tangent[0] < 0 ? 'right' : 'left';
56942
+ textOrigin = [-distanceX * dir, -dy];
56943
+ break;
56944
+
56945
+ case 'insideMiddleTop':
56946
+ case 'insideMiddle':
56947
+ case 'insideMiddleBottom':
56948
+ case 'middle':
56949
+ textPosition = [cp[0], cp[1] + dy];
56950
+ textAlign = 'center';
56951
+ textOrigin = [0, -dy];
56952
+ break;
56953
+
56954
+ case 'insideEndTop':
56955
+ case 'insideEnd':
56956
+ case 'insideEndBottom':
56957
+ textPosition = [-distanceX * dir + toPos[0], toPos[1] + dy];
56958
+ textAlign = tangent[0] >= 0 ? 'right' : 'left';
56959
+ textOrigin = [distanceX * dir, -dy];
56960
+ break;
56433
56961
  }
56962
+
56434
56963
  label.attr({
56435
56964
  style: {
56436
56965
  // Use the user specified text align and baseline first
@@ -56438,7 +56967,8 @@ function updateSymbolAndLabelBeforeLineUpdate() {
56438
56967
  textAlign: label.__textAlign || textAlign
56439
56968
  },
56440
56969
  position: textPosition,
56441
- scale: [invScale, invScale]
56970
+ scale: [invScale, invScale],
56971
+ origin: textOrigin
56442
56972
  });
56443
56973
  }
56444
56974
  }
@@ -56614,6 +57144,12 @@ lineProto._updateCommonStl = function (lineData, idx, seriesScope) {
56614
57144
  label.__verticalAlign = labelStyle.textVerticalAlign;
56615
57145
  // 'start', 'middle', 'end'
56616
57146
  label.__position = labelModel.get('position') || 'middle';
57147
+
57148
+ var distance$$1 = labelModel.get('distance');
57149
+ if (!isArray(distance$$1)) {
57150
+ distance$$1 = [distance$$1, distance$$1];
57151
+ }
57152
+ label.__labelDistance = distance$$1;
56617
57153
  }
56618
57154
 
56619
57155
  if (emphasisText != null) {
@@ -57308,7 +57844,7 @@ extendChartView({
57308
57844
  },
57309
57845
 
57310
57846
  focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
57311
- var data = this._model.getData();
57847
+ var data = seriesModel.getData();
57312
57848
  var graph = data.graph;
57313
57849
  var dataIndex = payload.dataIndex;
57314
57850
  var edgeDataIndex = payload.edgeDataIndex;
@@ -57346,7 +57882,7 @@ extendChartView({
57346
57882
  },
57347
57883
 
57348
57884
  unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
57349
- var graph = this._model.getData().graph;
57885
+ var graph = seriesModel.getData().graph;
57350
57886
 
57351
57887
  graph.eachNode(function (node) {
57352
57888
  fadeOutItem(node, nodeOpacityPath);
@@ -62862,6 +63398,17 @@ var SankeySeries = SeriesModel.extend({
62862
63398
  }
62863
63399
  },
62864
63400
 
63401
+ // Override Series.getDataParams()
63402
+ getDataParams: function (dataIndex, dataType) {
63403
+ var params = SankeySeries.superCall(this, 'getDataParams', dataIndex, dataType);
63404
+ if (params.value == null && dataType === 'node') {
63405
+ var node = this.getGraph().getNodeByIndex(dataIndex);
63406
+ var nodeValue = node.getLayout().value;
63407
+ params.value = nodeValue;
63408
+ }
63409
+ return params;
63410
+ },
63411
+
62865
63412
  defaultOption: {
62866
63413
  zlevel: 0,
62867
63414
  z: 2,
@@ -62922,7 +63469,7 @@ var SankeySeries = SeriesModel.extend({
62922
63469
  show: true
62923
63470
  },
62924
63471
  lineStyle: {
62925
- opacity: 0.6
63472
+ opacity: 0.5
62926
63473
  }
62927
63474
  },
62928
63475
 
@@ -62953,7 +63500,9 @@ var SankeySeries = SeriesModel.extend({
62953
63500
  */
62954
63501
 
62955
63502
  var nodeOpacityPath$1 = ['itemStyle', 'opacity'];
63503
+ var hoverNodeOpacityPath = ['emphasis', 'itemStyle', 'opacity'];
62956
63504
  var lineOpacityPath$1 = ['lineStyle', 'opacity'];
63505
+ var hoverLineOpacityPath = ['emphasis', 'lineStyle', 'opacity'];
62957
63506
 
62958
63507
  function getItemOpacity$1(item, opacityPath) {
62959
63508
  return item.getVisual('opacity') || item.getModel().get(opacityPath);
@@ -62961,8 +63510,8 @@ function getItemOpacity$1(item, opacityPath) {
62961
63510
 
62962
63511
  function fadeOutItem$1(item, opacityPath, opacityRatio) {
62963
63512
  var el = item.getGraphicEl();
62964
-
62965
63513
  var opacity = getItemOpacity$1(item, opacityPath);
63514
+
62966
63515
  if (opacityRatio != null) {
62967
63516
  opacity == null && (opacity = 1);
62968
63517
  opacity *= opacityRatio;
@@ -62980,12 +63529,14 @@ function fadeInItem$1(item, opacityPath) {
62980
63529
  var opacity = getItemOpacity$1(item, opacityPath);
62981
63530
  var el = item.getGraphicEl();
62982
63531
 
62983
- el.highlight && el.highlight();
62984
63532
  el.traverse(function (child) {
62985
63533
  if (child.type !== 'group') {
62986
63534
  child.setStyle('opacity', opacity);
62987
63535
  }
62988
63536
  });
63537
+
63538
+ // Support emphasis here.
63539
+ el.highlight && el.highlight();
62989
63540
  }
62990
63541
 
62991
63542
  var SankeyShape = extendShape({
@@ -63023,6 +63574,14 @@ var SankeyShape = extendShape({
63023
63574
  );
63024
63575
  }
63025
63576
  ctx.closePath();
63577
+ },
63578
+
63579
+ highlight: function () {
63580
+ this.trigger('emphasis');
63581
+ },
63582
+
63583
+ downplay: function () {
63584
+ this.trigger('normal');
63026
63585
  }
63027
63586
  });
63028
63587
 
@@ -63205,8 +63764,19 @@ extendChartView({
63205
63764
  el.cursor = 'move';
63206
63765
  }
63207
63766
 
63767
+ el.highlight = function () {
63768
+ this.trigger('emphasis');
63769
+ };
63770
+
63771
+ el.downplay = function () {
63772
+ this.trigger('normal');
63773
+ };
63774
+
63775
+ el.focusNodeAdjHandler && el.off('mouseover', el.focusNodeAdjHandler);
63776
+ el.unfocusNodeAdjHandler && el.off('mouseout', el.unfocusNodeAdjHandler);
63777
+
63208
63778
  if (itemModel.get('focusNodeAdjacency')) {
63209
- el.off('mouseover').on('mouseover', function () {
63779
+ el.on('mouseover', el.focusNodeAdjHandler = function () {
63210
63780
  if (!sankeyView._focusAdjacencyDisabled) {
63211
63781
  sankeyView._clearTimer();
63212
63782
  api.dispatchAction({
@@ -63216,7 +63786,8 @@ extendChartView({
63216
63786
  });
63217
63787
  }
63218
63788
  });
63219
- el.off('mouseout').on('mouseout', function () {
63789
+
63790
+ el.on('mouseout', el.unfocusNodeAdjHandler = function () {
63220
63791
  if (!sankeyView._focusAdjacencyDisabled) {
63221
63792
  sankeyView._dispatchUnfocus(api);
63222
63793
  }
@@ -63226,8 +63797,12 @@ extendChartView({
63226
63797
 
63227
63798
  edgeData.eachItemGraphicEl(function (el, dataIndex) {
63228
63799
  var edgeModel = edgeData.getItemModel(dataIndex);
63800
+
63801
+ el.focusNodeAdjHandler && el.off('mouseover', el.focusNodeAdjHandler);
63802
+ el.unfocusNodeAdjHandler && el.off('mouseout', el.unfocusNodeAdjHandler);
63803
+
63229
63804
  if (edgeModel.get('focusNodeAdjacency')) {
63230
- el.off('mouseover').on('mouseover', function () {
63805
+ el.on('mouseover', el.focusNodeAdjHandler = function () {
63231
63806
  if (!sankeyView._focusAdjacencyDisabled) {
63232
63807
  sankeyView._clearTimer();
63233
63808
  api.dispatchAction({
@@ -63237,7 +63812,8 @@ extendChartView({
63237
63812
  });
63238
63813
  }
63239
63814
  });
63240
- el.off('mouseout').on('mouseout', function () {
63815
+
63816
+ el.on('mouseout', el.unfocusNodeAdjHandler = function () {
63241
63817
  if (!sankeyView._focusAdjacencyDisabled) {
63242
63818
  sankeyView._dispatchUnfocus(api);
63243
63819
  }
@@ -63278,7 +63854,7 @@ extendChartView({
63278
63854
  },
63279
63855
 
63280
63856
  focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
63281
- var data = this._model.getData();
63857
+ var data = seriesModel.getData();
63282
63858
  var graph = data.graph;
63283
63859
  var dataIndex = payload.dataIndex;
63284
63860
  var itemModel = data.getItemModel(dataIndex);
@@ -63298,15 +63874,15 @@ extendChartView({
63298
63874
  });
63299
63875
 
63300
63876
  if (node) {
63301
- fadeInItem$1(node, nodeOpacityPath$1);
63877
+ fadeInItem$1(node, hoverNodeOpacityPath);
63302
63878
  var focusNodeAdj = itemModel.get('focusNodeAdjacency');
63303
63879
  if (focusNodeAdj === 'outEdges') {
63304
63880
  each$1(node.outEdges, function (edge) {
63305
63881
  if (edge.dataIndex < 0) {
63306
63882
  return;
63307
63883
  }
63308
- fadeInItem$1(edge, lineOpacityPath$1);
63309
- fadeInItem$1(edge.node2, nodeOpacityPath$1);
63884
+ fadeInItem$1(edge, hoverLineOpacityPath);
63885
+ fadeInItem$1(edge.node2, hoverNodeOpacityPath);
63310
63886
  });
63311
63887
  }
63312
63888
  else if (focusNodeAdj === 'inEdges') {
@@ -63314,8 +63890,8 @@ extendChartView({
63314
63890
  if (edge.dataIndex < 0) {
63315
63891
  return;
63316
63892
  }
63317
- fadeInItem$1(edge, lineOpacityPath$1);
63318
- fadeInItem$1(edge.node1, nodeOpacityPath$1);
63893
+ fadeInItem$1(edge, hoverLineOpacityPath);
63894
+ fadeInItem$1(edge.node1, hoverNodeOpacityPath);
63319
63895
  });
63320
63896
  }
63321
63897
  else if (focusNodeAdj === 'allEdges') {
@@ -63323,21 +63899,21 @@ extendChartView({
63323
63899
  if (edge.dataIndex < 0) {
63324
63900
  return;
63325
63901
  }
63326
- fadeInItem$1(edge, lineOpacityPath$1);
63327
- fadeInItem$1(edge.node1, nodeOpacityPath$1);
63328
- fadeInItem$1(edge.node2, nodeOpacityPath$1);
63902
+ fadeInItem$1(edge, hoverLineOpacityPath);
63903
+ (edge.node1 !== node) && fadeInItem$1(edge.node1, hoverNodeOpacityPath);
63904
+ (edge.node2 !== node) && fadeInItem$1(edge.node2, hoverNodeOpacityPath);
63329
63905
  });
63330
63906
  }
63331
63907
  }
63332
63908
  if (edge) {
63333
- fadeInItem$1(edge, lineOpacityPath$1);
63334
- fadeInItem$1(edge.node1, nodeOpacityPath$1);
63335
- fadeInItem$1(edge.node2, nodeOpacityPath$1);
63909
+ fadeInItem$1(edge, hoverLineOpacityPath);
63910
+ fadeInItem$1(edge.node1, hoverNodeOpacityPath);
63911
+ fadeInItem$1(edge.node2, hoverNodeOpacityPath);
63336
63912
  }
63337
63913
  },
63338
63914
 
63339
63915
  unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
63340
- var graph = this._model.getGraph();
63916
+ var graph = seriesModel.getGraph();
63341
63917
 
63342
63918
  graph.eachNode(function (node) {
63343
63919
  fadeOutItem$1(node, nodeOpacityPath$1);
@@ -63360,8 +63936,7 @@ function createGridClipShape$1(rect, seriesModel, cb) {
63360
63936
  });
63361
63937
  initProps(rectEl, {
63362
63938
  shape: {
63363
- width: rect.width + 20,
63364
- height: rect.height + 20
63939
+ width: rect.width + 20
63365
63940
  }
63366
63941
  }, seriesModel, cb);
63367
63942
 
@@ -63483,7 +64058,8 @@ function computeNodeValues(nodes) {
63483
64058
  each$1(nodes, function (node) {
63484
64059
  var value1 = sum(node.outEdges, getEdgeValue);
63485
64060
  var value2 = sum(node.inEdges, getEdgeValue);
63486
- var value = Math.max(value1, value2);
64061
+ var nodeRawValue = node.getValue() || 0;
64062
+ var value = Math.max(value1, value2, nodeRawValue);
63487
64063
  node.setLayout({value: value}, true);
63488
64064
  });
63489
64065
  }
@@ -63827,12 +64403,12 @@ function getEdgeValue(edge) {
63827
64403
  return edge.getValue();
63828
64404
  }
63829
64405
 
63830
- function sum(array, f, orient) {
64406
+ function sum(array, cb, orient) {
63831
64407
  var sum = 0;
63832
64408
  var len = array.length;
63833
64409
  var i = -1;
63834
64410
  while (++i < len) {
63835
- var value = +f.call(array, array[i], orient);
64411
+ var value = +cb.call(array, array[i], orient);
63836
64412
  if (!isNaN(value)) {
63837
64413
  sum += value;
63838
64414
  }
@@ -65133,7 +65709,6 @@ var candlestickVisual = {
65133
65709
  reset: function (seriesModel, ecModel) {
65134
65710
 
65135
65711
  var data = seriesModel.getData();
65136
- var isLargeRender = seriesModel.pipelineContext.large;
65137
65712
 
65138
65713
  data.setVisual({
65139
65714
  legendSymbol: 'roundRect',
@@ -65148,6 +65723,7 @@ var candlestickVisual = {
65148
65723
  return;
65149
65724
  }
65150
65725
 
65726
+ var isLargeRender = seriesModel.pipelineContext.large;
65151
65727
  return !isLargeRender && {progress: progress};
65152
65728
 
65153
65729
 
@@ -66244,6 +66820,7 @@ effectLineProto._updateEffectSymbol = function (lineData, idx) {
66244
66820
  symbol.attr('scale', size);
66245
66821
 
66246
66822
  this._symbolType = symbolType;
66823
+ this._symbolScale = size;
66247
66824
 
66248
66825
  this._updateEffectAnimation(lineData, effectModel, idx);
66249
66826
  };
@@ -66334,6 +66911,7 @@ effectLineProto.updateSymbolPosition = function (symbol) {
66334
66911
  var cp1 = symbol.__cp1;
66335
66912
  var t = symbol.__t;
66336
66913
  var pos = symbol.position;
66914
+ var lastPos = [pos[0], pos[1]];
66337
66915
  var quadraticAt$$1 = quadraticAt;
66338
66916
  var quadraticDerivativeAt$$1 = quadraticDerivativeAt;
66339
66917
  pos[0] = quadraticAt$$1(p1[0], cp1[0], p2[0], t);
@@ -66344,7 +66922,27 @@ effectLineProto.updateSymbolPosition = function (symbol) {
66344
66922
  var ty = quadraticDerivativeAt$$1(p1[1], cp1[1], p2[1], t);
66345
66923
 
66346
66924
  symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
66347
-
66925
+ // enable continuity trail for 'line', 'rect', 'roundRect' symbolType
66926
+ if (this._symbolType === 'line' || this._symbolType === 'rect' || this._symbolType === 'roundRect') {
66927
+ if (symbol.__lastT !== undefined && symbol.__lastT < symbol.__t) {
66928
+ var scaleY = dist(lastPos, pos) * 1.05;
66929
+ symbol.attr('scale', [symbol.scale[0], scaleY]);
66930
+ // make sure the last segment render within endPoint
66931
+ if (t === 1) {
66932
+ pos[0] = lastPos[0] + (pos[0] - lastPos[0]) / 2;
66933
+ pos[1] = lastPos[1] + (pos[1] - lastPos[1]) / 2;
66934
+ }
66935
+ }
66936
+ else if (symbol.__lastT === 1) {
66937
+ // After first loop, symbol.__t does NOT start with 0, so connect p1 to pos directly.
66938
+ var scaleY = 2 * dist(p1, pos);
66939
+ symbol.attr('scale', [symbol.scale[0], scaleY ]);
66940
+ }
66941
+ else {
66942
+ symbol.attr('scale', this._symbolScale);
66943
+ }
66944
+ }
66945
+ symbol.__lastT = symbol.__t;
66348
66946
  symbol.ignore = false;
66349
66947
  };
66350
66948
 
@@ -69170,7 +69768,7 @@ var axisBuilderAttrs$2 = [
69170
69768
  'axisLine', 'axisTickLabel', 'axisName'
69171
69769
  ];
69172
69770
 
69173
- var selfBuilderAttr = 'splitLine';
69771
+ var selfBuilderAttrs$1 = ['splitArea', 'splitLine'];
69174
69772
 
69175
69773
  var SingleAxisView = AxisView.extend({
69176
69774
 
@@ -69184,21 +69782,33 @@ var SingleAxisView = AxisView.extend({
69184
69782
 
69185
69783
  group.removeAll();
69186
69784
 
69785
+ var oldAxisGroup = this._axisGroup;
69786
+ this._axisGroup = new Group();
69787
+
69187
69788
  var layout = layout$2(axisModel);
69188
69789
 
69189
69790
  var axisBuilder = new AxisBuilder(axisModel, layout);
69190
69791
 
69191
69792
  each$1(axisBuilderAttrs$2, axisBuilder.add, axisBuilder);
69192
69793
 
69794
+ group.add(this._axisGroup);
69193
69795
  group.add(axisBuilder.getGroup());
69194
69796
 
69195
- if (axisModel.get(selfBuilderAttr + '.show')) {
69196
- this['_' + selfBuilderAttr](axisModel);
69197
- }
69797
+ each$1(selfBuilderAttrs$1, function (name) {
69798
+ if (axisModel.get(name + '.show')) {
69799
+ this['_' + name](axisModel);
69800
+ }
69801
+ }, this);
69802
+
69803
+ groupTransition(oldAxisGroup, this._axisGroup, axisModel);
69198
69804
 
69199
69805
  SingleAxisView.superCall(this, 'render', axisModel, ecModel, api, payload);
69200
69806
  },
69201
69807
 
69808
+ remove: function () {
69809
+ rectCoordAxisHandleRemove(this);
69810
+ },
69811
+
69202
69812
  _splitLine: function (axisModel) {
69203
69813
  var axis = axisModel.axis;
69204
69814
 
@@ -69267,6 +69877,10 @@ var SingleAxisView = AxisView.extend({
69267
69877
  silent: true
69268
69878
  }));
69269
69879
  }
69880
+ },
69881
+
69882
+ _splitArea: function (axisModel) {
69883
+ rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, axisModel);
69270
69884
  }
69271
69885
  });
69272
69886
 
@@ -74293,10 +74907,6 @@ function barLayoutPolar(seriesType, ecModel, api) {
74293
74907
  var value = data.get(valueDim, idx);
74294
74908
  var baseValue = data.get(baseDim, idx);
74295
74909
 
74296
- if (isNaN(value)) {
74297
- continue;
74298
- }
74299
-
74300
74910
  var sign = value >= 0 ? 'p' : 'n';
74301
74911
  var baseCoord = valueAxisStart;
74302
74912
 
@@ -75685,7 +76295,7 @@ AxisView.extend({
75685
76295
  var axisBuilderAttrs$3 = [
75686
76296
  'axisLine', 'axisTickLabel', 'axisName'
75687
76297
  ];
75688
- var selfBuilderAttrs$1 = [
76298
+ var selfBuilderAttrs$2 = [
75689
76299
  'splitLine', 'splitArea', 'minorSplitLine'
75690
76300
  ];
75691
76301
 
@@ -75713,7 +76323,7 @@ AxisView.extend({
75713
76323
  each$1(axisBuilderAttrs$3, axisBuilder.add, axisBuilder);
75714
76324
  this.group.add(axisBuilder.getGroup());
75715
76325
 
75716
- each$1(selfBuilderAttrs$1, function (name) {
76326
+ each$1(selfBuilderAttrs$2, function (name) {
75717
76327
  if (radiusAxisModel.get(name + '.show') && !radiusAxis.scale.isBlank()) {
75718
76328
  this['_' + name](radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords, minorTicksCoords);
75719
76329
  }
@@ -82116,24 +82726,63 @@ function assembleCssText(tooltipModel) {
82116
82726
  return cssText.join(';') + ';';
82117
82727
  }
82118
82728
 
82729
+ // If not able to make, do not modify the input `out`.
82730
+ function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
82731
+ var zrPainter = zr && zr.painter;
82732
+
82733
+ if (appendToBody) {
82734
+ var zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
82735
+ if (zrViewportRoot) {
82736
+ // Some APPs might use scale on body, so we support CSS transform here.
82737
+ transformLocalCoord(out, zrViewportRoot, document.body, zrX, zrY);
82738
+ }
82739
+ }
82740
+ else {
82741
+ out[0] = zrX;
82742
+ out[1] = zrY;
82743
+ // xy should be based on canvas root. But tooltipContent is
82744
+ // the sibling of canvas root. So padding of ec container
82745
+ // should be considered here.
82746
+ var viewportRootOffset = zrPainter && zrPainter.getViewportRootOffset();
82747
+ if (viewportRootOffset) {
82748
+ out[0] += viewportRootOffset.offsetLeft;
82749
+ out[1] += viewportRootOffset.offsetTop;
82750
+ }
82751
+ }
82752
+ }
82753
+
82119
82754
  /**
82120
82755
  * @alias module:echarts/component/tooltip/TooltipContent
82756
+ * @param {HTMLElement} container
82757
+ * @param {ExtensionAPI} api
82758
+ * @param {Object} [opt]
82759
+ * @param {boolean} [opt.appendToBody]
82760
+ * `false`: the DOM element will be inside the container. Default value.
82761
+ * `true`: the DOM element will be appended to HTML body, which avoid
82762
+ * some overflow clip but intrude outside of the container.
82121
82763
  * @constructor
82122
82764
  */
82123
- function TooltipContent(container, api) {
82765
+ function TooltipContent(container, api, opt) {
82124
82766
  if (env$1.wxa) {
82125
82767
  return null;
82126
82768
  }
82127
82769
 
82128
82770
  var el = document.createElement('div');
82771
+ el.domBelongToZr = true;
82772
+ this.el = el;
82129
82773
  var zr = this._zr = api.getZr();
82774
+ var appendToBody = this._appendToBody = opt && opt.appendToBody;
82130
82775
 
82131
- this.el = el;
82776
+ this._styleCoord = [0, 0];
82132
82777
 
82133
- this._x = api.getWidth() / 2;
82134
- this._y = api.getHeight() / 2;
82778
+ makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
82135
82779
 
82136
- container.appendChild(el);
82780
+ if (appendToBody) {
82781
+ document.body.appendChild(el);
82782
+ }
82783
+ else {
82784
+ container.appendChild(el);
82785
+ }
82137
82786
 
82138
82787
  this._container = container;
82139
82788
 
@@ -82167,7 +82816,8 @@ function TooltipContent(container, api) {
82167
82816
  // Try trigger zrender event to avoid mouse
82168
82817
  // in and out shape too frequently
82169
82818
  var handler = zr.handler;
82170
- normalizeEvent(container, e, true);
82819
+ var zrViewportRoot = zr.painter.getViewportRoot();
82820
+ normalizeEvent(zrViewportRoot, e, true);
82171
82821
  handler.dispatch('mousemove', e);
82172
82822
  }
82173
82823
  };
@@ -82212,12 +82862,13 @@ TooltipContent.prototype = {
82212
82862
  show: function (tooltipModel) {
82213
82863
  clearTimeout(this._hideTimeout);
82214
82864
  var el = this.el;
82865
+ var styleCoord = this._styleCoord;
82215
82866
 
82216
82867
  el.style.cssText = gCssText + assembleCssText(tooltipModel)
82217
82868
  // Because of the reason described in:
82218
82869
  // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore
82219
82870
  // we should set initial value to `left` and `top`.
82220
- + ';left:' + this._x + 'px;top:' + this._y + 'px;'
82871
+ + ';left:' + styleCoord[0] + 'px;top:' + styleCoord[1] + 'px;'
82221
82872
  + (tooltipModel.get('extraCssText') || '');
82222
82873
 
82223
82874
  el.style.display = el.innerHTML ? 'block' : 'none';
@@ -82245,23 +82896,13 @@ TooltipContent.prototype = {
82245
82896
  return [el.clientWidth, el.clientHeight];
82246
82897
  },
82247
82898
 
82248
- moveTo: function (x, y) {
82249
- // xy should be based on canvas root. But tooltipContent is
82250
- // the sibling of canvas root. So padding of ec container
82251
- // should be considered here.
82252
- var zr = this._zr;
82253
- var viewportRootOffset;
82254
- if (zr && zr.painter && (viewportRootOffset = zr.painter.getViewportRootOffset())) {
82255
- x += viewportRootOffset.offsetLeft;
82256
- y += viewportRootOffset.offsetTop;
82257
- }
82899
+ moveTo: function (zrX, zrY) {
82900
+ var styleCoord = this._styleCoord;
82901
+ makeStyleCoord(styleCoord, this._zr, this._appendToBody, zrX, zrY);
82258
82902
 
82259
82903
  var style = this.el.style;
82260
- style.left = x + 'px';
82261
- style.top = y + 'px';
82262
-
82263
- this._x = x;
82264
- this._y = y;
82904
+ style.left = styleCoord[0] + 'px';
82905
+ style.top = styleCoord[1] + 'px';
82265
82906
  },
82266
82907
 
82267
82908
  hide: function () {
@@ -82287,6 +82928,10 @@ TooltipContent.prototype = {
82287
82928
  return this._show;
82288
82929
  },
82289
82930
 
82931
+ dispose: function () {
82932
+ this.el.parentNode.removeChild(this.el);
82933
+ },
82934
+
82290
82935
  getOuterSize: function () {
82291
82936
  var width = this.el.clientWidth;
82292
82937
  var height = this.el.clientHeight;
@@ -82303,6 +82948,7 @@ TooltipContent.prototype = {
82303
82948
 
82304
82949
  return {width: width, height: height};
82305
82950
  }
82951
+
82306
82952
  };
82307
82953
 
82308
82954
  /*
@@ -82534,7 +83180,9 @@ extendComponentView({
82534
83180
 
82535
83181
  var tooltipContent;
82536
83182
  if (this._renderMode === 'html') {
82537
- tooltipContent = new TooltipContent(api.getDom(), api);
83183
+ tooltipContent = new TooltipContent(api.getDom(), api, {
83184
+ appendToBody: tooltipModel.get('appendToBody', true)
83185
+ });
82538
83186
  this._newLine = '<br/>';
82539
83187
  }
82540
83188
  else {
@@ -82687,7 +83335,6 @@ extendComponentView({
82687
83335
  offsetX: payload.x,
82688
83336
  offsetY: payload.y,
82689
83337
  position: payload.position,
82690
- event: {},
82691
83338
  dataByCoordSys: payload.dataByCoordSys,
82692
83339
  tooltipOption: payload.tooltipOption
82693
83340
  }, dispatchAction);
@@ -82706,8 +83353,7 @@ extendComponentView({
82706
83353
  offsetX: cx,
82707
83354
  offsetY: cy,
82708
83355
  position: payload.position,
82709
- target: pointInfo.el,
82710
- event: {}
83356
+ target: pointInfo.el
82711
83357
  }, dispatchAction);
82712
83358
  }
82713
83359
  }
@@ -82724,8 +83370,7 @@ extendComponentView({
82724
83370
  offsetX: payload.x,
82725
83371
  offsetY: payload.y,
82726
83372
  position: payload.position,
82727
- target: api.getZr().findHover(payload.x, payload.y).target,
82728
- event: {}
83373
+ target: api.getZr().findHover(payload.x, payload.y).target
82729
83374
  }, dispatchAction);
82730
83375
  }
82731
83376
  },
@@ -82831,7 +83476,9 @@ extendComponentView({
82831
83476
  _showAxisTooltip: function (dataByCoordSys, e) {
82832
83477
  var ecModel = this._ecModel;
82833
83478
  var globalTooltipModel = this._tooltipModel;
83479
+
82834
83480
  var point = [e.offsetX, e.offsetY];
83481
+
82835
83482
  var singleDefaultHTML = [];
82836
83483
  var singleParamsList = [];
82837
83484
  var singleTooltipModel = buildTooltipModel([
@@ -83087,6 +83734,7 @@ extendComponentView({
83087
83734
  _updatePosition: function (tooltipModel, positionExpr, x, y, content, params, el) {
83088
83735
  var viewWidth = this._api.getWidth();
83089
83736
  var viewHeight = this._api.getHeight();
83737
+
83090
83738
  positionExpr = positionExpr || tooltipModel.get('position');
83091
83739
 
83092
83740
  var contentSize = content.getSize();
@@ -83205,7 +83853,7 @@ extendComponentView({
83205
83853
  if (env$1.node) {
83206
83854
  return;
83207
83855
  }
83208
- this._tooltipContent.hide();
83856
+ this._tooltipContent.dispose();
83209
83857
  unregister('itemTooltip', api);
83210
83858
  }
83211
83859
  });
@@ -83790,16 +84438,19 @@ var PRIORITY_BRUSH = PRIORITY.VISUAL.BRUSH;
83790
84438
  */
83791
84439
  registerLayout(PRIORITY_BRUSH, function (ecModel, api, payload) {
83792
84440
  ecModel.eachComponent({mainType: 'brush'}, function (brushModel) {
83793
-
83794
84441
  payload && payload.type === 'takeGlobalCursor' && brushModel.setBrushOption(
83795
84442
  payload.key === 'brush' ? payload.brushOption : {brushType: false}
83796
84443
  );
84444
+ });
84445
+ layoutCovers(ecModel);
84446
+ });
83797
84447
 
84448
+ function layoutCovers(ecModel) {
84449
+ ecModel.eachComponent({mainType: 'brush'}, function (brushModel) {
83798
84450
  var brushTargetManager = brushModel.brushTargetManager = new BrushTargetManager(brushModel.option, ecModel);
83799
-
83800
84451
  brushTargetManager.setInputRanges(brushModel.areas, ecModel);
83801
84452
  });
83802
- });
84453
+ }
83803
84454
 
83804
84455
  /**
83805
84456
  * Register the visual encoding if this modules required.
@@ -84314,7 +84965,13 @@ extendComponentView({
84314
84965
  /**
84315
84966
  * @override
84316
84967
  */
84317
- updateTransform: updateController,
84968
+ updateTransform: function (brushModel, ecModel) {
84969
+ // PENDING: `updateTransform` is a little tricky, whose layout need
84970
+ // to be calculate mandatorily and other stages will not be performed.
84971
+ // Take care the correctness of the logic. See #11754 .
84972
+ layoutCovers(ecModel);
84973
+ return updateController.apply(this, arguments);
84974
+ },
84318
84975
 
84319
84976
  /**
84320
84977
  * @override
@@ -86406,8 +87063,8 @@ function markerTypeCalculatorWithExtent(
86406
87063
 
86407
87064
  var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];
86408
87065
  coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);
86409
- coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex);
86410
-
87066
+ coordArr[targetCoordIndex] = data.get(calcDataDim, dataIndex);
87067
+ var coordArrValue = data.get(targetDataDim, dataIndex);
86411
87068
  // Make it simple, do not visit all stacked value to count precision.
86412
87069
  var precision = getPrecision(data.get(targetDataDim, dataIndex));
86413
87070
  precision = Math.min(precision, 20);
@@ -86415,7 +87072,7 @@ function markerTypeCalculatorWithExtent(
86415
87072
  coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
86416
87073
  }
86417
87074
 
86418
- return coordArr;
87075
+ return [coordArr, coordArrValue];
86419
87076
  }
86420
87077
 
86421
87078
  var curry$5 = curry;
@@ -86478,12 +87135,15 @@ function dataTransform(seriesModel, item) {
86478
87135
  var otherCoordIndex = indexOf$2(dims, axisInfo.baseAxis.dim);
86479
87136
  var targetCoordIndex = indexOf$2(dims, axisInfo.valueAxis.dim);
86480
87137
 
86481
- item.coord = markerTypeCalculator[item.type](
87138
+ var coordInfo = markerTypeCalculator[item.type](
86482
87139
  data, axisInfo.baseDataDim, axisInfo.valueDataDim,
86483
87140
  otherCoordIndex, targetCoordIndex
86484
87141
  );
87142
+ item.coord = coordInfo[0];
86485
87143
  // Force to use the value of calculated value.
86486
- item.value = item.coord[targetCoordIndex];
87144
+ // let item use the value without stack.
87145
+ item.value = coordInfo[1];
87146
+
86487
87147
  }
86488
87148
  else {
86489
87149
  // FIXME Only has one of xAxis and yAxis.
@@ -86875,7 +87535,8 @@ MarkerModel.extend({
86875
87535
  },
86876
87536
  label: {
86877
87537
  show: true,
86878
- position: 'end'
87538
+ position: 'end',
87539
+ distance: 5
86879
87540
  },
86880
87541
  lineStyle: {
86881
87542
  type: 'dashed'
@@ -89325,26 +89986,28 @@ var ScrollableLegendView = LegendView.extend({
89325
89986
  },
89326
89987
 
89327
89988
  _findTargetItemIndex: function (targetDataIndex) {
89989
+ if (!this._showController) {
89990
+ return 0;
89991
+ }
89992
+
89328
89993
  var index;
89329
89994
  var contentGroup = this.getContentGroup();
89330
89995
  var defaultIndex;
89331
89996
 
89332
- if (this._showController) {
89333
- contentGroup.eachChild(function (child, idx) {
89334
- var legendDataIdx = child.__legendDataIndex;
89335
- // FIXME
89336
- // If the given targetDataIndex (from model) is illegal,
89337
- // we use defualtIndex. But the index on the legend model and
89338
- // action payload is still illegal. That case will not be
89339
- // changed until some scenario requires.
89340
- if (defaultIndex == null && legendDataIdx != null) {
89341
- defaultIndex = idx;
89342
- }
89343
- if (legendDataIdx === targetDataIndex) {
89344
- index = idx;
89345
- }
89346
- });
89347
- }
89997
+ contentGroup.eachChild(function (child, idx) {
89998
+ var legendDataIdx = child.__legendDataIndex;
89999
+ // FIXME
90000
+ // If the given targetDataIndex (from model) is illegal,
90001
+ // we use defualtIndex. But the index on the legend model and
90002
+ // action payload is still illegal. That case will not be
90003
+ // changed until some scenario requires.
90004
+ if (defaultIndex == null && legendDataIdx != null) {
90005
+ defaultIndex = idx;
90006
+ }
90007
+ if (legendDataIdx === targetDataIndex) {
90008
+ index = idx;
90009
+ }
90010
+ });
89348
90011
 
89349
90012
  return index != null ? index : defaultIndex;
89350
90013
  }