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
@@ -1172,7 +1172,11 @@ Draggable.prototype = {
1172
1172
 
1173
1173
  _dragStart: function (e) {
1174
1174
  var draggingTarget = e.target;
1175
- if (draggingTarget && draggingTarget.draggable) {
1175
+ // Find if there is draggable in the ancestor
1176
+ while (draggingTarget && !draggingTarget.draggable) {
1177
+ draggingTarget = draggingTarget.parent;
1178
+ }
1179
+ if (draggingTarget) {
1176
1180
  this._draggingTarget = draggingTarget;
1177
1181
  draggingTarget.dragging = true;
1178
1182
  this._x = e.offsetX;
@@ -1601,6 +1605,8 @@ function buildTransformer(src, dest) {
1601
1605
  var detCache = {};
1602
1606
  var det = determinant(mA, 8, 0, 0, 0, detCache);
1603
1607
  if (det === 0) {
1608
+ // can not make transformer when and only when
1609
+ // any three of the markers are collinear.
1604
1610
  return;
1605
1611
  }
1606
1612
 
@@ -1623,6 +1629,148 @@ function buildTransformer(src, dest) {
1623
1629
  };
1624
1630
  }
1625
1631
 
1632
+ var EVENT_SAVED_PROP = '___zrEVENTSAVED';
1633
+ /**
1634
+ * Transform "local coord" from `elFrom` to `elTarget`.
1635
+ * "local coord": the coord based on the input `el`. The origin point is at
1636
+ * the position of "left: 0; top: 0;" in the `el`.
1637
+ *
1638
+ * Support when CSS transform is used.
1639
+ *
1640
+ * Having the `out` (that is, `[outX, outY]`), we can create an DOM element
1641
+ * and set the CSS style as "left: outX; top: outY;" and append it to `elTarge`
1642
+ * to locate the element.
1643
+ *
1644
+ * For example, this code below positions a child of `document.body` on the event
1645
+ * point, no matter whether `body` has `margin`/`paddin`/`transfrom`/... :
1646
+ * ```js
1647
+ * transformLocalCoord(out, container, document.body, event.offsetX, event.offsetY);
1648
+ * if (!eqNaN(out[0])) {
1649
+ * // Then locate the tip element on the event point.
1650
+ * var tipEl = document.createElement('div');
1651
+ * tipEl.style.cssText = 'position: absolute; left:' + out[0] + ';top:' + out[1] + ';';
1652
+ * document.body.appendChild(tipEl);
1653
+ * }
1654
+ * ```
1655
+ *
1656
+ * Notice: In some env this method is not supported. If called, `out` will be `[NaN, NaN]`.
1657
+ *
1658
+ * @param {Array.<number>} out [inX: number, inY: number] The output..
1659
+ * If can not transform, `out` will not be modified but return `false`.
1660
+ * @param {HTMLElement} elFrom The `[inX, inY]` is based on elFrom.
1661
+ * @param {HTMLElement} elTarget The `out` is based on elTarget.
1662
+ * @param {number} inX
1663
+ * @param {number} inY
1664
+ * @return {boolean} Whether transform successfully.
1665
+ */
1666
+
1667
+
1668
+ /**
1669
+ * Transform between a "viewport coord" and a "local coord".
1670
+ * "viewport coord": the coord based on the left-top corner of the viewport
1671
+ * of the browser.
1672
+ * "local coord": the coord based on the input `el`. The origin point is at
1673
+ * the position of "left: 0; top: 0;" in the `el`.
1674
+ *
1675
+ * Support the case when CSS transform is used on el.
1676
+ *
1677
+ * @param {Array.<number>} out [inX: number, inY: number] The output. If `inverse: false`,
1678
+ * it represents "local coord", otherwise "vireport coord".
1679
+ * If can not transform, `out` will not be modified but return `false`.
1680
+ * @param {HTMLElement} el The "local coord" is based on the `el`, see comment above.
1681
+ * @param {number} inX If `inverse: false`,
1682
+ * it represents "vireport coord", otherwise "local coord".
1683
+ * @param {number} inY If `inverse: false`,
1684
+ * it represents "vireport coord", otherwise "local coord".
1685
+ * @param {boolean} [inverse=false]
1686
+ * `true`: from "viewport coord" to "local coord".
1687
+ * `false`: from "local coord" to "viewport coord".
1688
+ * @return {boolean} Whether transform successfully.
1689
+ */
1690
+ function transformCoordWithViewport(out, el, inX, inY, inverse) {
1691
+ if (el.getBoundingClientRect && env$1.domSupported && !isCanvasEl(el)) {
1692
+ var saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
1693
+ var markers = prepareCoordMarkers(el, saved);
1694
+ var transformer = preparePointerTransformer(markers, saved, inverse);
1695
+ if (transformer) {
1696
+ transformer(out, inX, inY);
1697
+ return true;
1698
+ }
1699
+ }
1700
+ return false;
1701
+ }
1702
+
1703
+ function prepareCoordMarkers(el, saved) {
1704
+ var markers = saved.markers;
1705
+ if (markers) {
1706
+ return markers;
1707
+ }
1708
+
1709
+ markers = saved.markers = [];
1710
+ var propLR = ['left', 'right'];
1711
+ var propTB = ['top', 'bottom'];
1712
+
1713
+ for (var i = 0; i < 4; i++) {
1714
+ var marker = document.createElement('div');
1715
+ var stl = marker.style;
1716
+ var idxLR = i % 2;
1717
+ var idxTB = (i >> 1) % 2;
1718
+ stl.cssText = [
1719
+ 'position: absolute',
1720
+ 'visibility: hidden',
1721
+ 'padding: 0',
1722
+ 'margin: 0',
1723
+ 'border-width: 0',
1724
+ 'user-select: none',
1725
+ 'width:0',
1726
+ 'height:0',
1727
+ // 'width: 5px',
1728
+ // 'height: 5px',
1729
+ propLR[idxLR] + ':0',
1730
+ propTB[idxTB] + ':0',
1731
+ propLR[1 - idxLR] + ':auto',
1732
+ propTB[1 - idxTB] + ':auto',
1733
+ ''
1734
+ ].join('!important;');
1735
+ el.appendChild(marker);
1736
+ markers.push(marker);
1737
+ }
1738
+
1739
+ return markers;
1740
+ }
1741
+
1742
+ function preparePointerTransformer(markers, saved, inverse) {
1743
+ var transformerName = inverse ? 'invTrans' : 'trans';
1744
+ var transformer = saved[transformerName];
1745
+ var oldSrcCoords = saved.srcCoords;
1746
+ var oldCoordTheSame = true;
1747
+ var srcCoords = [];
1748
+ var destCoords = [];
1749
+
1750
+ for (var i = 0; i < 4; i++) {
1751
+ var rect = markers[i].getBoundingClientRect();
1752
+ var ii = 2 * i;
1753
+ var x = rect.left;
1754
+ var y = rect.top;
1755
+ srcCoords.push(x, y);
1756
+ oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
1757
+ destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
1758
+ }
1759
+ // Cache to avoid time consuming of `buildTransformer`.
1760
+ return (oldCoordTheSame && transformer)
1761
+ ? transformer
1762
+ : (
1763
+ saved.srcCoords = srcCoords,
1764
+ saved[transformerName] = inverse
1765
+ ? buildTransformer(destCoords, srcCoords)
1766
+ : buildTransformer(srcCoords, destCoords)
1767
+ );
1768
+ }
1769
+
1770
+ function isCanvasEl(el) {
1771
+ return el.nodeName.toUpperCase() === 'CANVAS';
1772
+ }
1773
+
1626
1774
  /**
1627
1775
  * Utilities for mouse or touch events.
1628
1776
  */
@@ -1630,7 +1778,6 @@ function buildTransformer(src, dest) {
1630
1778
  var isDomLevel2 = (typeof window !== 'undefined') && !!window.addEventListener;
1631
1779
 
1632
1780
  var MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;
1633
- var EVENT_SAVED_PROP = '___zrEVENTSAVED';
1634
1781
  var _calcOut = [];
1635
1782
 
1636
1783
  /**
@@ -1695,11 +1842,11 @@ function clientToLocal(el, e, out, calculate) {
1695
1842
 
1696
1843
  function calculateZrXY(el, e, out) {
1697
1844
  // BlackBerry 5, iOS 3 (original iPhone) don't have getBoundingRect.
1698
- if (el.getBoundingClientRect && env$1.domSupported) {
1845
+ if (env$1.domSupported && el.getBoundingClientRect) {
1699
1846
  var ex = e.clientX;
1700
1847
  var ey = e.clientY;
1701
1848
 
1702
- if (el.nodeName.toUpperCase() === 'CANVAS') {
1849
+ if (isCanvasEl(el)) {
1703
1850
  // Original approach, which do not support CSS transform.
1704
1851
  // marker can not be locationed in a canvas container
1705
1852
  // (getBoundingClientRect is always 0). We do not support
@@ -1711,10 +1858,7 @@ function calculateZrXY(el, e, out) {
1711
1858
  return;
1712
1859
  }
1713
1860
  else {
1714
- var saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
1715
- var transformer = preparePointerTransformer(prepareCoordMarkers(el, saved), saved);
1716
- if (transformer) {
1717
- transformer(_calcOut, ex, ey);
1861
+ if (transformCoordWithViewport(_calcOut, el, ex, ey)) {
1718
1862
  out.zrX = _calcOut[0];
1719
1863
  out.zrY = _calcOut[1];
1720
1864
  return;
@@ -1724,70 +1868,6 @@ function calculateZrXY(el, e, out) {
1724
1868
  out.zrX = out.zrY = 0;
1725
1869
  }
1726
1870
 
1727
- function prepareCoordMarkers(el, saved) {
1728
- var markers = saved.markers;
1729
- if (markers) {
1730
- return markers;
1731
- }
1732
-
1733
- markers = saved.markers = [];
1734
- var propLR = ['left', 'right'];
1735
- var propTB = ['top', 'bottom'];
1736
-
1737
- for (var i = 0; i < 4; i++) {
1738
- var marker = document.createElement('div');
1739
- var stl = marker.style;
1740
- var idxLR = i % 2;
1741
- var idxTB = (i >> 1) % 2;
1742
- stl.cssText = [
1743
- 'position:absolute',
1744
- 'visibility: hidden',
1745
- 'padding: 0',
1746
- 'margin: 0',
1747
- 'border-width: 0',
1748
- 'width:0',
1749
- 'height:0',
1750
- // 'width: 5px',
1751
- // 'height: 5px',
1752
- propLR[idxLR] + ':0',
1753
- propTB[idxTB] + ':0',
1754
- propLR[1 - idxLR] + ':auto',
1755
- propTB[1 - idxTB] + ':auto',
1756
- ''
1757
- ].join('!important;');
1758
- el.appendChild(marker);
1759
- markers.push(marker);
1760
- }
1761
-
1762
- return markers;
1763
- }
1764
-
1765
- function preparePointerTransformer(markers, saved) {
1766
- var transformer = saved.transformer;
1767
- var oldSrcCoords = saved.srcCoords;
1768
- var useOld = true;
1769
- var srcCoords = [];
1770
- var destCoords = [];
1771
-
1772
- for (var i = 0; i < 4; i++) {
1773
- var rect = markers[i].getBoundingClientRect();
1774
- var ii = 2 * i;
1775
- var x = rect.left;
1776
- var y = rect.top;
1777
- srcCoords.push(x, y);
1778
- useOld &= oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
1779
- destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
1780
- }
1781
-
1782
- // Cache to avoid time consuming of `buildTransformer`.
1783
- return useOld
1784
- ? transformer
1785
- : (
1786
- saved.srcCoords = srcCoords,
1787
- saved.transformer = buildTransformer(srcCoords, destCoords)
1788
- );
1789
- }
1790
-
1791
1871
  /**
1792
1872
  * Find native event compat for legency IE.
1793
1873
  * Should be called at the begining of a native event listener.
@@ -4473,7 +4553,7 @@ var Animator = function (target, loop, getter, setter) {
4473
4553
 
4474
4554
  Animator.prototype = {
4475
4555
  /**
4476
- * 设置动画关键帧
4556
+ * Set Animation keyframe
4477
4557
  * @param {number} time 关键帧时间,单位是ms
4478
4558
  * @param {Object} props 关键帧的属性值,key-value表示
4479
4559
  * @return {module:zrender/animation/Animator}
@@ -4552,7 +4632,7 @@ Animator.prototype = {
4552
4632
  }
4553
4633
  },
4554
4634
  /**
4555
- * 开始执行动画
4635
+ * Start the animation
4556
4636
  * @param {string|Function} [easing]
4557
4637
  * 动画缓动函数,详见{@link module:zrender/animation/easing}
4558
4638
  * @param {boolean} forceAnimate
@@ -4613,7 +4693,7 @@ Animator.prototype = {
4613
4693
  return this;
4614
4694
  },
4615
4695
  /**
4616
- * 停止动画
4696
+ * Stop animation
4617
4697
  * @param {boolean} forwardToLast If move to last frame before stop
4618
4698
  */
4619
4699
  stop: function (forwardToLast) {
@@ -4630,7 +4710,7 @@ Animator.prototype = {
4630
4710
  clipList.length = 0;
4631
4711
  },
4632
4712
  /**
4633
- * 设置动画延迟开始的时间
4713
+ * Set when animation delay starts
4634
4714
  * @param {number} time 单位ms
4635
4715
  * @return {module:zrender/animation/Animator}
4636
4716
  */
@@ -4639,7 +4719,7 @@ Animator.prototype = {
4639
4719
  return this;
4640
4720
  },
4641
4721
  /**
4642
- * 添加动画结束的回调
4722
+ * Add callback for animation end
4643
4723
  * @param {Function} cb
4644
4724
  * @return {module:zrender/animation/Animator}
4645
4725
  */
@@ -4691,7 +4771,7 @@ if (debugMode === 1) {
4691
4771
  var logError$1 = logError;
4692
4772
 
4693
4773
  /**
4694
- * @alias modue:zrender/mixin/Animatable
4774
+ * @alias module:zrender/mixin/Animatable
4695
4775
  * @constructor
4696
4776
  */
4697
4777
  var Animatable = function () {
@@ -10367,7 +10447,7 @@ Painter.prototype = {
10367
10447
  };
10368
10448
 
10369
10449
  /**
10370
- * 动画主类, 调度和管理所有动画控制器
10450
+ * Animation main class, dispatch and manage all animation controllers
10371
10451
  *
10372
10452
  * @module zrender/animation/Animation
10373
10453
  * @author pissang(https://github.com/pissang)
@@ -10432,14 +10512,14 @@ Animation.prototype = {
10432
10512
 
10433
10513
  constructor: Animation,
10434
10514
  /**
10435
- * 添加 clip
10515
+ * Add clip
10436
10516
  * @param {module:zrender/animation/Clip} clip
10437
10517
  */
10438
10518
  addClip: function (clip) {
10439
10519
  this._clips.push(clip);
10440
10520
  },
10441
10521
  /**
10442
- * 添加 animator
10522
+ * Add animator
10443
10523
  * @param {module:zrender/animation/Animator} animator
10444
10524
  */
10445
10525
  addAnimator: function (animator) {
@@ -10450,7 +10530,7 @@ Animation.prototype = {
10450
10530
  }
10451
10531
  },
10452
10532
  /**
10453
- * 删除动画片段
10533
+ * Delete animation clip
10454
10534
  * @param {module:zrender/animation/Clip} clip
10455
10535
  */
10456
10536
  removeClip: function (clip) {
@@ -10461,7 +10541,7 @@ Animation.prototype = {
10461
10541
  },
10462
10542
 
10463
10543
  /**
10464
- * 删除动画片段
10544
+ * Delete animation clip
10465
10545
  * @param {module:zrender/animation/Animator} animator
10466
10546
  */
10467
10547
  removeAnimator: function (animator) {
@@ -10728,13 +10808,16 @@ function normalizeGlobalEvent(instance, event) {
10728
10808
  * Detect whether the given el is in `painterRoot`.
10729
10809
  */
10730
10810
  function isLocalEl(instance, el) {
10811
+ var elTmp = el;
10731
10812
  var isLocal = false;
10732
- do {
10733
- el = el && el.parentNode;
10813
+ while (elTmp && elTmp.nodeType !== 9
10814
+ && !(
10815
+ isLocal = elTmp.domBelongToZr
10816
+ || (elTmp !== el && elTmp === instance.painterRoot)
10817
+ )
10818
+ ) {
10819
+ elTmp = elTmp.parentNode;
10734
10820
  }
10735
- while (el && el.nodeType !== 9 && !(
10736
- isLocal = el === instance.painterRoot
10737
- ));
10738
10821
  return isLocal;
10739
10822
  }
10740
10823
 
@@ -11187,7 +11270,7 @@ var painterCtors = {
11187
11270
  /**
11188
11271
  * @type {string}
11189
11272
  */
11190
- var version$1 = '4.2.0';
11273
+ var version$1 = '4.3.0';
11191
11274
 
11192
11275
  /**
11193
11276
  * Initializing a zrender instance
@@ -16020,12 +16103,10 @@ var round = Math.round;
16020
16103
  * @param {number} [inputShape.x2]
16021
16104
  * @param {number} [inputShape.y2]
16022
16105
  * @param {Object} [style]
16023
- * @param {number} [style.lineWidth]
16106
+ * @param {number} [style.lineWidth] If `null`/`undefined`/`0`, do not optimize.
16024
16107
  */
16025
16108
  function subPixelOptimizeLine$1(outputShape, inputShape, style) {
16026
- var lineWidth = style && style.lineWidth;
16027
-
16028
- if (!inputShape || !lineWidth) {
16109
+ if (!inputShape) {
16029
16110
  return;
16030
16111
  }
16031
16112
 
@@ -16034,20 +16115,22 @@ function subPixelOptimizeLine$1(outputShape, inputShape, style) {
16034
16115
  var y1 = inputShape.y1;
16035
16116
  var y2 = inputShape.y2;
16036
16117
 
16118
+ outputShape.x1 = x1;
16119
+ outputShape.x2 = x2;
16120
+ outputShape.y1 = y1;
16121
+ outputShape.y2 = y2;
16122
+
16123
+ var lineWidth = style && style.lineWidth;
16124
+ if (!lineWidth) {
16125
+ return;
16126
+ }
16127
+
16037
16128
  if (round(x1 * 2) === round(x2 * 2)) {
16038
16129
  outputShape.x1 = outputShape.x2 = subPixelOptimize$1(x1, lineWidth, true);
16039
16130
  }
16040
- else {
16041
- outputShape.x1 = x1;
16042
- outputShape.x2 = x2;
16043
- }
16044
16131
  if (round(y1 * 2) === round(y2 * 2)) {
16045
16132
  outputShape.y1 = outputShape.y2 = subPixelOptimize$1(y1, lineWidth, true);
16046
16133
  }
16047
- else {
16048
- outputShape.y1 = y1;
16049
- outputShape.y2 = y2;
16050
- }
16051
16134
  }
16052
16135
 
16053
16136
  /**
@@ -16063,12 +16146,10 @@ function subPixelOptimizeLine$1(outputShape, inputShape, style) {
16063
16146
  * @param {number} [inputShape.width]
16064
16147
  * @param {number} [inputShape.height]
16065
16148
  * @param {Object} [style]
16066
- * @param {number} [style.lineWidth]
16149
+ * @param {number} [style.lineWidth] If `null`/`undefined`/`0`, do not optimize.
16067
16150
  */
16068
16151
  function subPixelOptimizeRect$1(outputShape, inputShape, style) {
16069
- var lineWidth = style && style.lineWidth;
16070
-
16071
- if (!inputShape || !lineWidth) {
16152
+ if (!inputShape) {
16072
16153
  return;
16073
16154
  }
16074
16155
 
@@ -16077,6 +16158,16 @@ function subPixelOptimizeRect$1(outputShape, inputShape, style) {
16077
16158
  var originWidth = inputShape.width;
16078
16159
  var originHeight = inputShape.height;
16079
16160
 
16161
+ outputShape.x = originX;
16162
+ outputShape.y = originY;
16163
+ outputShape.width = originWidth;
16164
+ outputShape.height = originHeight;
16165
+
16166
+ var lineWidth = style && style.lineWidth;
16167
+ if (!lineWidth) {
16168
+ return;
16169
+ }
16170
+
16080
16171
  outputShape.x = subPixelOptimize$1(originX, lineWidth, true);
16081
16172
  outputShape.y = subPixelOptimize$1(originY, lineWidth, true);
16082
16173
  outputShape.width = Math.max(
@@ -16093,11 +16184,14 @@ function subPixelOptimizeRect$1(outputShape, inputShape, style) {
16093
16184
  * Sub pixel optimize for canvas
16094
16185
  *
16095
16186
  * @param {number} position Coordinate, such as x, y
16096
- * @param {number} lineWidth Should be nonnegative integer.
16187
+ * @param {number} lineWidth If `null`/`undefined`/`0`, do not optimize.
16097
16188
  * @param {boolean=} positiveOrNegative Default false (negative).
16098
16189
  * @return {number} Optimized position.
16099
16190
  */
16100
16191
  function subPixelOptimize$1(position, lineWidth, positiveOrNegative) {
16192
+ if (!lineWidth) {
16193
+ return position;
16194
+ }
16101
16195
  // Assure that (position + lineWidth / 2) is near integer edge,
16102
16196
  // otherwise line will be fuzzy in canvas.
16103
16197
  var doubledPosition = round(position * 2);
@@ -17798,7 +17892,7 @@ function animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, cb)
17798
17892
  * configuration in series.
17799
17893
  *
17800
17894
  * Caution: this method will stop previous animation.
17801
- * So if do not use this method to one element twice before
17895
+ * So do not use this method to one element twice before
17802
17896
  * animation starts, unless you know what you are doing.
17803
17897
  *
17804
17898
  * @param {module:zrender/Element} el
@@ -17824,7 +17918,7 @@ function updateProps(el, props, animatableModel, dataIndex, cb) {
17824
17918
  * configuration in series.
17825
17919
  *
17826
17920
  * Caution: this method will stop previous animation.
17827
- * So if do not use this method to one element twice before
17921
+ * So do not use this method to one element twice before
17828
17922
  * animation starts, unless you know what you are doing.
17829
17923
  *
17830
17924
  * @param {module:zrender/Element} el
@@ -24472,8 +24566,11 @@ var createRenderPlanner = function () {
24472
24566
  var originalLarge = fields.large;
24473
24567
  var originalProgressive = fields.progressiveRender;
24474
24568
 
24475
- var large = fields.large = pipelineContext.large;
24476
- var progressive = fields.progressiveRender = pipelineContext.progressiveRender;
24569
+ // FIXME: if the planner works on a filtered series, `pipelineContext` does not
24570
+ // exists. See #11611 . Probably we need to modify this structure, see the comment
24571
+ // on `performRawSeries` in `Schedular.js`.
24572
+ var large = fields.large = pipelineContext && pipelineContext.large;
24573
+ var progressive = fields.progressiveRender = pipelineContext && pipelineContext.progressiveRender;
24477
24574
 
24478
24575
  return !!((originalLarge ^ large) || (originalProgressive ^ progressive)) && 'reset';
24479
24576
  };
@@ -25587,6 +25684,14 @@ function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
25587
25684
  task.dirty();
25588
25685
  }
25589
25686
  var performArgs = scheduler.getPerformArgs(task, opt.block);
25687
+ // FIXME
25688
+ // if intending to decalare `performRawSeries` in handlers, only
25689
+ // stream-independent (specifically, data item independent) operations can be
25690
+ // performed. Because is a series is filtered, most of the tasks will not
25691
+ // be performed. A stream-dependent operation probably cause wrong biz logic.
25692
+ // Perhaps we should not provide a separate callback for this case instead
25693
+ // of providing the config `performRawSeries`. The stream-dependent operaions
25694
+ // and stream-independent operations should better not be mixed.
25590
25695
  performArgs.skip = !stageHandler.performRawSeries
25591
25696
  && ecModel.isSeriesFiltered(task.context.model);
25592
25697
  updatePayload(task, payload);
@@ -26961,10 +27066,10 @@ var isFunction = isFunction$1;
26961
27066
  var isObject = isObject$1;
26962
27067
  var parseClassType = ComponentModel.parseClassType;
26963
27068
 
26964
- var version = '4.6.0';
27069
+ var version = '4.7.0';
26965
27070
 
26966
27071
  var dependencies = {
26967
- zrender: '4.2.0'
27072
+ zrender: '4.3.0'
26968
27073
  };
26969
27074
 
26970
27075
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -36152,7 +36257,7 @@ var IntervalScale = Scale.extend({
36152
36257
 
36153
36258
  if (extent[0] < niceTickExtent[0]) {
36154
36259
  if (expandToNicedExtent) {
36155
- ticks.push(roundNumber(niceTickExtent[0] - interval));
36260
+ ticks.push(roundNumber(niceTickExtent[0] - interval, intervalPrecision));
36156
36261
  }
36157
36262
  else {
36158
36263
  ticks.push(extent[0]);
@@ -36178,7 +36283,7 @@ var IntervalScale = Scale.extend({
36178
36283
  var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
36179
36284
  if (extent[1] > lastNiceTick) {
36180
36285
  if (expandToNicedExtent) {
36181
- ticks.push(lastNiceTick + interval);
36286
+ ticks.push(roundNumber(lastNiceTick + interval, intervalPrecision));
36182
36287
  }
36183
36288
  else {
36184
36289
  ticks.push(extent[1]);
@@ -36726,11 +36831,6 @@ function layout(seriesType, ecModel) {
36726
36831
  var value = data.get(valueDim, idx);
36727
36832
  var baseValue = data.get(baseDim, idx);
36728
36833
 
36729
- // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
36730
- if (isNaN(value) || isNaN(baseValue)) {
36731
- continue;
36732
- }
36733
-
36734
36834
  var sign = value >= 0 ? 'p' : 'n';
36735
36835
  var baseCoord = valueAxisStart;
36736
36836
 
@@ -36763,7 +36863,10 @@ function layout(seriesType, ecModel) {
36763
36863
  if (Math.abs(width) < barMinHeight) {
36764
36864
  width = (width < 0 ? -1 : 1) * barMinHeight;
36765
36865
  }
36766
- stacked && (lastStackCoords[stackId][baseValue][sign] += width);
36866
+ // Ignore stack from NaN value
36867
+ if (!isNaN(width)) {
36868
+ stacked && (lastStackCoords[stackId][baseValue][sign] += width);
36869
+ }
36767
36870
  }
36768
36871
  else {
36769
36872
  var coord = cartesian.dataToPoint([baseValue, value]);
@@ -36776,7 +36879,10 @@ function layout(seriesType, ecModel) {
36776
36879
  // Include zero to has a positive bar
36777
36880
  height = (height <= 0 ? -1 : 1) * barMinHeight;
36778
36881
  }
36779
- stacked && (lastStackCoords[stackId][baseValue][sign] += height);
36882
+ // Ignore stack from NaN value
36883
+ if (!isNaN(height)) {
36884
+ stacked && (lastStackCoords[stackId][baseValue][sign] += height);
36885
+ }
36780
36886
  }
36781
36887
 
36782
36888
  data.setItemLayout(idx, {
@@ -36804,6 +36910,7 @@ var largeLayout = {
36804
36910
 
36805
36911
  var data = seriesModel.getData();
36806
36912
  var cartesian = seriesModel.coordinateSystem;
36913
+ var coordLayout = cartesian.grid.getRect();
36807
36914
  var baseAxis = cartesian.getBaseAxis();
36808
36915
  var valueAxis = cartesian.getOtherAxis(baseAxis);
36809
36916
  var valueDim = data.mapDimension(valueAxis.dim);
@@ -36823,6 +36930,7 @@ var largeLayout = {
36823
36930
  function progress(params, data) {
36824
36931
  var count = params.count;
36825
36932
  var largePoints = new LargeArr(count * 2);
36933
+ var largeBackgroundPoints = new LargeArr(count * 2);
36826
36934
  var largeDataIndices = new LargeArr(count);
36827
36935
  var dataIndex;
36828
36936
  var coord = [];
@@ -36836,7 +36944,9 @@ var largeLayout = {
36836
36944
 
36837
36945
  coord = cartesian.dataToPoint(valuePair, null, coord);
36838
36946
  // Data index might not be in order, depends on `progressiveChunkMode`.
36947
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
36839
36948
  largePoints[pointsOffset++] = coord[0];
36949
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
36840
36950
  largePoints[pointsOffset++] = coord[1];
36841
36951
  largeDataIndices[idxOffset++] = dataIndex;
36842
36952
  }
@@ -36844,8 +36954,10 @@ var largeLayout = {
36844
36954
  data.setLayout({
36845
36955
  largePoints: largePoints,
36846
36956
  largeDataIndices: largeDataIndices,
36957
+ largeBackgroundPoints: largeBackgroundPoints,
36847
36958
  barWidth: barWidth,
36848
36959
  valueAxisStart: getValueAxisStart(baseAxis, valueAxis, false),
36960
+ backgroundStart: valueAxisHorizontal ? coordLayout.x : coordLayout.y,
36849
36961
  valueAxisHorizontal: valueAxisHorizontal
36850
36962
  });
36851
36963
  }
@@ -41082,6 +41194,117 @@ function layout$1(gridModel, axisModel, opt) {
41082
41194
  * under the License.
41083
41195
  */
41084
41196
 
41197
+ function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
41198
+ var axis = axisModel.axis;
41199
+
41200
+ if (axis.scale.isBlank()) {
41201
+ return;
41202
+ }
41203
+
41204
+ var splitAreaModel = axisModel.getModel('splitArea');
41205
+ var areaStyleModel = splitAreaModel.getModel('areaStyle');
41206
+ var areaColors = areaStyleModel.get('color');
41207
+
41208
+ var gridRect = gridModel.coordinateSystem.getRect();
41209
+
41210
+ var ticksCoords = axis.getTicksCoords({
41211
+ tickModel: splitAreaModel,
41212
+ clamp: true
41213
+ });
41214
+
41215
+ if (!ticksCoords.length) {
41216
+ return;
41217
+ }
41218
+
41219
+ // For Making appropriate splitArea animation, the color and anid
41220
+ // should be corresponding to previous one if possible.
41221
+ var areaColorsLen = areaColors.length;
41222
+ var lastSplitAreaColors = axisView.__splitAreaColors;
41223
+ var newSplitAreaColors = createHashMap();
41224
+ var colorIndex = 0;
41225
+ if (lastSplitAreaColors) {
41226
+ for (var i = 0; i < ticksCoords.length; i++) {
41227
+ var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
41228
+ if (cIndex != null) {
41229
+ colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
41230
+ break;
41231
+ }
41232
+ }
41233
+ }
41234
+
41235
+ var prev = axis.toGlobalCoord(ticksCoords[0].coord);
41236
+
41237
+ var areaStyle = areaStyleModel.getAreaStyle();
41238
+ areaColors = isArray(areaColors) ? areaColors : [areaColors];
41239
+
41240
+ for (var i = 1; i < ticksCoords.length; i++) {
41241
+ var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
41242
+
41243
+ var x;
41244
+ var y;
41245
+ var width;
41246
+ var height;
41247
+ if (axis.isHorizontal()) {
41248
+ x = prev;
41249
+ y = gridRect.y;
41250
+ width = tickCoord - x;
41251
+ height = gridRect.height;
41252
+ prev = x + width;
41253
+ }
41254
+ else {
41255
+ x = gridRect.x;
41256
+ y = prev;
41257
+ width = gridRect.width;
41258
+ height = tickCoord - y;
41259
+ prev = y + height;
41260
+ }
41261
+
41262
+ var tickValue = ticksCoords[i - 1].tickValue;
41263
+ tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
41264
+
41265
+ axisGroup.add(new Rect({
41266
+ anid: tickValue != null ? 'area_' + tickValue : null,
41267
+ shape: {
41268
+ x: x,
41269
+ y: y,
41270
+ width: width,
41271
+ height: height
41272
+ },
41273
+ style: defaults({
41274
+ fill: areaColors[colorIndex]
41275
+ }, areaStyle),
41276
+ silent: true
41277
+ }));
41278
+
41279
+ colorIndex = (colorIndex + 1) % areaColorsLen;
41280
+ }
41281
+
41282
+ axisView.__splitAreaColors = newSplitAreaColors;
41283
+ }
41284
+
41285
+ function rectCoordAxisHandleRemove(axisView) {
41286
+ axisView.__splitAreaColors = null;
41287
+ }
41288
+
41289
+ /*
41290
+ * Licensed to the Apache Software Foundation (ASF) under one
41291
+ * or more contributor license agreements. See the NOTICE file
41292
+ * distributed with this work for additional information
41293
+ * regarding copyright ownership. The ASF licenses this file
41294
+ * to you under the Apache License, Version 2.0 (the
41295
+ * "License"); you may not use this file except in compliance
41296
+ * with the License. You may obtain a copy of the License at
41297
+ *
41298
+ * http://www.apache.org/licenses/LICENSE-2.0
41299
+ *
41300
+ * Unless required by applicable law or agreed to in writing,
41301
+ * software distributed under the License is distributed on an
41302
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
41303
+ * KIND, either express or implied. See the License for the
41304
+ * specific language governing permissions and limitations
41305
+ * under the License.
41306
+ */
41307
+
41085
41308
  var axisBuilderAttrs = [
41086
41309
  'axisLine', 'axisTickLabel', 'axisName'
41087
41310
  ];
@@ -41133,7 +41356,7 @@ var CartesianAxisView = AxisView.extend({
41133
41356
  },
41134
41357
 
41135
41358
  remove: function () {
41136
- this._splitAreaColors = null;
41359
+ rectCoordAxisHandleRemove(this);
41137
41360
  },
41138
41361
 
41139
41362
  /**
@@ -41265,91 +41488,7 @@ var CartesianAxisView = AxisView.extend({
41265
41488
  * @private
41266
41489
  */
41267
41490
  _splitArea: function (axisModel, gridModel) {
41268
- var axis = axisModel.axis;
41269
-
41270
- if (axis.scale.isBlank()) {
41271
- return;
41272
- }
41273
-
41274
- var splitAreaModel = axisModel.getModel('splitArea');
41275
- var areaStyleModel = splitAreaModel.getModel('areaStyle');
41276
- var areaColors = areaStyleModel.get('color');
41277
-
41278
- var gridRect = gridModel.coordinateSystem.getRect();
41279
-
41280
- var ticksCoords = axis.getTicksCoords({
41281
- tickModel: splitAreaModel,
41282
- clamp: true
41283
- });
41284
-
41285
- if (!ticksCoords.length) {
41286
- return;
41287
- }
41288
-
41289
- // For Making appropriate splitArea animation, the color and anid
41290
- // should be corresponding to previous one if possible.
41291
- var areaColorsLen = areaColors.length;
41292
- var lastSplitAreaColors = this._splitAreaColors;
41293
- var newSplitAreaColors = createHashMap();
41294
- var colorIndex = 0;
41295
- if (lastSplitAreaColors) {
41296
- for (var i = 0; i < ticksCoords.length; i++) {
41297
- var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
41298
- if (cIndex != null) {
41299
- colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
41300
- break;
41301
- }
41302
- }
41303
- }
41304
-
41305
- var prev = axis.toGlobalCoord(ticksCoords[0].coord);
41306
-
41307
- var areaStyle = areaStyleModel.getAreaStyle();
41308
- areaColors = isArray(areaColors) ? areaColors : [areaColors];
41309
-
41310
- for (var i = 1; i < ticksCoords.length; i++) {
41311
- var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
41312
-
41313
- var x;
41314
- var y;
41315
- var width;
41316
- var height;
41317
- if (axis.isHorizontal()) {
41318
- x = prev;
41319
- y = gridRect.y;
41320
- width = tickCoord - x;
41321
- height = gridRect.height;
41322
- prev = x + width;
41323
- }
41324
- else {
41325
- x = gridRect.x;
41326
- y = prev;
41327
- width = gridRect.width;
41328
- height = tickCoord - y;
41329
- prev = y + height;
41330
- }
41331
-
41332
- var tickValue = ticksCoords[i - 1].tickValue;
41333
- tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
41334
-
41335
- this._axisGroup.add(new Rect({
41336
- anid: tickValue != null ? 'area_' + tickValue : null,
41337
- shape: {
41338
- x: x,
41339
- y: y,
41340
- width: width,
41341
- height: height
41342
- },
41343
- style: defaults({
41344
- fill: areaColors[colorIndex]
41345
- }, areaStyle),
41346
- silent: true
41347
- }));
41348
-
41349
- colorIndex = (colorIndex + 1) % areaColorsLen;
41350
- }
41351
-
41352
- this._splitAreaColors = newSplitAreaColors;
41491
+ rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, gridModel);
41353
41492
  }
41354
41493
  });
41355
41494
 
@@ -41595,7 +41734,21 @@ BaseBarSeries.extend({
41595
41734
 
41596
41735
  // If use caps on two sides of bars
41597
41736
  // Only available on tangential polar bar
41598
- roundCap: false
41737
+ roundCap: false,
41738
+
41739
+ showBackground: false,
41740
+ backgroundStyle: {
41741
+ color: 'rgba(180, 180, 180, 0.2)',
41742
+ borderColor: null,
41743
+ borderWidth: 0,
41744
+ borderType: 'solid',
41745
+ borderRadius: 0,
41746
+ shadowBlur: 0,
41747
+ shadowColor: null,
41748
+ shadowOffsetX: 0,
41749
+ shadowOffsetY: 0,
41750
+ opacity: 1
41751
+ }
41599
41752
  }
41600
41753
  });
41601
41754
 
@@ -41900,15 +42053,28 @@ extendChartView({
41900
42053
 
41901
42054
  var roundCap = seriesModel.get('roundCap', true);
41902
42055
 
42056
+ var drawBackground = seriesModel.get('showBackground', true);
42057
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
42058
+
42059
+ var bgEls = [];
42060
+ var oldBgEls = this._backgroundEls || [];
42061
+
41903
42062
  data.diff(oldData)
41904
42063
  .add(function (dataIndex) {
42064
+ var itemModel = data.getItemModel(dataIndex);
42065
+ var layout = getLayout[coord.type](data, dataIndex, itemModel);
42066
+
42067
+ if (drawBackground) {
42068
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
42069
+ bgEl.useStyle(backgroundModel.getBarItemStyle());
42070
+ bgEls[dataIndex] = bgEl;
42071
+ }
42072
+
42073
+ // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
41905
42074
  if (!data.hasValue(dataIndex)) {
41906
42075
  return;
41907
42076
  }
41908
42077
 
41909
- var itemModel = data.getItemModel(dataIndex);
41910
- var layout = getLayout[coord.type](data, dataIndex, itemModel);
41911
-
41912
42078
  if (needsClip) {
41913
42079
  // Clip will modify the layout params.
41914
42080
  // And return a boolean to determine if the shape are fully clipped.
@@ -41931,16 +42097,24 @@ extendChartView({
41931
42097
  );
41932
42098
  })
41933
42099
  .update(function (newIndex, oldIndex) {
41934
- var el = oldData.getItemGraphicEl(oldIndex);
42100
+ var itemModel = data.getItemModel(newIndex);
42101
+ var layout = getLayout[coord.type](data, newIndex, itemModel);
42102
+
42103
+ if (drawBackground) {
42104
+ var bgEl = oldBgEls[oldIndex];
42105
+ bgEl.useStyle(backgroundModel.getBarItemStyle());
42106
+ bgEls[newIndex] = bgEl;
41935
42107
 
42108
+ var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
42109
+ updateProps(bgEl, { shape: shape }, animationModel, newIndex);
42110
+ }
42111
+
42112
+ var el = oldData.getItemGraphicEl(oldIndex);
41936
42113
  if (!data.hasValue(newIndex)) {
41937
42114
  group.remove(el);
41938
42115
  return;
41939
42116
  }
41940
42117
 
41941
- var itemModel = data.getItemModel(newIndex);
41942
- var layout = getLayout[coord.type](data, newIndex, itemModel);
41943
-
41944
42118
  if (needsClip) {
41945
42119
  var isClipped = clip[coord.type](coordSysClipArea, layout);
41946
42120
  if (isClipped) {
@@ -41978,6 +42152,15 @@ extendChartView({
41978
42152
  })
41979
42153
  .execute();
41980
42154
 
42155
+ var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());
42156
+ bgGroup.removeAll();
42157
+
42158
+ for (var i = 0; i < bgEls.length; ++i) {
42159
+ bgGroup.add(bgEls[i]);
42160
+ }
42161
+ group.add(bgGroup);
42162
+ this._backgroundEls = bgEls;
42163
+
41981
42164
  this._data = data;
41982
42165
  },
41983
42166
 
@@ -41998,6 +42181,7 @@ extendChartView({
41998
42181
  },
41999
42182
 
42000
42183
  _incrementalRenderLarge: function (params, seriesModel) {
42184
+ this._removeBackground();
42001
42185
  createLarge(seriesModel, this.group, true);
42002
42186
  },
42003
42187
 
@@ -42011,6 +42195,9 @@ extendChartView({
42011
42195
  var group = this.group;
42012
42196
  var data = this._data;
42013
42197
  if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
42198
+ this._removeBackground();
42199
+ this._backgroundEls = [];
42200
+
42014
42201
  data.eachItemGraphicEl(function (el) {
42015
42202
  if (el.type === 'sector') {
42016
42203
  removeSector(el.dataIndex, ecModel, el);
@@ -42024,6 +42211,11 @@ extendChartView({
42024
42211
  group.removeAll();
42025
42212
  }
42026
42213
  this._data = null;
42214
+ },
42215
+
42216
+ _removeBackground: function () {
42217
+ this.group.remove(this._backgroundGroup);
42218
+ this._backgroundGroup = null;
42027
42219
  }
42028
42220
 
42029
42221
  });
@@ -42081,7 +42273,12 @@ var elementCreator = {
42081
42273
  dataIndex, layout, isHorizontal,
42082
42274
  animationModel, isUpdate
42083
42275
  ) {
42084
- var rect = new Rect({shape: extend({}, layout)});
42276
+ var rect = new Rect({
42277
+ shape: extend({}, layout),
42278
+ z2: 1
42279
+ });
42280
+
42281
+ rect.name = 'item';
42085
42282
 
42086
42283
  // Animation
42087
42284
  if (animationModel) {
@@ -42111,9 +42308,12 @@ var elementCreator = {
42111
42308
  var ShapeClass = (!isRadial && roundCap) ? Sausage : Sector;
42112
42309
 
42113
42310
  var sector = new ShapeClass({
42114
- shape: defaults({clockwise: clockwise}, layout)
42311
+ shape: defaults({clockwise: clockwise}, layout),
42312
+ z2: 1
42115
42313
  });
42116
42314
 
42315
+ sector.name = 'item';
42316
+
42117
42317
  // Animation
42118
42318
  if (animationModel) {
42119
42319
  var sectorShape = sector.shape;
@@ -42233,7 +42433,10 @@ function updateStyle(
42233
42433
  // In case width or height are too small.
42234
42434
  function getLineWidth(itemModel, rawLayout) {
42235
42435
  var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
42236
- return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height));
42436
+ // width or height may be NaN for empty data
42437
+ var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
42438
+ var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
42439
+ return Math.min(lineWidth, width, height);
42237
42440
  }
42238
42441
 
42239
42442
 
@@ -42265,13 +42468,38 @@ function createLarge(seriesModel, group, incremental) {
42265
42468
  var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
42266
42469
  startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart');
42267
42470
 
42471
+ var largeDataIndices = data.getLayout('largeDataIndices');
42472
+ var barWidth = data.getLayout('barWidth');
42473
+
42474
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
42475
+ var drawBackground = seriesModel.get('showBackground', true);
42476
+
42477
+ if (drawBackground) {
42478
+ var points = data.getLayout('largeBackgroundPoints');
42479
+ var backgroundStartPoint = [];
42480
+ backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart');
42481
+
42482
+ var bgEl = new LargePath({
42483
+ shape: {points: points},
42484
+ incremental: !!incremental,
42485
+ __startPoint: backgroundStartPoint,
42486
+ __baseDimIdx: baseDimIdx,
42487
+ __largeDataIndices: largeDataIndices,
42488
+ __barWidth: barWidth,
42489
+ silent: true,
42490
+ z2: 0
42491
+ });
42492
+ setLargeBackgroundStyle(bgEl, backgroundModel, data);
42493
+ group.add(bgEl);
42494
+ }
42495
+
42268
42496
  var el = new LargePath({
42269
42497
  shape: {points: data.getLayout('largePoints')},
42270
42498
  incremental: !!incremental,
42271
42499
  __startPoint: startPoint,
42272
42500
  __baseDimIdx: baseDimIdx,
42273
- __largeDataIndices: data.getLayout('largeDataIndices'),
42274
- __barWidth: data.getLayout('barWidth')
42501
+ __largeDataIndices: largeDataIndices,
42502
+ __barWidth: barWidth
42275
42503
  });
42276
42504
  group.add(el);
42277
42505
  setLargeStyle(el, seriesModel, data);
@@ -42336,6 +42564,55 @@ function setLargeStyle(el, seriesModel, data) {
42336
42564
  el.style.lineWidth = data.getLayout('barWidth');
42337
42565
  }
42338
42566
 
42567
+ function setLargeBackgroundStyle(el, backgroundModel, data) {
42568
+ var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color');
42569
+ var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']);
42570
+
42571
+ el.useStyle(itemStyle);
42572
+ el.style.fill = null;
42573
+ el.style.stroke = borderColor;
42574
+ el.style.lineWidth = data.getLayout('barWidth');
42575
+ }
42576
+
42577
+ function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
42578
+ var coordLayout;
42579
+ var isPolar = coord.type === 'polar';
42580
+ if (isPolar) {
42581
+ coordLayout = coord.getArea();
42582
+ }
42583
+ else {
42584
+ coordLayout = coord.grid.getRect();
42585
+ }
42586
+
42587
+ if (isPolar) {
42588
+ return {
42589
+ cx: coordLayout.cx,
42590
+ cy: coordLayout.cy,
42591
+ r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0,
42592
+ r: isHorizontalOrRadial ? coordLayout.r : layout.r,
42593
+ startAngle: isHorizontalOrRadial ? layout.startAngle : 0,
42594
+ endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2
42595
+ };
42596
+ }
42597
+ else {
42598
+ return {
42599
+ x: isHorizontalOrRadial ? layout.x : coordLayout.x,
42600
+ y: isHorizontalOrRadial ? coordLayout.y : layout.y,
42601
+ width: isHorizontalOrRadial ? layout.width : coordLayout.width,
42602
+ height: isHorizontalOrRadial ? coordLayout.height : layout.height
42603
+ };
42604
+ }
42605
+ }
42606
+
42607
+ function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
42608
+ var ElementClz = coord.type === 'polar' ? Sector : Rect;
42609
+ return new ElementClz({
42610
+ shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
42611
+ silent: true,
42612
+ z2: 0
42613
+ });
42614
+ }
42615
+
42339
42616
  /*
42340
42617
  * Licensed to the Apache Software Foundation (ASF) under one
42341
42618
  * or more contributor license agreements. See the NOTICE file
@@ -42945,7 +43222,7 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
42945
43222
  toggleItemSelected(
42946
43223
  this,
42947
43224
  data.getItemLayout(idx),
42948
- seriesModel.isSelected(null, idx),
43225
+ seriesModel.isSelected(data.getName(idx)),
42949
43226
  seriesModel.get('selectedOffset'),
42950
43227
  seriesModel.get('animation')
42951
43228
  );
@@ -43697,7 +43974,7 @@ var labelLayout = function (seriesModel, r, viewWidth, viewHeight, viewLeft, vie
43697
43974
  inside: isLabelInside,
43698
43975
  labelDistance: labelDistance,
43699
43976
  labelAlignTo: labelAlignTo,
43700
- labelMargin:labelMargin,
43977
+ labelMargin: labelMargin,
43701
43978
  bleedMargin: bleedMargin,
43702
43979
  textRect: textRect,
43703
43980
  text: text,