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
  };
@@ -25613,6 +25710,14 @@ function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
25613
25710
  task.dirty();
25614
25711
  }
25615
25712
  var performArgs = scheduler.getPerformArgs(task, opt.block);
25713
+ // FIXME
25714
+ // if intending to decalare `performRawSeries` in handlers, only
25715
+ // stream-independent (specifically, data item independent) operations can be
25716
+ // performed. Because is a series is filtered, most of the tasks will not
25717
+ // be performed. A stream-dependent operation probably cause wrong biz logic.
25718
+ // Perhaps we should not provide a separate callback for this case instead
25719
+ // of providing the config `performRawSeries`. The stream-dependent operaions
25720
+ // and stream-independent operations should better not be mixed.
25616
25721
  performArgs.skip = !stageHandler.performRawSeries
25617
25722
  && ecModel.isSeriesFiltered(task.context.model);
25618
25723
  updatePayload(task, payload);
@@ -26987,10 +27092,10 @@ var isFunction = isFunction$1;
26987
27092
  var isObject = isObject$1;
26988
27093
  var parseClassType = ComponentModel.parseClassType;
26989
27094
 
26990
- var version = '4.6.0';
27095
+ var version = '4.7.0';
26991
27096
 
26992
27097
  var dependencies = {
26993
- zrender: '4.2.0'
27098
+ zrender: '4.3.0'
26994
27099
  };
26995
27100
 
26996
27101
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -36178,7 +36283,7 @@ var IntervalScale = Scale.extend({
36178
36283
 
36179
36284
  if (extent[0] < niceTickExtent[0]) {
36180
36285
  if (expandToNicedExtent) {
36181
- ticks.push(roundNumber(niceTickExtent[0] - interval));
36286
+ ticks.push(roundNumber(niceTickExtent[0] - interval, intervalPrecision));
36182
36287
  }
36183
36288
  else {
36184
36289
  ticks.push(extent[0]);
@@ -36204,7 +36309,7 @@ var IntervalScale = Scale.extend({
36204
36309
  var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
36205
36310
  if (extent[1] > lastNiceTick) {
36206
36311
  if (expandToNicedExtent) {
36207
- ticks.push(lastNiceTick + interval);
36312
+ ticks.push(roundNumber(lastNiceTick + interval, intervalPrecision));
36208
36313
  }
36209
36314
  else {
36210
36315
  ticks.push(extent[1]);
@@ -36752,11 +36857,6 @@ function layout(seriesType, ecModel) {
36752
36857
  var value = data.get(valueDim, idx);
36753
36858
  var baseValue = data.get(baseDim, idx);
36754
36859
 
36755
- // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
36756
- if (isNaN(value) || isNaN(baseValue)) {
36757
- continue;
36758
- }
36759
-
36760
36860
  var sign = value >= 0 ? 'p' : 'n';
36761
36861
  var baseCoord = valueAxisStart;
36762
36862
 
@@ -36789,7 +36889,10 @@ function layout(seriesType, ecModel) {
36789
36889
  if (Math.abs(width) < barMinHeight) {
36790
36890
  width = (width < 0 ? -1 : 1) * barMinHeight;
36791
36891
  }
36792
- stacked && (lastStackCoords[stackId][baseValue][sign] += width);
36892
+ // Ignore stack from NaN value
36893
+ if (!isNaN(width)) {
36894
+ stacked && (lastStackCoords[stackId][baseValue][sign] += width);
36895
+ }
36793
36896
  }
36794
36897
  else {
36795
36898
  var coord = cartesian.dataToPoint([baseValue, value]);
@@ -36802,7 +36905,10 @@ function layout(seriesType, ecModel) {
36802
36905
  // Include zero to has a positive bar
36803
36906
  height = (height <= 0 ? -1 : 1) * barMinHeight;
36804
36907
  }
36805
- stacked && (lastStackCoords[stackId][baseValue][sign] += height);
36908
+ // Ignore stack from NaN value
36909
+ if (!isNaN(height)) {
36910
+ stacked && (lastStackCoords[stackId][baseValue][sign] += height);
36911
+ }
36806
36912
  }
36807
36913
 
36808
36914
  data.setItemLayout(idx, {
@@ -36830,6 +36936,7 @@ var largeLayout = {
36830
36936
 
36831
36937
  var data = seriesModel.getData();
36832
36938
  var cartesian = seriesModel.coordinateSystem;
36939
+ var coordLayout = cartesian.grid.getRect();
36833
36940
  var baseAxis = cartesian.getBaseAxis();
36834
36941
  var valueAxis = cartesian.getOtherAxis(baseAxis);
36835
36942
  var valueDim = data.mapDimension(valueAxis.dim);
@@ -36849,6 +36956,7 @@ var largeLayout = {
36849
36956
  function progress(params, data) {
36850
36957
  var count = params.count;
36851
36958
  var largePoints = new LargeArr(count * 2);
36959
+ var largeBackgroundPoints = new LargeArr(count * 2);
36852
36960
  var largeDataIndices = new LargeArr(count);
36853
36961
  var dataIndex;
36854
36962
  var coord = [];
@@ -36862,7 +36970,9 @@ var largeLayout = {
36862
36970
 
36863
36971
  coord = cartesian.dataToPoint(valuePair, null, coord);
36864
36972
  // Data index might not be in order, depends on `progressiveChunkMode`.
36973
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
36865
36974
  largePoints[pointsOffset++] = coord[0];
36975
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
36866
36976
  largePoints[pointsOffset++] = coord[1];
36867
36977
  largeDataIndices[idxOffset++] = dataIndex;
36868
36978
  }
@@ -36870,8 +36980,10 @@ var largeLayout = {
36870
36980
  data.setLayout({
36871
36981
  largePoints: largePoints,
36872
36982
  largeDataIndices: largeDataIndices,
36983
+ largeBackgroundPoints: largeBackgroundPoints,
36873
36984
  barWidth: barWidth,
36874
36985
  valueAxisStart: getValueAxisStart(baseAxis, valueAxis, false),
36986
+ backgroundStart: valueAxisHorizontal ? coordLayout.x : coordLayout.y,
36875
36987
  valueAxisHorizontal: valueAxisHorizontal
36876
36988
  });
36877
36989
  }
@@ -41108,6 +41220,117 @@ function layout$1(gridModel, axisModel, opt) {
41108
41220
  * under the License.
41109
41221
  */
41110
41222
 
41223
+ function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
41224
+ var axis = axisModel.axis;
41225
+
41226
+ if (axis.scale.isBlank()) {
41227
+ return;
41228
+ }
41229
+
41230
+ var splitAreaModel = axisModel.getModel('splitArea');
41231
+ var areaStyleModel = splitAreaModel.getModel('areaStyle');
41232
+ var areaColors = areaStyleModel.get('color');
41233
+
41234
+ var gridRect = gridModel.coordinateSystem.getRect();
41235
+
41236
+ var ticksCoords = axis.getTicksCoords({
41237
+ tickModel: splitAreaModel,
41238
+ clamp: true
41239
+ });
41240
+
41241
+ if (!ticksCoords.length) {
41242
+ return;
41243
+ }
41244
+
41245
+ // For Making appropriate splitArea animation, the color and anid
41246
+ // should be corresponding to previous one if possible.
41247
+ var areaColorsLen = areaColors.length;
41248
+ var lastSplitAreaColors = axisView.__splitAreaColors;
41249
+ var newSplitAreaColors = createHashMap();
41250
+ var colorIndex = 0;
41251
+ if (lastSplitAreaColors) {
41252
+ for (var i = 0; i < ticksCoords.length; i++) {
41253
+ var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
41254
+ if (cIndex != null) {
41255
+ colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
41256
+ break;
41257
+ }
41258
+ }
41259
+ }
41260
+
41261
+ var prev = axis.toGlobalCoord(ticksCoords[0].coord);
41262
+
41263
+ var areaStyle = areaStyleModel.getAreaStyle();
41264
+ areaColors = isArray(areaColors) ? areaColors : [areaColors];
41265
+
41266
+ for (var i = 1; i < ticksCoords.length; i++) {
41267
+ var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
41268
+
41269
+ var x;
41270
+ var y;
41271
+ var width;
41272
+ var height;
41273
+ if (axis.isHorizontal()) {
41274
+ x = prev;
41275
+ y = gridRect.y;
41276
+ width = tickCoord - x;
41277
+ height = gridRect.height;
41278
+ prev = x + width;
41279
+ }
41280
+ else {
41281
+ x = gridRect.x;
41282
+ y = prev;
41283
+ width = gridRect.width;
41284
+ height = tickCoord - y;
41285
+ prev = y + height;
41286
+ }
41287
+
41288
+ var tickValue = ticksCoords[i - 1].tickValue;
41289
+ tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
41290
+
41291
+ axisGroup.add(new Rect({
41292
+ anid: tickValue != null ? 'area_' + tickValue : null,
41293
+ shape: {
41294
+ x: x,
41295
+ y: y,
41296
+ width: width,
41297
+ height: height
41298
+ },
41299
+ style: defaults({
41300
+ fill: areaColors[colorIndex]
41301
+ }, areaStyle),
41302
+ silent: true
41303
+ }));
41304
+
41305
+ colorIndex = (colorIndex + 1) % areaColorsLen;
41306
+ }
41307
+
41308
+ axisView.__splitAreaColors = newSplitAreaColors;
41309
+ }
41310
+
41311
+ function rectCoordAxisHandleRemove(axisView) {
41312
+ axisView.__splitAreaColors = null;
41313
+ }
41314
+
41315
+ /*
41316
+ * Licensed to the Apache Software Foundation (ASF) under one
41317
+ * or more contributor license agreements. See the NOTICE file
41318
+ * distributed with this work for additional information
41319
+ * regarding copyright ownership. The ASF licenses this file
41320
+ * to you under the Apache License, Version 2.0 (the
41321
+ * "License"); you may not use this file except in compliance
41322
+ * with the License. You may obtain a copy of the License at
41323
+ *
41324
+ * http://www.apache.org/licenses/LICENSE-2.0
41325
+ *
41326
+ * Unless required by applicable law or agreed to in writing,
41327
+ * software distributed under the License is distributed on an
41328
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
41329
+ * KIND, either express or implied. See the License for the
41330
+ * specific language governing permissions and limitations
41331
+ * under the License.
41332
+ */
41333
+
41111
41334
  var axisBuilderAttrs = [
41112
41335
  'axisLine', 'axisTickLabel', 'axisName'
41113
41336
  ];
@@ -41159,7 +41382,7 @@ var CartesianAxisView = AxisView.extend({
41159
41382
  },
41160
41383
 
41161
41384
  remove: function () {
41162
- this._splitAreaColors = null;
41385
+ rectCoordAxisHandleRemove(this);
41163
41386
  },
41164
41387
 
41165
41388
  /**
@@ -41291,91 +41514,7 @@ var CartesianAxisView = AxisView.extend({
41291
41514
  * @private
41292
41515
  */
41293
41516
  _splitArea: function (axisModel, gridModel) {
41294
- var axis = axisModel.axis;
41295
-
41296
- if (axis.scale.isBlank()) {
41297
- return;
41298
- }
41299
-
41300
- var splitAreaModel = axisModel.getModel('splitArea');
41301
- var areaStyleModel = splitAreaModel.getModel('areaStyle');
41302
- var areaColors = areaStyleModel.get('color');
41303
-
41304
- var gridRect = gridModel.coordinateSystem.getRect();
41305
-
41306
- var ticksCoords = axis.getTicksCoords({
41307
- tickModel: splitAreaModel,
41308
- clamp: true
41309
- });
41310
-
41311
- if (!ticksCoords.length) {
41312
- return;
41313
- }
41314
-
41315
- // For Making appropriate splitArea animation, the color and anid
41316
- // should be corresponding to previous one if possible.
41317
- var areaColorsLen = areaColors.length;
41318
- var lastSplitAreaColors = this._splitAreaColors;
41319
- var newSplitAreaColors = createHashMap();
41320
- var colorIndex = 0;
41321
- if (lastSplitAreaColors) {
41322
- for (var i = 0; i < ticksCoords.length; i++) {
41323
- var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
41324
- if (cIndex != null) {
41325
- colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
41326
- break;
41327
- }
41328
- }
41329
- }
41330
-
41331
- var prev = axis.toGlobalCoord(ticksCoords[0].coord);
41332
-
41333
- var areaStyle = areaStyleModel.getAreaStyle();
41334
- areaColors = isArray(areaColors) ? areaColors : [areaColors];
41335
-
41336
- for (var i = 1; i < ticksCoords.length; i++) {
41337
- var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
41338
-
41339
- var x;
41340
- var y;
41341
- var width;
41342
- var height;
41343
- if (axis.isHorizontal()) {
41344
- x = prev;
41345
- y = gridRect.y;
41346
- width = tickCoord - x;
41347
- height = gridRect.height;
41348
- prev = x + width;
41349
- }
41350
- else {
41351
- x = gridRect.x;
41352
- y = prev;
41353
- width = gridRect.width;
41354
- height = tickCoord - y;
41355
- prev = y + height;
41356
- }
41357
-
41358
- var tickValue = ticksCoords[i - 1].tickValue;
41359
- tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
41360
-
41361
- this._axisGroup.add(new Rect({
41362
- anid: tickValue != null ? 'area_' + tickValue : null,
41363
- shape: {
41364
- x: x,
41365
- y: y,
41366
- width: width,
41367
- height: height
41368
- },
41369
- style: defaults({
41370
- fill: areaColors[colorIndex]
41371
- }, areaStyle),
41372
- silent: true
41373
- }));
41374
-
41375
- colorIndex = (colorIndex + 1) % areaColorsLen;
41376
- }
41377
-
41378
- this._splitAreaColors = newSplitAreaColors;
41517
+ rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, gridModel);
41379
41518
  }
41380
41519
  });
41381
41520
 
@@ -41621,7 +41760,21 @@ BaseBarSeries.extend({
41621
41760
 
41622
41761
  // If use caps on two sides of bars
41623
41762
  // Only available on tangential polar bar
41624
- roundCap: false
41763
+ roundCap: false,
41764
+
41765
+ showBackground: false,
41766
+ backgroundStyle: {
41767
+ color: 'rgba(180, 180, 180, 0.2)',
41768
+ borderColor: null,
41769
+ borderWidth: 0,
41770
+ borderType: 'solid',
41771
+ borderRadius: 0,
41772
+ shadowBlur: 0,
41773
+ shadowColor: null,
41774
+ shadowOffsetX: 0,
41775
+ shadowOffsetY: 0,
41776
+ opacity: 1
41777
+ }
41625
41778
  }
41626
41779
  });
41627
41780
 
@@ -41926,15 +42079,28 @@ extendChartView({
41926
42079
 
41927
42080
  var roundCap = seriesModel.get('roundCap', true);
41928
42081
 
42082
+ var drawBackground = seriesModel.get('showBackground', true);
42083
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
42084
+
42085
+ var bgEls = [];
42086
+ var oldBgEls = this._backgroundEls || [];
42087
+
41929
42088
  data.diff(oldData)
41930
42089
  .add(function (dataIndex) {
42090
+ var itemModel = data.getItemModel(dataIndex);
42091
+ var layout = getLayout[coord.type](data, dataIndex, itemModel);
42092
+
42093
+ if (drawBackground) {
42094
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
42095
+ bgEl.useStyle(backgroundModel.getBarItemStyle());
42096
+ bgEls[dataIndex] = bgEl;
42097
+ }
42098
+
42099
+ // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
41931
42100
  if (!data.hasValue(dataIndex)) {
41932
42101
  return;
41933
42102
  }
41934
42103
 
41935
- var itemModel = data.getItemModel(dataIndex);
41936
- var layout = getLayout[coord.type](data, dataIndex, itemModel);
41937
-
41938
42104
  if (needsClip) {
41939
42105
  // Clip will modify the layout params.
41940
42106
  // And return a boolean to determine if the shape are fully clipped.
@@ -41957,16 +42123,24 @@ extendChartView({
41957
42123
  );
41958
42124
  })
41959
42125
  .update(function (newIndex, oldIndex) {
41960
- var el = oldData.getItemGraphicEl(oldIndex);
42126
+ var itemModel = data.getItemModel(newIndex);
42127
+ var layout = getLayout[coord.type](data, newIndex, itemModel);
42128
+
42129
+ if (drawBackground) {
42130
+ var bgEl = oldBgEls[oldIndex];
42131
+ bgEl.useStyle(backgroundModel.getBarItemStyle());
42132
+ bgEls[newIndex] = bgEl;
41961
42133
 
42134
+ var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
42135
+ updateProps(bgEl, { shape: shape }, animationModel, newIndex);
42136
+ }
42137
+
42138
+ var el = oldData.getItemGraphicEl(oldIndex);
41962
42139
  if (!data.hasValue(newIndex)) {
41963
42140
  group.remove(el);
41964
42141
  return;
41965
42142
  }
41966
42143
 
41967
- var itemModel = data.getItemModel(newIndex);
41968
- var layout = getLayout[coord.type](data, newIndex, itemModel);
41969
-
41970
42144
  if (needsClip) {
41971
42145
  var isClipped = clip[coord.type](coordSysClipArea, layout);
41972
42146
  if (isClipped) {
@@ -42004,6 +42178,15 @@ extendChartView({
42004
42178
  })
42005
42179
  .execute();
42006
42180
 
42181
+ var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());
42182
+ bgGroup.removeAll();
42183
+
42184
+ for (var i = 0; i < bgEls.length; ++i) {
42185
+ bgGroup.add(bgEls[i]);
42186
+ }
42187
+ group.add(bgGroup);
42188
+ this._backgroundEls = bgEls;
42189
+
42007
42190
  this._data = data;
42008
42191
  },
42009
42192
 
@@ -42024,6 +42207,7 @@ extendChartView({
42024
42207
  },
42025
42208
 
42026
42209
  _incrementalRenderLarge: function (params, seriesModel) {
42210
+ this._removeBackground();
42027
42211
  createLarge(seriesModel, this.group, true);
42028
42212
  },
42029
42213
 
@@ -42037,6 +42221,9 @@ extendChartView({
42037
42221
  var group = this.group;
42038
42222
  var data = this._data;
42039
42223
  if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
42224
+ this._removeBackground();
42225
+ this._backgroundEls = [];
42226
+
42040
42227
  data.eachItemGraphicEl(function (el) {
42041
42228
  if (el.type === 'sector') {
42042
42229
  removeSector(el.dataIndex, ecModel, el);
@@ -42050,6 +42237,11 @@ extendChartView({
42050
42237
  group.removeAll();
42051
42238
  }
42052
42239
  this._data = null;
42240
+ },
42241
+
42242
+ _removeBackground: function () {
42243
+ this.group.remove(this._backgroundGroup);
42244
+ this._backgroundGroup = null;
42053
42245
  }
42054
42246
 
42055
42247
  });
@@ -42107,7 +42299,12 @@ var elementCreator = {
42107
42299
  dataIndex, layout, isHorizontal,
42108
42300
  animationModel, isUpdate
42109
42301
  ) {
42110
- var rect = new Rect({shape: extend({}, layout)});
42302
+ var rect = new Rect({
42303
+ shape: extend({}, layout),
42304
+ z2: 1
42305
+ });
42306
+
42307
+ rect.name = 'item';
42111
42308
 
42112
42309
  // Animation
42113
42310
  if (animationModel) {
@@ -42137,9 +42334,12 @@ var elementCreator = {
42137
42334
  var ShapeClass = (!isRadial && roundCap) ? Sausage : Sector;
42138
42335
 
42139
42336
  var sector = new ShapeClass({
42140
- shape: defaults({clockwise: clockwise}, layout)
42337
+ shape: defaults({clockwise: clockwise}, layout),
42338
+ z2: 1
42141
42339
  });
42142
42340
 
42341
+ sector.name = 'item';
42342
+
42143
42343
  // Animation
42144
42344
  if (animationModel) {
42145
42345
  var sectorShape = sector.shape;
@@ -42259,7 +42459,10 @@ function updateStyle(
42259
42459
  // In case width or height are too small.
42260
42460
  function getLineWidth(itemModel, rawLayout) {
42261
42461
  var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
42262
- return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height));
42462
+ // width or height may be NaN for empty data
42463
+ var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
42464
+ var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
42465
+ return Math.min(lineWidth, width, height);
42263
42466
  }
42264
42467
 
42265
42468
 
@@ -42291,13 +42494,38 @@ function createLarge(seriesModel, group, incremental) {
42291
42494
  var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
42292
42495
  startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart');
42293
42496
 
42497
+ var largeDataIndices = data.getLayout('largeDataIndices');
42498
+ var barWidth = data.getLayout('barWidth');
42499
+
42500
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
42501
+ var drawBackground = seriesModel.get('showBackground', true);
42502
+
42503
+ if (drawBackground) {
42504
+ var points = data.getLayout('largeBackgroundPoints');
42505
+ var backgroundStartPoint = [];
42506
+ backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart');
42507
+
42508
+ var bgEl = new LargePath({
42509
+ shape: {points: points},
42510
+ incremental: !!incremental,
42511
+ __startPoint: backgroundStartPoint,
42512
+ __baseDimIdx: baseDimIdx,
42513
+ __largeDataIndices: largeDataIndices,
42514
+ __barWidth: barWidth,
42515
+ silent: true,
42516
+ z2: 0
42517
+ });
42518
+ setLargeBackgroundStyle(bgEl, backgroundModel, data);
42519
+ group.add(bgEl);
42520
+ }
42521
+
42294
42522
  var el = new LargePath({
42295
42523
  shape: {points: data.getLayout('largePoints')},
42296
42524
  incremental: !!incremental,
42297
42525
  __startPoint: startPoint,
42298
42526
  __baseDimIdx: baseDimIdx,
42299
- __largeDataIndices: data.getLayout('largeDataIndices'),
42300
- __barWidth: data.getLayout('barWidth')
42527
+ __largeDataIndices: largeDataIndices,
42528
+ __barWidth: barWidth
42301
42529
  });
42302
42530
  group.add(el);
42303
42531
  setLargeStyle(el, seriesModel, data);
@@ -42362,6 +42590,55 @@ function setLargeStyle(el, seriesModel, data) {
42362
42590
  el.style.lineWidth = data.getLayout('barWidth');
42363
42591
  }
42364
42592
 
42593
+ function setLargeBackgroundStyle(el, backgroundModel, data) {
42594
+ var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color');
42595
+ var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']);
42596
+
42597
+ el.useStyle(itemStyle);
42598
+ el.style.fill = null;
42599
+ el.style.stroke = borderColor;
42600
+ el.style.lineWidth = data.getLayout('barWidth');
42601
+ }
42602
+
42603
+ function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
42604
+ var coordLayout;
42605
+ var isPolar = coord.type === 'polar';
42606
+ if (isPolar) {
42607
+ coordLayout = coord.getArea();
42608
+ }
42609
+ else {
42610
+ coordLayout = coord.grid.getRect();
42611
+ }
42612
+
42613
+ if (isPolar) {
42614
+ return {
42615
+ cx: coordLayout.cx,
42616
+ cy: coordLayout.cy,
42617
+ r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0,
42618
+ r: isHorizontalOrRadial ? coordLayout.r : layout.r,
42619
+ startAngle: isHorizontalOrRadial ? layout.startAngle : 0,
42620
+ endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2
42621
+ };
42622
+ }
42623
+ else {
42624
+ return {
42625
+ x: isHorizontalOrRadial ? layout.x : coordLayout.x,
42626
+ y: isHorizontalOrRadial ? coordLayout.y : layout.y,
42627
+ width: isHorizontalOrRadial ? layout.width : coordLayout.width,
42628
+ height: isHorizontalOrRadial ? coordLayout.height : layout.height
42629
+ };
42630
+ }
42631
+ }
42632
+
42633
+ function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
42634
+ var ElementClz = coord.type === 'polar' ? Sector : Rect;
42635
+ return new ElementClz({
42636
+ shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
42637
+ silent: true,
42638
+ z2: 0
42639
+ });
42640
+ }
42641
+
42365
42642
  /*
42366
42643
  * Licensed to the Apache Software Foundation (ASF) under one
42367
42644
  * or more contributor license agreements. See the NOTICE file
@@ -42971,7 +43248,7 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
42971
43248
  toggleItemSelected(
42972
43249
  this,
42973
43250
  data.getItemLayout(idx),
42974
- seriesModel.isSelected(null, idx),
43251
+ seriesModel.isSelected(data.getName(idx)),
42975
43252
  seriesModel.get('selectedOffset'),
42976
43253
  seriesModel.get('animation')
42977
43254
  );
@@ -43723,7 +44000,7 @@ var labelLayout = function (seriesModel, r, viewWidth, viewHeight, viewLeft, vie
43723
44000
  inside: isLabelInside,
43724
44001
  labelDistance: labelDistance,
43725
44002
  labelAlignTo: labelAlignTo,
43726
- labelMargin:labelMargin,
44003
+ labelMargin: labelMargin,
43727
44004
  bleedMargin: bleedMargin,
43728
44005
  textRect: textRect,
43729
44006
  text: text,