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.
- package/.github/pull_request_template.md +66 -0
- package/.github/workflows/nodejs.yml +12 -2
- package/CONTRIBUTING.md +16 -160
- package/NOTICE +1 -1
- package/README.md +2 -2
- package/dist/echarts-en.common.js +684 -300
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +1070 -407
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +499 -222
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +684 -300
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +1070 -407
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +499 -222
- package/dist/echarts.simple.min.js +1 -1
- package/lib/chart/bar/BarSeries.js +14 -1
- package/lib/chart/bar/BarView.js +134 -14
- package/lib/chart/candlestick/candlestickVisual.js +1 -1
- package/lib/chart/funnel/FunnelSeries.js +1 -3
- package/lib/chart/graph/GraphSeries.js +2 -1
- package/lib/chart/graph/GraphView.js +2 -4
- package/lib/chart/helper/EffectLine.js +23 -1
- package/lib/chart/helper/Line.js +94 -33
- package/lib/chart/helper/createRenderPlanner.js +6 -3
- package/lib/chart/pie/PieView.js +1 -1
- package/lib/chart/radar/RadarSeries.js +20 -0
- package/lib/chart/sankey/SankeySeries.js +13 -1
- package/lib/chart/sankey/SankeyView.js +42 -23
- package/lib/chart/sankey/sankeyLayout.js +4 -3
- package/lib/chart/tree/TreeSeries.js +3 -0
- package/lib/chart/tree/TreeView.js +151 -25
- package/lib/chart/treemap/TreemapView.js +57 -27
- package/lib/component/axis/AxisBuilder.js +0 -1
- package/lib/component/axis/CartesianAxisView.js +7 -84
- package/lib/component/axis/SingleAxisView.js +21 -6
- package/lib/component/axis/axisSplitHelper.js +132 -0
- package/lib/component/brush/BrushView.js +11 -1
- package/lib/component/brush/visualEncoding.js +13 -2
- package/lib/component/helper/MapDraw.js +6 -8
- package/lib/component/legend/ScrollableLegendView.js +18 -18
- package/lib/component/marker/MarkLineModel.js +2 -1
- package/lib/component/marker/markerHelper.js +7 -4
- package/lib/component/tooltip/TooltipContent.js +60 -23
- package/lib/component/tooltip/TooltipView.js +6 -7
- package/lib/coord/View.js +9 -0
- package/lib/coord/radar/Radar.js +4 -4
- package/lib/echarts.js +2 -2
- package/lib/layout/barGrid.js +17 -10
- package/lib/layout/barPolar.js +0 -5
- package/lib/scale/Interval.js +2 -2
- package/lib/stream/Scheduler.js +9 -1
- package/lib/util/graphic.js +2 -2
- package/map/js/china.js +1 -1
- package/map/js/province/chongqing.js +1 -1
- package/map/js/province/tianjin.js +1 -28
- package/map/json/china.json +1 -1
- package/map/json/province/chongqing.json +1 -1
- package/package.json +10 -6
- package/src/chart/bar/BarSeries.js +15 -1
- package/src/chart/bar/BarView.js +136 -12
- package/src/chart/candlestick/candlestickVisual.js +1 -1
- package/src/chart/funnel/FunnelSeries.js +1 -2
- package/src/chart/graph/GraphSeries.js +2 -1
- package/src/chart/graph/GraphView.js +2 -2
- package/src/chart/helper/EffectLine.js +23 -1
- package/src/chart/helper/Line.js +84 -26
- package/src/chart/helper/createRenderPlanner.js +5 -2
- package/src/chart/pie/PieView.js +1 -1
- package/src/chart/pie/labelLayout.js +1 -1
- package/src/chart/radar/RadarSeries.js +22 -0
- package/src/chart/sankey/SankeySeries.js +12 -1
- package/src/chart/sankey/SankeyView.js +49 -21
- package/src/chart/sankey/sankeyLayout.js +4 -3
- package/src/chart/tree/TreeSeries.js +5 -0
- package/src/chart/tree/TreeView.js +155 -22
- package/src/chart/treemap/TreemapView.js +57 -27
- package/src/component/axis/AxisBuilder.js +1 -1
- package/src/component/axis/CartesianAxisView.js +3 -86
- package/src/component/axis/SingleAxisView.js +21 -4
- package/src/component/axis/axisSplitHelper.js +114 -0
- package/src/component/brush/BrushView.js +8 -1
- package/src/component/brush/visualEncoding.js +6 -3
- package/src/component/helper/MapDraw.js +6 -6
- package/src/component/legend/ScrollableLegendView.js +18 -16
- package/src/component/marker/MarkLineModel.js +2 -1
- package/src/component/marker/markerHelper.js +8 -5
- package/src/component/tooltip/TooltipContent.js +59 -22
- package/src/component/tooltip/TooltipView.js +9 -7
- package/src/coord/View.js +10 -1
- package/src/coord/radar/Radar.js +5 -7
- package/src/echarts.js +2 -2
- package/src/layout/barGrid.js +14 -7
- package/src/layout/barPolar.js +0 -4
- package/src/scale/Interval.js +2 -2
- package/src/stream/Scheduler.js +8 -0
- package/src/util/graphic.js +2 -2
|
@@ -1285,7 +1285,11 @@ Draggable.prototype = {
|
|
|
1285
1285
|
|
|
1286
1286
|
_dragStart: function (e) {
|
|
1287
1287
|
var draggingTarget = e.target;
|
|
1288
|
-
if
|
|
1288
|
+
// Find if there is draggable in the ancestor
|
|
1289
|
+
while (draggingTarget && !draggingTarget.draggable) {
|
|
1290
|
+
draggingTarget = draggingTarget.parent;
|
|
1291
|
+
}
|
|
1292
|
+
if (draggingTarget) {
|
|
1289
1293
|
this._draggingTarget = draggingTarget;
|
|
1290
1294
|
draggingTarget.dragging = true;
|
|
1291
1295
|
this._x = e.offsetX;
|
|
@@ -1714,6 +1718,8 @@ function buildTransformer(src, dest) {
|
|
|
1714
1718
|
var detCache = {};
|
|
1715
1719
|
var det = determinant(mA, 8, 0, 0, 0, detCache);
|
|
1716
1720
|
if (det === 0) {
|
|
1721
|
+
// can not make transformer when and only when
|
|
1722
|
+
// any three of the markers are collinear.
|
|
1717
1723
|
return;
|
|
1718
1724
|
}
|
|
1719
1725
|
|
|
@@ -1736,6 +1742,153 @@ function buildTransformer(src, dest) {
|
|
|
1736
1742
|
};
|
|
1737
1743
|
}
|
|
1738
1744
|
|
|
1745
|
+
var EVENT_SAVED_PROP = '___zrEVENTSAVED';
|
|
1746
|
+
var _calcOut$1 = [];
|
|
1747
|
+
|
|
1748
|
+
/**
|
|
1749
|
+
* Transform "local coord" from `elFrom` to `elTarget`.
|
|
1750
|
+
* "local coord": the coord based on the input `el`. The origin point is at
|
|
1751
|
+
* the position of "left: 0; top: 0;" in the `el`.
|
|
1752
|
+
*
|
|
1753
|
+
* Support when CSS transform is used.
|
|
1754
|
+
*
|
|
1755
|
+
* Having the `out` (that is, `[outX, outY]`), we can create an DOM element
|
|
1756
|
+
* and set the CSS style as "left: outX; top: outY;" and append it to `elTarge`
|
|
1757
|
+
* to locate the element.
|
|
1758
|
+
*
|
|
1759
|
+
* For example, this code below positions a child of `document.body` on the event
|
|
1760
|
+
* point, no matter whether `body` has `margin`/`paddin`/`transfrom`/... :
|
|
1761
|
+
* ```js
|
|
1762
|
+
* transformLocalCoord(out, container, document.body, event.offsetX, event.offsetY);
|
|
1763
|
+
* if (!eqNaN(out[0])) {
|
|
1764
|
+
* // Then locate the tip element on the event point.
|
|
1765
|
+
* var tipEl = document.createElement('div');
|
|
1766
|
+
* tipEl.style.cssText = 'position: absolute; left:' + out[0] + ';top:' + out[1] + ';';
|
|
1767
|
+
* document.body.appendChild(tipEl);
|
|
1768
|
+
* }
|
|
1769
|
+
* ```
|
|
1770
|
+
*
|
|
1771
|
+
* Notice: In some env this method is not supported. If called, `out` will be `[NaN, NaN]`.
|
|
1772
|
+
*
|
|
1773
|
+
* @param {Array.<number>} out [inX: number, inY: number] The output..
|
|
1774
|
+
* If can not transform, `out` will not be modified but return `false`.
|
|
1775
|
+
* @param {HTMLElement} elFrom The `[inX, inY]` is based on elFrom.
|
|
1776
|
+
* @param {HTMLElement} elTarget The `out` is based on elTarget.
|
|
1777
|
+
* @param {number} inX
|
|
1778
|
+
* @param {number} inY
|
|
1779
|
+
* @return {boolean} Whether transform successfully.
|
|
1780
|
+
*/
|
|
1781
|
+
function transformLocalCoord(out, elFrom, elTarget, inX, inY) {
|
|
1782
|
+
return transformCoordWithViewport(_calcOut$1, elFrom, inX, inY, true)
|
|
1783
|
+
&& transformCoordWithViewport(out, elTarget, _calcOut$1[0], _calcOut$1[1]);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* Transform between a "viewport coord" and a "local coord".
|
|
1788
|
+
* "viewport coord": the coord based on the left-top corner of the viewport
|
|
1789
|
+
* of the browser.
|
|
1790
|
+
* "local coord": the coord based on the input `el`. The origin point is at
|
|
1791
|
+
* the position of "left: 0; top: 0;" in the `el`.
|
|
1792
|
+
*
|
|
1793
|
+
* Support the case when CSS transform is used on el.
|
|
1794
|
+
*
|
|
1795
|
+
* @param {Array.<number>} out [inX: number, inY: number] The output. If `inverse: false`,
|
|
1796
|
+
* it represents "local coord", otherwise "vireport coord".
|
|
1797
|
+
* If can not transform, `out` will not be modified but return `false`.
|
|
1798
|
+
* @param {HTMLElement} el The "local coord" is based on the `el`, see comment above.
|
|
1799
|
+
* @param {number} inX If `inverse: false`,
|
|
1800
|
+
* it represents "vireport coord", otherwise "local coord".
|
|
1801
|
+
* @param {number} inY If `inverse: false`,
|
|
1802
|
+
* it represents "vireport coord", otherwise "local coord".
|
|
1803
|
+
* @param {boolean} [inverse=false]
|
|
1804
|
+
* `true`: from "viewport coord" to "local coord".
|
|
1805
|
+
* `false`: from "local coord" to "viewport coord".
|
|
1806
|
+
* @return {boolean} Whether transform successfully.
|
|
1807
|
+
*/
|
|
1808
|
+
function transformCoordWithViewport(out, el, inX, inY, inverse) {
|
|
1809
|
+
if (el.getBoundingClientRect && env$1.domSupported && !isCanvasEl(el)) {
|
|
1810
|
+
var saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
|
|
1811
|
+
var markers = prepareCoordMarkers(el, saved);
|
|
1812
|
+
var transformer = preparePointerTransformer(markers, saved, inverse);
|
|
1813
|
+
if (transformer) {
|
|
1814
|
+
transformer(out, inX, inY);
|
|
1815
|
+
return true;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
return false;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
function prepareCoordMarkers(el, saved) {
|
|
1822
|
+
var markers = saved.markers;
|
|
1823
|
+
if (markers) {
|
|
1824
|
+
return markers;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
markers = saved.markers = [];
|
|
1828
|
+
var propLR = ['left', 'right'];
|
|
1829
|
+
var propTB = ['top', 'bottom'];
|
|
1830
|
+
|
|
1831
|
+
for (var i = 0; i < 4; i++) {
|
|
1832
|
+
var marker = document.createElement('div');
|
|
1833
|
+
var stl = marker.style;
|
|
1834
|
+
var idxLR = i % 2;
|
|
1835
|
+
var idxTB = (i >> 1) % 2;
|
|
1836
|
+
stl.cssText = [
|
|
1837
|
+
'position: absolute',
|
|
1838
|
+
'visibility: hidden',
|
|
1839
|
+
'padding: 0',
|
|
1840
|
+
'margin: 0',
|
|
1841
|
+
'border-width: 0',
|
|
1842
|
+
'user-select: none',
|
|
1843
|
+
'width:0',
|
|
1844
|
+
'height:0',
|
|
1845
|
+
// 'width: 5px',
|
|
1846
|
+
// 'height: 5px',
|
|
1847
|
+
propLR[idxLR] + ':0',
|
|
1848
|
+
propTB[idxTB] + ':0',
|
|
1849
|
+
propLR[1 - idxLR] + ':auto',
|
|
1850
|
+
propTB[1 - idxTB] + ':auto',
|
|
1851
|
+
''
|
|
1852
|
+
].join('!important;');
|
|
1853
|
+
el.appendChild(marker);
|
|
1854
|
+
markers.push(marker);
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
return markers;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
function preparePointerTransformer(markers, saved, inverse) {
|
|
1861
|
+
var transformerName = inverse ? 'invTrans' : 'trans';
|
|
1862
|
+
var transformer = saved[transformerName];
|
|
1863
|
+
var oldSrcCoords = saved.srcCoords;
|
|
1864
|
+
var oldCoordTheSame = true;
|
|
1865
|
+
var srcCoords = [];
|
|
1866
|
+
var destCoords = [];
|
|
1867
|
+
|
|
1868
|
+
for (var i = 0; i < 4; i++) {
|
|
1869
|
+
var rect = markers[i].getBoundingClientRect();
|
|
1870
|
+
var ii = 2 * i;
|
|
1871
|
+
var x = rect.left;
|
|
1872
|
+
var y = rect.top;
|
|
1873
|
+
srcCoords.push(x, y);
|
|
1874
|
+
oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
|
|
1875
|
+
destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
|
|
1876
|
+
}
|
|
1877
|
+
// Cache to avoid time consuming of `buildTransformer`.
|
|
1878
|
+
return (oldCoordTheSame && transformer)
|
|
1879
|
+
? transformer
|
|
1880
|
+
: (
|
|
1881
|
+
saved.srcCoords = srcCoords,
|
|
1882
|
+
saved[transformerName] = inverse
|
|
1883
|
+
? buildTransformer(destCoords, srcCoords)
|
|
1884
|
+
: buildTransformer(srcCoords, destCoords)
|
|
1885
|
+
);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
function isCanvasEl(el) {
|
|
1889
|
+
return el.nodeName.toUpperCase() === 'CANVAS';
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1739
1892
|
/**
|
|
1740
1893
|
* Utilities for mouse or touch events.
|
|
1741
1894
|
*/
|
|
@@ -1743,7 +1896,6 @@ function buildTransformer(src, dest) {
|
|
|
1743
1896
|
var isDomLevel2 = (typeof window !== 'undefined') && !!window.addEventListener;
|
|
1744
1897
|
|
|
1745
1898
|
var MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;
|
|
1746
|
-
var EVENT_SAVED_PROP = '___zrEVENTSAVED';
|
|
1747
1899
|
var _calcOut = [];
|
|
1748
1900
|
|
|
1749
1901
|
/**
|
|
@@ -1808,11 +1960,11 @@ function clientToLocal(el, e, out, calculate) {
|
|
|
1808
1960
|
|
|
1809
1961
|
function calculateZrXY(el, e, out) {
|
|
1810
1962
|
// BlackBerry 5, iOS 3 (original iPhone) don't have getBoundingRect.
|
|
1811
|
-
if (
|
|
1963
|
+
if (env$1.domSupported && el.getBoundingClientRect) {
|
|
1812
1964
|
var ex = e.clientX;
|
|
1813
1965
|
var ey = e.clientY;
|
|
1814
1966
|
|
|
1815
|
-
if (el
|
|
1967
|
+
if (isCanvasEl(el)) {
|
|
1816
1968
|
// Original approach, which do not support CSS transform.
|
|
1817
1969
|
// marker can not be locationed in a canvas container
|
|
1818
1970
|
// (getBoundingClientRect is always 0). We do not support
|
|
@@ -1824,10 +1976,7 @@ function calculateZrXY(el, e, out) {
|
|
|
1824
1976
|
return;
|
|
1825
1977
|
}
|
|
1826
1978
|
else {
|
|
1827
|
-
|
|
1828
|
-
var transformer = preparePointerTransformer(prepareCoordMarkers(el, saved), saved);
|
|
1829
|
-
if (transformer) {
|
|
1830
|
-
transformer(_calcOut, ex, ey);
|
|
1979
|
+
if (transformCoordWithViewport(_calcOut, el, ex, ey)) {
|
|
1831
1980
|
out.zrX = _calcOut[0];
|
|
1832
1981
|
out.zrY = _calcOut[1];
|
|
1833
1982
|
return;
|
|
@@ -1837,70 +1986,6 @@ function calculateZrXY(el, e, out) {
|
|
|
1837
1986
|
out.zrX = out.zrY = 0;
|
|
1838
1987
|
}
|
|
1839
1988
|
|
|
1840
|
-
function prepareCoordMarkers(el, saved) {
|
|
1841
|
-
var markers = saved.markers;
|
|
1842
|
-
if (markers) {
|
|
1843
|
-
return markers;
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
markers = saved.markers = [];
|
|
1847
|
-
var propLR = ['left', 'right'];
|
|
1848
|
-
var propTB = ['top', 'bottom'];
|
|
1849
|
-
|
|
1850
|
-
for (var i = 0; i < 4; i++) {
|
|
1851
|
-
var marker = document.createElement('div');
|
|
1852
|
-
var stl = marker.style;
|
|
1853
|
-
var idxLR = i % 2;
|
|
1854
|
-
var idxTB = (i >> 1) % 2;
|
|
1855
|
-
stl.cssText = [
|
|
1856
|
-
'position:absolute',
|
|
1857
|
-
'visibility: hidden',
|
|
1858
|
-
'padding: 0',
|
|
1859
|
-
'margin: 0',
|
|
1860
|
-
'border-width: 0',
|
|
1861
|
-
'width:0',
|
|
1862
|
-
'height:0',
|
|
1863
|
-
// 'width: 5px',
|
|
1864
|
-
// 'height: 5px',
|
|
1865
|
-
propLR[idxLR] + ':0',
|
|
1866
|
-
propTB[idxTB] + ':0',
|
|
1867
|
-
propLR[1 - idxLR] + ':auto',
|
|
1868
|
-
propTB[1 - idxTB] + ':auto',
|
|
1869
|
-
''
|
|
1870
|
-
].join('!important;');
|
|
1871
|
-
el.appendChild(marker);
|
|
1872
|
-
markers.push(marker);
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
return markers;
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
function preparePointerTransformer(markers, saved) {
|
|
1879
|
-
var transformer = saved.transformer;
|
|
1880
|
-
var oldSrcCoords = saved.srcCoords;
|
|
1881
|
-
var useOld = true;
|
|
1882
|
-
var srcCoords = [];
|
|
1883
|
-
var destCoords = [];
|
|
1884
|
-
|
|
1885
|
-
for (var i = 0; i < 4; i++) {
|
|
1886
|
-
var rect = markers[i].getBoundingClientRect();
|
|
1887
|
-
var ii = 2 * i;
|
|
1888
|
-
var x = rect.left;
|
|
1889
|
-
var y = rect.top;
|
|
1890
|
-
srcCoords.push(x, y);
|
|
1891
|
-
useOld &= oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
|
|
1892
|
-
destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
// Cache to avoid time consuming of `buildTransformer`.
|
|
1896
|
-
return useOld
|
|
1897
|
-
? transformer
|
|
1898
|
-
: (
|
|
1899
|
-
saved.srcCoords = srcCoords,
|
|
1900
|
-
saved.transformer = buildTransformer(srcCoords, destCoords)
|
|
1901
|
-
);
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
1989
|
/**
|
|
1905
1990
|
* Find native event compat for legency IE.
|
|
1906
1991
|
* Should be called at the begining of a native event listener.
|
|
@@ -4770,7 +4855,7 @@ var Animator = function (target, loop, getter, setter) {
|
|
|
4770
4855
|
|
|
4771
4856
|
Animator.prototype = {
|
|
4772
4857
|
/**
|
|
4773
|
-
*
|
|
4858
|
+
* Set Animation keyframe
|
|
4774
4859
|
* @param {number} time 关键帧时间,单位是ms
|
|
4775
4860
|
* @param {Object} props 关键帧的属性值,key-value表示
|
|
4776
4861
|
* @return {module:zrender/animation/Animator}
|
|
@@ -4849,7 +4934,7 @@ Animator.prototype = {
|
|
|
4849
4934
|
}
|
|
4850
4935
|
},
|
|
4851
4936
|
/**
|
|
4852
|
-
*
|
|
4937
|
+
* Start the animation
|
|
4853
4938
|
* @param {string|Function} [easing]
|
|
4854
4939
|
* 动画缓动函数,详见{@link module:zrender/animation/easing}
|
|
4855
4940
|
* @param {boolean} forceAnimate
|
|
@@ -4910,7 +4995,7 @@ Animator.prototype = {
|
|
|
4910
4995
|
return this;
|
|
4911
4996
|
},
|
|
4912
4997
|
/**
|
|
4913
|
-
*
|
|
4998
|
+
* Stop animation
|
|
4914
4999
|
* @param {boolean} forwardToLast If move to last frame before stop
|
|
4915
5000
|
*/
|
|
4916
5001
|
stop: function (forwardToLast) {
|
|
@@ -4927,7 +5012,7 @@ Animator.prototype = {
|
|
|
4927
5012
|
clipList.length = 0;
|
|
4928
5013
|
},
|
|
4929
5014
|
/**
|
|
4930
|
-
*
|
|
5015
|
+
* Set when animation delay starts
|
|
4931
5016
|
* @param {number} time 单位ms
|
|
4932
5017
|
* @return {module:zrender/animation/Animator}
|
|
4933
5018
|
*/
|
|
@@ -4936,7 +5021,7 @@ Animator.prototype = {
|
|
|
4936
5021
|
return this;
|
|
4937
5022
|
},
|
|
4938
5023
|
/**
|
|
4939
|
-
*
|
|
5024
|
+
* Add callback for animation end
|
|
4940
5025
|
* @param {Function} cb
|
|
4941
5026
|
* @return {module:zrender/animation/Animator}
|
|
4942
5027
|
*/
|
|
@@ -4988,7 +5073,7 @@ if (debugMode === 1) {
|
|
|
4988
5073
|
var logError$1 = logError;
|
|
4989
5074
|
|
|
4990
5075
|
/**
|
|
4991
|
-
* @alias
|
|
5076
|
+
* @alias module:zrender/mixin/Animatable
|
|
4992
5077
|
* @constructor
|
|
4993
5078
|
*/
|
|
4994
5079
|
var Animatable = function () {
|
|
@@ -10666,7 +10751,7 @@ Painter.prototype = {
|
|
|
10666
10751
|
};
|
|
10667
10752
|
|
|
10668
10753
|
/**
|
|
10669
|
-
*
|
|
10754
|
+
* Animation main class, dispatch and manage all animation controllers
|
|
10670
10755
|
*
|
|
10671
10756
|
* @module zrender/animation/Animation
|
|
10672
10757
|
* @author pissang(https://github.com/pissang)
|
|
@@ -10731,14 +10816,14 @@ Animation.prototype = {
|
|
|
10731
10816
|
|
|
10732
10817
|
constructor: Animation,
|
|
10733
10818
|
/**
|
|
10734
|
-
*
|
|
10819
|
+
* Add clip
|
|
10735
10820
|
* @param {module:zrender/animation/Clip} clip
|
|
10736
10821
|
*/
|
|
10737
10822
|
addClip: function (clip) {
|
|
10738
10823
|
this._clips.push(clip);
|
|
10739
10824
|
},
|
|
10740
10825
|
/**
|
|
10741
|
-
*
|
|
10826
|
+
* Add animator
|
|
10742
10827
|
* @param {module:zrender/animation/Animator} animator
|
|
10743
10828
|
*/
|
|
10744
10829
|
addAnimator: function (animator) {
|
|
@@ -10749,7 +10834,7 @@ Animation.prototype = {
|
|
|
10749
10834
|
}
|
|
10750
10835
|
},
|
|
10751
10836
|
/**
|
|
10752
|
-
*
|
|
10837
|
+
* Delete animation clip
|
|
10753
10838
|
* @param {module:zrender/animation/Clip} clip
|
|
10754
10839
|
*/
|
|
10755
10840
|
removeClip: function (clip) {
|
|
@@ -10760,7 +10845,7 @@ Animation.prototype = {
|
|
|
10760
10845
|
},
|
|
10761
10846
|
|
|
10762
10847
|
/**
|
|
10763
|
-
*
|
|
10848
|
+
* Delete animation clip
|
|
10764
10849
|
* @param {module:zrender/animation/Animator} animator
|
|
10765
10850
|
*/
|
|
10766
10851
|
removeAnimator: function (animator) {
|
|
@@ -11027,13 +11112,16 @@ function normalizeGlobalEvent(instance, event) {
|
|
|
11027
11112
|
* Detect whether the given el is in `painterRoot`.
|
|
11028
11113
|
*/
|
|
11029
11114
|
function isLocalEl(instance, el) {
|
|
11115
|
+
var elTmp = el;
|
|
11030
11116
|
var isLocal = false;
|
|
11031
|
-
|
|
11032
|
-
|
|
11117
|
+
while (elTmp && elTmp.nodeType !== 9
|
|
11118
|
+
&& !(
|
|
11119
|
+
isLocal = elTmp.domBelongToZr
|
|
11120
|
+
|| (elTmp !== el && elTmp === instance.painterRoot)
|
|
11121
|
+
)
|
|
11122
|
+
) {
|
|
11123
|
+
elTmp = elTmp.parentNode;
|
|
11033
11124
|
}
|
|
11034
|
-
while (el && el.nodeType !== 9 && !(
|
|
11035
|
-
isLocal = el === instance.painterRoot
|
|
11036
|
-
));
|
|
11037
11125
|
return isLocal;
|
|
11038
11126
|
}
|
|
11039
11127
|
|
|
@@ -11488,7 +11576,7 @@ var instances$1 = {}; // ZRender实例map索引
|
|
|
11488
11576
|
/**
|
|
11489
11577
|
* @type {string}
|
|
11490
11578
|
*/
|
|
11491
|
-
var version$1 = '4.
|
|
11579
|
+
var version$1 = '4.3.0';
|
|
11492
11580
|
|
|
11493
11581
|
/**
|
|
11494
11582
|
* Initializing a zrender instance
|
|
@@ -16377,12 +16465,10 @@ var round = Math.round;
|
|
|
16377
16465
|
* @param {number} [inputShape.x2]
|
|
16378
16466
|
* @param {number} [inputShape.y2]
|
|
16379
16467
|
* @param {Object} [style]
|
|
16380
|
-
* @param {number} [style.lineWidth]
|
|
16468
|
+
* @param {number} [style.lineWidth] If `null`/`undefined`/`0`, do not optimize.
|
|
16381
16469
|
*/
|
|
16382
16470
|
function subPixelOptimizeLine$1(outputShape, inputShape, style) {
|
|
16383
|
-
|
|
16384
|
-
|
|
16385
|
-
if (!inputShape || !lineWidth) {
|
|
16471
|
+
if (!inputShape) {
|
|
16386
16472
|
return;
|
|
16387
16473
|
}
|
|
16388
16474
|
|
|
@@ -16391,20 +16477,22 @@ function subPixelOptimizeLine$1(outputShape, inputShape, style) {
|
|
|
16391
16477
|
var y1 = inputShape.y1;
|
|
16392
16478
|
var y2 = inputShape.y2;
|
|
16393
16479
|
|
|
16480
|
+
outputShape.x1 = x1;
|
|
16481
|
+
outputShape.x2 = x2;
|
|
16482
|
+
outputShape.y1 = y1;
|
|
16483
|
+
outputShape.y2 = y2;
|
|
16484
|
+
|
|
16485
|
+
var lineWidth = style && style.lineWidth;
|
|
16486
|
+
if (!lineWidth) {
|
|
16487
|
+
return;
|
|
16488
|
+
}
|
|
16489
|
+
|
|
16394
16490
|
if (round(x1 * 2) === round(x2 * 2)) {
|
|
16395
16491
|
outputShape.x1 = outputShape.x2 = subPixelOptimize$1(x1, lineWidth, true);
|
|
16396
16492
|
}
|
|
16397
|
-
else {
|
|
16398
|
-
outputShape.x1 = x1;
|
|
16399
|
-
outputShape.x2 = x2;
|
|
16400
|
-
}
|
|
16401
16493
|
if (round(y1 * 2) === round(y2 * 2)) {
|
|
16402
16494
|
outputShape.y1 = outputShape.y2 = subPixelOptimize$1(y1, lineWidth, true);
|
|
16403
16495
|
}
|
|
16404
|
-
else {
|
|
16405
|
-
outputShape.y1 = y1;
|
|
16406
|
-
outputShape.y2 = y2;
|
|
16407
|
-
}
|
|
16408
16496
|
}
|
|
16409
16497
|
|
|
16410
16498
|
/**
|
|
@@ -16420,12 +16508,10 @@ function subPixelOptimizeLine$1(outputShape, inputShape, style) {
|
|
|
16420
16508
|
* @param {number} [inputShape.width]
|
|
16421
16509
|
* @param {number} [inputShape.height]
|
|
16422
16510
|
* @param {Object} [style]
|
|
16423
|
-
* @param {number} [style.lineWidth]
|
|
16511
|
+
* @param {number} [style.lineWidth] If `null`/`undefined`/`0`, do not optimize.
|
|
16424
16512
|
*/
|
|
16425
16513
|
function subPixelOptimizeRect$1(outputShape, inputShape, style) {
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
if (!inputShape || !lineWidth) {
|
|
16514
|
+
if (!inputShape) {
|
|
16429
16515
|
return;
|
|
16430
16516
|
}
|
|
16431
16517
|
|
|
@@ -16434,6 +16520,16 @@ function subPixelOptimizeRect$1(outputShape, inputShape, style) {
|
|
|
16434
16520
|
var originWidth = inputShape.width;
|
|
16435
16521
|
var originHeight = inputShape.height;
|
|
16436
16522
|
|
|
16523
|
+
outputShape.x = originX;
|
|
16524
|
+
outputShape.y = originY;
|
|
16525
|
+
outputShape.width = originWidth;
|
|
16526
|
+
outputShape.height = originHeight;
|
|
16527
|
+
|
|
16528
|
+
var lineWidth = style && style.lineWidth;
|
|
16529
|
+
if (!lineWidth) {
|
|
16530
|
+
return;
|
|
16531
|
+
}
|
|
16532
|
+
|
|
16437
16533
|
outputShape.x = subPixelOptimize$1(originX, lineWidth, true);
|
|
16438
16534
|
outputShape.y = subPixelOptimize$1(originY, lineWidth, true);
|
|
16439
16535
|
outputShape.width = Math.max(
|
|
@@ -16450,11 +16546,14 @@ function subPixelOptimizeRect$1(outputShape, inputShape, style) {
|
|
|
16450
16546
|
* Sub pixel optimize for canvas
|
|
16451
16547
|
*
|
|
16452
16548
|
* @param {number} position Coordinate, such as x, y
|
|
16453
|
-
* @param {number} lineWidth
|
|
16549
|
+
* @param {number} lineWidth If `null`/`undefined`/`0`, do not optimize.
|
|
16454
16550
|
* @param {boolean=} positiveOrNegative Default false (negative).
|
|
16455
16551
|
* @return {number} Optimized position.
|
|
16456
16552
|
*/
|
|
16457
16553
|
function subPixelOptimize$1(position, lineWidth, positiveOrNegative) {
|
|
16554
|
+
if (!lineWidth) {
|
|
16555
|
+
return position;
|
|
16556
|
+
}
|
|
16458
16557
|
// Assure that (position + lineWidth / 2) is near integer edge,
|
|
16459
16558
|
// otherwise line will be fuzzy in canvas.
|
|
16460
16559
|
var doubledPosition = round(position * 2);
|
|
@@ -18155,7 +18254,7 @@ function animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, cb)
|
|
|
18155
18254
|
* configuration in series.
|
|
18156
18255
|
*
|
|
18157
18256
|
* Caution: this method will stop previous animation.
|
|
18158
|
-
* So
|
|
18257
|
+
* So do not use this method to one element twice before
|
|
18159
18258
|
* animation starts, unless you know what you are doing.
|
|
18160
18259
|
*
|
|
18161
18260
|
* @param {module:zrender/Element} el
|
|
@@ -18181,7 +18280,7 @@ function updateProps(el, props, animatableModel, dataIndex, cb) {
|
|
|
18181
18280
|
* configuration in series.
|
|
18182
18281
|
*
|
|
18183
18282
|
* Caution: this method will stop previous animation.
|
|
18184
|
-
* So
|
|
18283
|
+
* So do not use this method to one element twice before
|
|
18185
18284
|
* animation starts, unless you know what you are doing.
|
|
18186
18285
|
*
|
|
18187
18286
|
* @param {module:zrender/Element} el
|
|
@@ -25019,8 +25118,11 @@ var createRenderPlanner = function () {
|
|
|
25019
25118
|
var originalLarge = fields.large;
|
|
25020
25119
|
var originalProgressive = fields.progressiveRender;
|
|
25021
25120
|
|
|
25022
|
-
|
|
25023
|
-
|
|
25121
|
+
// FIXME: if the planner works on a filtered series, `pipelineContext` does not
|
|
25122
|
+
// exists. See #11611 . Probably we need to modify this structure, see the comment
|
|
25123
|
+
// on `performRawSeries` in `Schedular.js`.
|
|
25124
|
+
var large = fields.large = pipelineContext && pipelineContext.large;
|
|
25125
|
+
var progressive = fields.progressiveRender = pipelineContext && pipelineContext.progressiveRender;
|
|
25024
25126
|
|
|
25025
25127
|
return !!((originalLarge ^ large) || (originalProgressive ^ progressive)) && 'reset';
|
|
25026
25128
|
};
|
|
@@ -26169,6 +26271,14 @@ function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
|
|
|
26169
26271
|
task.dirty();
|
|
26170
26272
|
}
|
|
26171
26273
|
var performArgs = scheduler.getPerformArgs(task, opt.block);
|
|
26274
|
+
// FIXME
|
|
26275
|
+
// if intending to decalare `performRawSeries` in handlers, only
|
|
26276
|
+
// stream-independent (specifically, data item independent) operations can be
|
|
26277
|
+
// performed. Because is a series is filtered, most of the tasks will not
|
|
26278
|
+
// be performed. A stream-dependent operation probably cause wrong biz logic.
|
|
26279
|
+
// Perhaps we should not provide a separate callback for this case instead
|
|
26280
|
+
// of providing the config `performRawSeries`. The stream-dependent operaions
|
|
26281
|
+
// and stream-independent operations should better not be mixed.
|
|
26172
26282
|
performArgs.skip = !stageHandler.performRawSeries
|
|
26173
26283
|
&& ecModel.isSeriesFiltered(task.context.model);
|
|
26174
26284
|
updatePayload(task, payload);
|
|
@@ -27543,10 +27653,10 @@ var isFunction = isFunction$1;
|
|
|
27543
27653
|
var isObject = isObject$1;
|
|
27544
27654
|
var parseClassType = ComponentModel.parseClassType;
|
|
27545
27655
|
|
|
27546
|
-
var version = '4.
|
|
27656
|
+
var version = '4.7.0';
|
|
27547
27657
|
|
|
27548
27658
|
var dependencies = {
|
|
27549
|
-
zrender: '4.
|
|
27659
|
+
zrender: '4.3.0'
|
|
27550
27660
|
};
|
|
27551
27661
|
|
|
27552
27662
|
var TEST_FRAME_REMAIN_TIME = 1;
|
|
@@ -33831,7 +33941,7 @@ var IntervalScale = Scale.extend({
|
|
|
33831
33941
|
|
|
33832
33942
|
if (extent[0] < niceTickExtent[0]) {
|
|
33833
33943
|
if (expandToNicedExtent) {
|
|
33834
|
-
ticks.push(roundNumber(niceTickExtent[0] - interval));
|
|
33944
|
+
ticks.push(roundNumber(niceTickExtent[0] - interval, intervalPrecision));
|
|
33835
33945
|
}
|
|
33836
33946
|
else {
|
|
33837
33947
|
ticks.push(extent[0]);
|
|
@@ -33857,7 +33967,7 @@ var IntervalScale = Scale.extend({
|
|
|
33857
33967
|
var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
|
|
33858
33968
|
if (extent[1] > lastNiceTick) {
|
|
33859
33969
|
if (expandToNicedExtent) {
|
|
33860
|
-
ticks.push(lastNiceTick + interval);
|
|
33970
|
+
ticks.push(roundNumber(lastNiceTick + interval, intervalPrecision));
|
|
33861
33971
|
}
|
|
33862
33972
|
else {
|
|
33863
33973
|
ticks.push(extent[1]);
|
|
@@ -34405,11 +34515,6 @@ function layout(seriesType, ecModel) {
|
|
|
34405
34515
|
var value = data.get(valueDim, idx);
|
|
34406
34516
|
var baseValue = data.get(baseDim, idx);
|
|
34407
34517
|
|
|
34408
|
-
// If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
|
|
34409
|
-
if (isNaN(value) || isNaN(baseValue)) {
|
|
34410
|
-
continue;
|
|
34411
|
-
}
|
|
34412
|
-
|
|
34413
34518
|
var sign = value >= 0 ? 'p' : 'n';
|
|
34414
34519
|
var baseCoord = valueAxisStart;
|
|
34415
34520
|
|
|
@@ -34442,7 +34547,10 @@ function layout(seriesType, ecModel) {
|
|
|
34442
34547
|
if (Math.abs(width) < barMinHeight) {
|
|
34443
34548
|
width = (width < 0 ? -1 : 1) * barMinHeight;
|
|
34444
34549
|
}
|
|
34445
|
-
|
|
34550
|
+
// Ignore stack from NaN value
|
|
34551
|
+
if (!isNaN(width)) {
|
|
34552
|
+
stacked && (lastStackCoords[stackId][baseValue][sign] += width);
|
|
34553
|
+
}
|
|
34446
34554
|
}
|
|
34447
34555
|
else {
|
|
34448
34556
|
var coord = cartesian.dataToPoint([baseValue, value]);
|
|
@@ -34455,7 +34563,10 @@ function layout(seriesType, ecModel) {
|
|
|
34455
34563
|
// Include zero to has a positive bar
|
|
34456
34564
|
height = (height <= 0 ? -1 : 1) * barMinHeight;
|
|
34457
34565
|
}
|
|
34458
|
-
|
|
34566
|
+
// Ignore stack from NaN value
|
|
34567
|
+
if (!isNaN(height)) {
|
|
34568
|
+
stacked && (lastStackCoords[stackId][baseValue][sign] += height);
|
|
34569
|
+
}
|
|
34459
34570
|
}
|
|
34460
34571
|
|
|
34461
34572
|
data.setItemLayout(idx, {
|
|
@@ -34483,6 +34594,7 @@ var largeLayout = {
|
|
|
34483
34594
|
|
|
34484
34595
|
var data = seriesModel.getData();
|
|
34485
34596
|
var cartesian = seriesModel.coordinateSystem;
|
|
34597
|
+
var coordLayout = cartesian.grid.getRect();
|
|
34486
34598
|
var baseAxis = cartesian.getBaseAxis();
|
|
34487
34599
|
var valueAxis = cartesian.getOtherAxis(baseAxis);
|
|
34488
34600
|
var valueDim = data.mapDimension(valueAxis.dim);
|
|
@@ -34502,6 +34614,7 @@ var largeLayout = {
|
|
|
34502
34614
|
function progress(params, data) {
|
|
34503
34615
|
var count = params.count;
|
|
34504
34616
|
var largePoints = new LargeArr(count * 2);
|
|
34617
|
+
var largeBackgroundPoints = new LargeArr(count * 2);
|
|
34505
34618
|
var largeDataIndices = new LargeArr(count);
|
|
34506
34619
|
var dataIndex;
|
|
34507
34620
|
var coord = [];
|
|
@@ -34515,7 +34628,9 @@ var largeLayout = {
|
|
|
34515
34628
|
|
|
34516
34629
|
coord = cartesian.dataToPoint(valuePair, null, coord);
|
|
34517
34630
|
// Data index might not be in order, depends on `progressiveChunkMode`.
|
|
34631
|
+
largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
|
|
34518
34632
|
largePoints[pointsOffset++] = coord[0];
|
|
34633
|
+
largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
|
|
34519
34634
|
largePoints[pointsOffset++] = coord[1];
|
|
34520
34635
|
largeDataIndices[idxOffset++] = dataIndex;
|
|
34521
34636
|
}
|
|
@@ -34523,8 +34638,10 @@ var largeLayout = {
|
|
|
34523
34638
|
data.setLayout({
|
|
34524
34639
|
largePoints: largePoints,
|
|
34525
34640
|
largeDataIndices: largeDataIndices,
|
|
34641
|
+
largeBackgroundPoints: largeBackgroundPoints,
|
|
34526
34642
|
barWidth: barWidth,
|
|
34527
34643
|
valueAxisStart: getValueAxisStart(baseAxis, valueAxis, false),
|
|
34644
|
+
backgroundStart: valueAxisHorizontal ? coordLayout.x : coordLayout.y,
|
|
34528
34645
|
valueAxisHorizontal: valueAxisHorizontal
|
|
34529
34646
|
});
|
|
34530
34647
|
}
|
|
@@ -42411,6 +42528,117 @@ function layout$1(gridModel, axisModel, opt) {
|
|
|
42411
42528
|
* under the License.
|
|
42412
42529
|
*/
|
|
42413
42530
|
|
|
42531
|
+
function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
|
|
42532
|
+
var axis = axisModel.axis;
|
|
42533
|
+
|
|
42534
|
+
if (axis.scale.isBlank()) {
|
|
42535
|
+
return;
|
|
42536
|
+
}
|
|
42537
|
+
|
|
42538
|
+
var splitAreaModel = axisModel.getModel('splitArea');
|
|
42539
|
+
var areaStyleModel = splitAreaModel.getModel('areaStyle');
|
|
42540
|
+
var areaColors = areaStyleModel.get('color');
|
|
42541
|
+
|
|
42542
|
+
var gridRect = gridModel.coordinateSystem.getRect();
|
|
42543
|
+
|
|
42544
|
+
var ticksCoords = axis.getTicksCoords({
|
|
42545
|
+
tickModel: splitAreaModel,
|
|
42546
|
+
clamp: true
|
|
42547
|
+
});
|
|
42548
|
+
|
|
42549
|
+
if (!ticksCoords.length) {
|
|
42550
|
+
return;
|
|
42551
|
+
}
|
|
42552
|
+
|
|
42553
|
+
// For Making appropriate splitArea animation, the color and anid
|
|
42554
|
+
// should be corresponding to previous one if possible.
|
|
42555
|
+
var areaColorsLen = areaColors.length;
|
|
42556
|
+
var lastSplitAreaColors = axisView.__splitAreaColors;
|
|
42557
|
+
var newSplitAreaColors = createHashMap();
|
|
42558
|
+
var colorIndex = 0;
|
|
42559
|
+
if (lastSplitAreaColors) {
|
|
42560
|
+
for (var i = 0; i < ticksCoords.length; i++) {
|
|
42561
|
+
var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
|
|
42562
|
+
if (cIndex != null) {
|
|
42563
|
+
colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
|
|
42564
|
+
break;
|
|
42565
|
+
}
|
|
42566
|
+
}
|
|
42567
|
+
}
|
|
42568
|
+
|
|
42569
|
+
var prev = axis.toGlobalCoord(ticksCoords[0].coord);
|
|
42570
|
+
|
|
42571
|
+
var areaStyle = areaStyleModel.getAreaStyle();
|
|
42572
|
+
areaColors = isArray(areaColors) ? areaColors : [areaColors];
|
|
42573
|
+
|
|
42574
|
+
for (var i = 1; i < ticksCoords.length; i++) {
|
|
42575
|
+
var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
|
|
42576
|
+
|
|
42577
|
+
var x;
|
|
42578
|
+
var y;
|
|
42579
|
+
var width;
|
|
42580
|
+
var height;
|
|
42581
|
+
if (axis.isHorizontal()) {
|
|
42582
|
+
x = prev;
|
|
42583
|
+
y = gridRect.y;
|
|
42584
|
+
width = tickCoord - x;
|
|
42585
|
+
height = gridRect.height;
|
|
42586
|
+
prev = x + width;
|
|
42587
|
+
}
|
|
42588
|
+
else {
|
|
42589
|
+
x = gridRect.x;
|
|
42590
|
+
y = prev;
|
|
42591
|
+
width = gridRect.width;
|
|
42592
|
+
height = tickCoord - y;
|
|
42593
|
+
prev = y + height;
|
|
42594
|
+
}
|
|
42595
|
+
|
|
42596
|
+
var tickValue = ticksCoords[i - 1].tickValue;
|
|
42597
|
+
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
|
|
42598
|
+
|
|
42599
|
+
axisGroup.add(new Rect({
|
|
42600
|
+
anid: tickValue != null ? 'area_' + tickValue : null,
|
|
42601
|
+
shape: {
|
|
42602
|
+
x: x,
|
|
42603
|
+
y: y,
|
|
42604
|
+
width: width,
|
|
42605
|
+
height: height
|
|
42606
|
+
},
|
|
42607
|
+
style: defaults({
|
|
42608
|
+
fill: areaColors[colorIndex]
|
|
42609
|
+
}, areaStyle),
|
|
42610
|
+
silent: true
|
|
42611
|
+
}));
|
|
42612
|
+
|
|
42613
|
+
colorIndex = (colorIndex + 1) % areaColorsLen;
|
|
42614
|
+
}
|
|
42615
|
+
|
|
42616
|
+
axisView.__splitAreaColors = newSplitAreaColors;
|
|
42617
|
+
}
|
|
42618
|
+
|
|
42619
|
+
function rectCoordAxisHandleRemove(axisView) {
|
|
42620
|
+
axisView.__splitAreaColors = null;
|
|
42621
|
+
}
|
|
42622
|
+
|
|
42623
|
+
/*
|
|
42624
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
42625
|
+
* or more contributor license agreements. See the NOTICE file
|
|
42626
|
+
* distributed with this work for additional information
|
|
42627
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
42628
|
+
* to you under the Apache License, Version 2.0 (the
|
|
42629
|
+
* "License"); you may not use this file except in compliance
|
|
42630
|
+
* with the License. You may obtain a copy of the License at
|
|
42631
|
+
*
|
|
42632
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
42633
|
+
*
|
|
42634
|
+
* Unless required by applicable law or agreed to in writing,
|
|
42635
|
+
* software distributed under the License is distributed on an
|
|
42636
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
42637
|
+
* KIND, either express or implied. See the License for the
|
|
42638
|
+
* specific language governing permissions and limitations
|
|
42639
|
+
* under the License.
|
|
42640
|
+
*/
|
|
42641
|
+
|
|
42414
42642
|
var axisBuilderAttrs = [
|
|
42415
42643
|
'axisLine', 'axisTickLabel', 'axisName'
|
|
42416
42644
|
];
|
|
@@ -42462,7 +42690,7 @@ var CartesianAxisView = AxisView.extend({
|
|
|
42462
42690
|
},
|
|
42463
42691
|
|
|
42464
42692
|
remove: function () {
|
|
42465
|
-
this
|
|
42693
|
+
rectCoordAxisHandleRemove(this);
|
|
42466
42694
|
},
|
|
42467
42695
|
|
|
42468
42696
|
/**
|
|
@@ -42594,91 +42822,7 @@ var CartesianAxisView = AxisView.extend({
|
|
|
42594
42822
|
* @private
|
|
42595
42823
|
*/
|
|
42596
42824
|
_splitArea: function (axisModel, gridModel) {
|
|
42597
|
-
|
|
42598
|
-
|
|
42599
|
-
if (axis.scale.isBlank()) {
|
|
42600
|
-
return;
|
|
42601
|
-
}
|
|
42602
|
-
|
|
42603
|
-
var splitAreaModel = axisModel.getModel('splitArea');
|
|
42604
|
-
var areaStyleModel = splitAreaModel.getModel('areaStyle');
|
|
42605
|
-
var areaColors = areaStyleModel.get('color');
|
|
42606
|
-
|
|
42607
|
-
var gridRect = gridModel.coordinateSystem.getRect();
|
|
42608
|
-
|
|
42609
|
-
var ticksCoords = axis.getTicksCoords({
|
|
42610
|
-
tickModel: splitAreaModel,
|
|
42611
|
-
clamp: true
|
|
42612
|
-
});
|
|
42613
|
-
|
|
42614
|
-
if (!ticksCoords.length) {
|
|
42615
|
-
return;
|
|
42616
|
-
}
|
|
42617
|
-
|
|
42618
|
-
// For Making appropriate splitArea animation, the color and anid
|
|
42619
|
-
// should be corresponding to previous one if possible.
|
|
42620
|
-
var areaColorsLen = areaColors.length;
|
|
42621
|
-
var lastSplitAreaColors = this._splitAreaColors;
|
|
42622
|
-
var newSplitAreaColors = createHashMap();
|
|
42623
|
-
var colorIndex = 0;
|
|
42624
|
-
if (lastSplitAreaColors) {
|
|
42625
|
-
for (var i = 0; i < ticksCoords.length; i++) {
|
|
42626
|
-
var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
|
|
42627
|
-
if (cIndex != null) {
|
|
42628
|
-
colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
|
|
42629
|
-
break;
|
|
42630
|
-
}
|
|
42631
|
-
}
|
|
42632
|
-
}
|
|
42633
|
-
|
|
42634
|
-
var prev = axis.toGlobalCoord(ticksCoords[0].coord);
|
|
42635
|
-
|
|
42636
|
-
var areaStyle = areaStyleModel.getAreaStyle();
|
|
42637
|
-
areaColors = isArray(areaColors) ? areaColors : [areaColors];
|
|
42638
|
-
|
|
42639
|
-
for (var i = 1; i < ticksCoords.length; i++) {
|
|
42640
|
-
var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
|
|
42641
|
-
|
|
42642
|
-
var x;
|
|
42643
|
-
var y;
|
|
42644
|
-
var width;
|
|
42645
|
-
var height;
|
|
42646
|
-
if (axis.isHorizontal()) {
|
|
42647
|
-
x = prev;
|
|
42648
|
-
y = gridRect.y;
|
|
42649
|
-
width = tickCoord - x;
|
|
42650
|
-
height = gridRect.height;
|
|
42651
|
-
prev = x + width;
|
|
42652
|
-
}
|
|
42653
|
-
else {
|
|
42654
|
-
x = gridRect.x;
|
|
42655
|
-
y = prev;
|
|
42656
|
-
width = gridRect.width;
|
|
42657
|
-
height = tickCoord - y;
|
|
42658
|
-
prev = y + height;
|
|
42659
|
-
}
|
|
42660
|
-
|
|
42661
|
-
var tickValue = ticksCoords[i - 1].tickValue;
|
|
42662
|
-
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
|
|
42663
|
-
|
|
42664
|
-
this._axisGroup.add(new Rect({
|
|
42665
|
-
anid: tickValue != null ? 'area_' + tickValue : null,
|
|
42666
|
-
shape: {
|
|
42667
|
-
x: x,
|
|
42668
|
-
y: y,
|
|
42669
|
-
width: width,
|
|
42670
|
-
height: height
|
|
42671
|
-
},
|
|
42672
|
-
style: defaults({
|
|
42673
|
-
fill: areaColors[colorIndex]
|
|
42674
|
-
}, areaStyle),
|
|
42675
|
-
silent: true
|
|
42676
|
-
}));
|
|
42677
|
-
|
|
42678
|
-
colorIndex = (colorIndex + 1) % areaColorsLen;
|
|
42679
|
-
}
|
|
42680
|
-
|
|
42681
|
-
this._splitAreaColors = newSplitAreaColors;
|
|
42825
|
+
rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, gridModel);
|
|
42682
42826
|
}
|
|
42683
42827
|
});
|
|
42684
42828
|
|
|
@@ -42924,7 +43068,21 @@ BaseBarSeries.extend({
|
|
|
42924
43068
|
|
|
42925
43069
|
// If use caps on two sides of bars
|
|
42926
43070
|
// Only available on tangential polar bar
|
|
42927
|
-
roundCap: false
|
|
43071
|
+
roundCap: false,
|
|
43072
|
+
|
|
43073
|
+
showBackground: false,
|
|
43074
|
+
backgroundStyle: {
|
|
43075
|
+
color: 'rgba(180, 180, 180, 0.2)',
|
|
43076
|
+
borderColor: null,
|
|
43077
|
+
borderWidth: 0,
|
|
43078
|
+
borderType: 'solid',
|
|
43079
|
+
borderRadius: 0,
|
|
43080
|
+
shadowBlur: 0,
|
|
43081
|
+
shadowColor: null,
|
|
43082
|
+
shadowOffsetX: 0,
|
|
43083
|
+
shadowOffsetY: 0,
|
|
43084
|
+
opacity: 1
|
|
43085
|
+
}
|
|
42928
43086
|
}
|
|
42929
43087
|
});
|
|
42930
43088
|
|
|
@@ -43229,15 +43387,28 @@ extendChartView({
|
|
|
43229
43387
|
|
|
43230
43388
|
var roundCap = seriesModel.get('roundCap', true);
|
|
43231
43389
|
|
|
43390
|
+
var drawBackground = seriesModel.get('showBackground', true);
|
|
43391
|
+
var backgroundModel = seriesModel.getModel('backgroundStyle');
|
|
43392
|
+
|
|
43393
|
+
var bgEls = [];
|
|
43394
|
+
var oldBgEls = this._backgroundEls || [];
|
|
43395
|
+
|
|
43232
43396
|
data.diff(oldData)
|
|
43233
43397
|
.add(function (dataIndex) {
|
|
43398
|
+
var itemModel = data.getItemModel(dataIndex);
|
|
43399
|
+
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
43400
|
+
|
|
43401
|
+
if (drawBackground) {
|
|
43402
|
+
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
|
|
43403
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
43404
|
+
bgEls[dataIndex] = bgEl;
|
|
43405
|
+
}
|
|
43406
|
+
|
|
43407
|
+
// If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
|
|
43234
43408
|
if (!data.hasValue(dataIndex)) {
|
|
43235
43409
|
return;
|
|
43236
43410
|
}
|
|
43237
43411
|
|
|
43238
|
-
var itemModel = data.getItemModel(dataIndex);
|
|
43239
|
-
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
43240
|
-
|
|
43241
43412
|
if (needsClip) {
|
|
43242
43413
|
// Clip will modify the layout params.
|
|
43243
43414
|
// And return a boolean to determine if the shape are fully clipped.
|
|
@@ -43260,16 +43431,24 @@ extendChartView({
|
|
|
43260
43431
|
);
|
|
43261
43432
|
})
|
|
43262
43433
|
.update(function (newIndex, oldIndex) {
|
|
43263
|
-
var
|
|
43434
|
+
var itemModel = data.getItemModel(newIndex);
|
|
43435
|
+
var layout = getLayout[coord.type](data, newIndex, itemModel);
|
|
43436
|
+
|
|
43437
|
+
if (drawBackground) {
|
|
43438
|
+
var bgEl = oldBgEls[oldIndex];
|
|
43439
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
43440
|
+
bgEls[newIndex] = bgEl;
|
|
43264
43441
|
|
|
43442
|
+
var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
|
|
43443
|
+
updateProps(bgEl, { shape: shape }, animationModel, newIndex);
|
|
43444
|
+
}
|
|
43445
|
+
|
|
43446
|
+
var el = oldData.getItemGraphicEl(oldIndex);
|
|
43265
43447
|
if (!data.hasValue(newIndex)) {
|
|
43266
43448
|
group.remove(el);
|
|
43267
43449
|
return;
|
|
43268
43450
|
}
|
|
43269
43451
|
|
|
43270
|
-
var itemModel = data.getItemModel(newIndex);
|
|
43271
|
-
var layout = getLayout[coord.type](data, newIndex, itemModel);
|
|
43272
|
-
|
|
43273
43452
|
if (needsClip) {
|
|
43274
43453
|
var isClipped = clip[coord.type](coordSysClipArea, layout);
|
|
43275
43454
|
if (isClipped) {
|
|
@@ -43307,6 +43486,15 @@ extendChartView({
|
|
|
43307
43486
|
})
|
|
43308
43487
|
.execute();
|
|
43309
43488
|
|
|
43489
|
+
var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());
|
|
43490
|
+
bgGroup.removeAll();
|
|
43491
|
+
|
|
43492
|
+
for (var i = 0; i < bgEls.length; ++i) {
|
|
43493
|
+
bgGroup.add(bgEls[i]);
|
|
43494
|
+
}
|
|
43495
|
+
group.add(bgGroup);
|
|
43496
|
+
this._backgroundEls = bgEls;
|
|
43497
|
+
|
|
43310
43498
|
this._data = data;
|
|
43311
43499
|
},
|
|
43312
43500
|
|
|
@@ -43327,6 +43515,7 @@ extendChartView({
|
|
|
43327
43515
|
},
|
|
43328
43516
|
|
|
43329
43517
|
_incrementalRenderLarge: function (params, seriesModel) {
|
|
43518
|
+
this._removeBackground();
|
|
43330
43519
|
createLarge(seriesModel, this.group, true);
|
|
43331
43520
|
},
|
|
43332
43521
|
|
|
@@ -43340,6 +43529,9 @@ extendChartView({
|
|
|
43340
43529
|
var group = this.group;
|
|
43341
43530
|
var data = this._data;
|
|
43342
43531
|
if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
|
|
43532
|
+
this._removeBackground();
|
|
43533
|
+
this._backgroundEls = [];
|
|
43534
|
+
|
|
43343
43535
|
data.eachItemGraphicEl(function (el) {
|
|
43344
43536
|
if (el.type === 'sector') {
|
|
43345
43537
|
removeSector(el.dataIndex, ecModel, el);
|
|
@@ -43353,6 +43545,11 @@ extendChartView({
|
|
|
43353
43545
|
group.removeAll();
|
|
43354
43546
|
}
|
|
43355
43547
|
this._data = null;
|
|
43548
|
+
},
|
|
43549
|
+
|
|
43550
|
+
_removeBackground: function () {
|
|
43551
|
+
this.group.remove(this._backgroundGroup);
|
|
43552
|
+
this._backgroundGroup = null;
|
|
43356
43553
|
}
|
|
43357
43554
|
|
|
43358
43555
|
});
|
|
@@ -43410,7 +43607,12 @@ var elementCreator = {
|
|
|
43410
43607
|
dataIndex, layout, isHorizontal,
|
|
43411
43608
|
animationModel, isUpdate
|
|
43412
43609
|
) {
|
|
43413
|
-
var rect = new Rect({
|
|
43610
|
+
var rect = new Rect({
|
|
43611
|
+
shape: extend({}, layout),
|
|
43612
|
+
z2: 1
|
|
43613
|
+
});
|
|
43614
|
+
|
|
43615
|
+
rect.name = 'item';
|
|
43414
43616
|
|
|
43415
43617
|
// Animation
|
|
43416
43618
|
if (animationModel) {
|
|
@@ -43440,9 +43642,12 @@ var elementCreator = {
|
|
|
43440
43642
|
var ShapeClass = (!isRadial && roundCap) ? Sausage : Sector;
|
|
43441
43643
|
|
|
43442
43644
|
var sector = new ShapeClass({
|
|
43443
|
-
shape: defaults({clockwise: clockwise}, layout)
|
|
43645
|
+
shape: defaults({clockwise: clockwise}, layout),
|
|
43646
|
+
z2: 1
|
|
43444
43647
|
});
|
|
43445
43648
|
|
|
43649
|
+
sector.name = 'item';
|
|
43650
|
+
|
|
43446
43651
|
// Animation
|
|
43447
43652
|
if (animationModel) {
|
|
43448
43653
|
var sectorShape = sector.shape;
|
|
@@ -43562,7 +43767,10 @@ function updateStyle(
|
|
|
43562
43767
|
// In case width or height are too small.
|
|
43563
43768
|
function getLineWidth(itemModel, rawLayout) {
|
|
43564
43769
|
var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
|
|
43565
|
-
|
|
43770
|
+
// width or height may be NaN for empty data
|
|
43771
|
+
var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
|
|
43772
|
+
var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
|
|
43773
|
+
return Math.min(lineWidth, width, height);
|
|
43566
43774
|
}
|
|
43567
43775
|
|
|
43568
43776
|
|
|
@@ -43594,13 +43802,38 @@ function createLarge(seriesModel, group, incremental) {
|
|
|
43594
43802
|
var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
|
|
43595
43803
|
startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart');
|
|
43596
43804
|
|
|
43805
|
+
var largeDataIndices = data.getLayout('largeDataIndices');
|
|
43806
|
+
var barWidth = data.getLayout('barWidth');
|
|
43807
|
+
|
|
43808
|
+
var backgroundModel = seriesModel.getModel('backgroundStyle');
|
|
43809
|
+
var drawBackground = seriesModel.get('showBackground', true);
|
|
43810
|
+
|
|
43811
|
+
if (drawBackground) {
|
|
43812
|
+
var points = data.getLayout('largeBackgroundPoints');
|
|
43813
|
+
var backgroundStartPoint = [];
|
|
43814
|
+
backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart');
|
|
43815
|
+
|
|
43816
|
+
var bgEl = new LargePath({
|
|
43817
|
+
shape: {points: points},
|
|
43818
|
+
incremental: !!incremental,
|
|
43819
|
+
__startPoint: backgroundStartPoint,
|
|
43820
|
+
__baseDimIdx: baseDimIdx,
|
|
43821
|
+
__largeDataIndices: largeDataIndices,
|
|
43822
|
+
__barWidth: barWidth,
|
|
43823
|
+
silent: true,
|
|
43824
|
+
z2: 0
|
|
43825
|
+
});
|
|
43826
|
+
setLargeBackgroundStyle(bgEl, backgroundModel, data);
|
|
43827
|
+
group.add(bgEl);
|
|
43828
|
+
}
|
|
43829
|
+
|
|
43597
43830
|
var el = new LargePath({
|
|
43598
43831
|
shape: {points: data.getLayout('largePoints')},
|
|
43599
43832
|
incremental: !!incremental,
|
|
43600
43833
|
__startPoint: startPoint,
|
|
43601
43834
|
__baseDimIdx: baseDimIdx,
|
|
43602
|
-
__largeDataIndices:
|
|
43603
|
-
__barWidth:
|
|
43835
|
+
__largeDataIndices: largeDataIndices,
|
|
43836
|
+
__barWidth: barWidth
|
|
43604
43837
|
});
|
|
43605
43838
|
group.add(el);
|
|
43606
43839
|
setLargeStyle(el, seriesModel, data);
|
|
@@ -43665,6 +43898,55 @@ function setLargeStyle(el, seriesModel, data) {
|
|
|
43665
43898
|
el.style.lineWidth = data.getLayout('barWidth');
|
|
43666
43899
|
}
|
|
43667
43900
|
|
|
43901
|
+
function setLargeBackgroundStyle(el, backgroundModel, data) {
|
|
43902
|
+
var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color');
|
|
43903
|
+
var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']);
|
|
43904
|
+
|
|
43905
|
+
el.useStyle(itemStyle);
|
|
43906
|
+
el.style.fill = null;
|
|
43907
|
+
el.style.stroke = borderColor;
|
|
43908
|
+
el.style.lineWidth = data.getLayout('barWidth');
|
|
43909
|
+
}
|
|
43910
|
+
|
|
43911
|
+
function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
|
|
43912
|
+
var coordLayout;
|
|
43913
|
+
var isPolar = coord.type === 'polar';
|
|
43914
|
+
if (isPolar) {
|
|
43915
|
+
coordLayout = coord.getArea();
|
|
43916
|
+
}
|
|
43917
|
+
else {
|
|
43918
|
+
coordLayout = coord.grid.getRect();
|
|
43919
|
+
}
|
|
43920
|
+
|
|
43921
|
+
if (isPolar) {
|
|
43922
|
+
return {
|
|
43923
|
+
cx: coordLayout.cx,
|
|
43924
|
+
cy: coordLayout.cy,
|
|
43925
|
+
r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0,
|
|
43926
|
+
r: isHorizontalOrRadial ? coordLayout.r : layout.r,
|
|
43927
|
+
startAngle: isHorizontalOrRadial ? layout.startAngle : 0,
|
|
43928
|
+
endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2
|
|
43929
|
+
};
|
|
43930
|
+
}
|
|
43931
|
+
else {
|
|
43932
|
+
return {
|
|
43933
|
+
x: isHorizontalOrRadial ? layout.x : coordLayout.x,
|
|
43934
|
+
y: isHorizontalOrRadial ? coordLayout.y : layout.y,
|
|
43935
|
+
width: isHorizontalOrRadial ? layout.width : coordLayout.width,
|
|
43936
|
+
height: isHorizontalOrRadial ? coordLayout.height : layout.height
|
|
43937
|
+
};
|
|
43938
|
+
}
|
|
43939
|
+
}
|
|
43940
|
+
|
|
43941
|
+
function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
|
|
43942
|
+
var ElementClz = coord.type === 'polar' ? Sector : Rect;
|
|
43943
|
+
return new ElementClz({
|
|
43944
|
+
shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
|
|
43945
|
+
silent: true,
|
|
43946
|
+
z2: 0
|
|
43947
|
+
});
|
|
43948
|
+
}
|
|
43949
|
+
|
|
43668
43950
|
/*
|
|
43669
43951
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
43670
43952
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -44274,7 +44556,7 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
|
|
|
44274
44556
|
toggleItemSelected(
|
|
44275
44557
|
this,
|
|
44276
44558
|
data.getItemLayout(idx),
|
|
44277
|
-
seriesModel.isSelected(
|
|
44559
|
+
seriesModel.isSelected(data.getName(idx)),
|
|
44278
44560
|
seriesModel.get('selectedOffset'),
|
|
44279
44561
|
seriesModel.get('animation')
|
|
44280
44562
|
);
|
|
@@ -45026,7 +45308,7 @@ var labelLayout = function (seriesModel, r, viewWidth, viewHeight, viewLeft, vie
|
|
|
45026
45308
|
inside: isLabelInside,
|
|
45027
45309
|
labelDistance: labelDistance,
|
|
45028
45310
|
labelAlignTo: labelAlignTo,
|
|
45029
|
-
labelMargin:labelMargin,
|
|
45311
|
+
labelMargin: labelMargin,
|
|
45030
45312
|
bleedMargin: bleedMargin,
|
|
45031
45313
|
textRect: textRect,
|
|
45032
45314
|
text: text,
|
|
@@ -48391,24 +48673,63 @@ function assembleCssText(tooltipModel) {
|
|
|
48391
48673
|
return cssText.join(';') + ';';
|
|
48392
48674
|
}
|
|
48393
48675
|
|
|
48676
|
+
// If not able to make, do not modify the input `out`.
|
|
48677
|
+
function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
|
|
48678
|
+
var zrPainter = zr && zr.painter;
|
|
48679
|
+
|
|
48680
|
+
if (appendToBody) {
|
|
48681
|
+
var zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
|
|
48682
|
+
if (zrViewportRoot) {
|
|
48683
|
+
// Some APPs might use scale on body, so we support CSS transform here.
|
|
48684
|
+
transformLocalCoord(out, zrViewportRoot, document.body, zrX, zrY);
|
|
48685
|
+
}
|
|
48686
|
+
}
|
|
48687
|
+
else {
|
|
48688
|
+
out[0] = zrX;
|
|
48689
|
+
out[1] = zrY;
|
|
48690
|
+
// xy should be based on canvas root. But tooltipContent is
|
|
48691
|
+
// the sibling of canvas root. So padding of ec container
|
|
48692
|
+
// should be considered here.
|
|
48693
|
+
var viewportRootOffset = zrPainter && zrPainter.getViewportRootOffset();
|
|
48694
|
+
if (viewportRootOffset) {
|
|
48695
|
+
out[0] += viewportRootOffset.offsetLeft;
|
|
48696
|
+
out[1] += viewportRootOffset.offsetTop;
|
|
48697
|
+
}
|
|
48698
|
+
}
|
|
48699
|
+
}
|
|
48700
|
+
|
|
48394
48701
|
/**
|
|
48395
48702
|
* @alias module:echarts/component/tooltip/TooltipContent
|
|
48703
|
+
* @param {HTMLElement} container
|
|
48704
|
+
* @param {ExtensionAPI} api
|
|
48705
|
+
* @param {Object} [opt]
|
|
48706
|
+
* @param {boolean} [opt.appendToBody]
|
|
48707
|
+
* `false`: the DOM element will be inside the container. Default value.
|
|
48708
|
+
* `true`: the DOM element will be appended to HTML body, which avoid
|
|
48709
|
+
* some overflow clip but intrude outside of the container.
|
|
48396
48710
|
* @constructor
|
|
48397
48711
|
*/
|
|
48398
|
-
function TooltipContent(container, api) {
|
|
48712
|
+
function TooltipContent(container, api, opt) {
|
|
48399
48713
|
if (env$1.wxa) {
|
|
48400
48714
|
return null;
|
|
48401
48715
|
}
|
|
48402
48716
|
|
|
48403
48717
|
var el = document.createElement('div');
|
|
48718
|
+
el.domBelongToZr = true;
|
|
48719
|
+
this.el = el;
|
|
48404
48720
|
var zr = this._zr = api.getZr();
|
|
48721
|
+
var appendToBody = this._appendToBody = opt && opt.appendToBody;
|
|
48405
48722
|
|
|
48406
|
-
this.
|
|
48723
|
+
this._styleCoord = [0, 0];
|
|
48407
48724
|
|
|
48408
|
-
this.
|
|
48409
|
-
this._y = api.getHeight() / 2;
|
|
48725
|
+
makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
|
|
48410
48726
|
|
|
48411
|
-
|
|
48727
|
+
if (appendToBody) {
|
|
48728
|
+
document.body.appendChild(el);
|
|
48729
|
+
}
|
|
48730
|
+
else {
|
|
48731
|
+
container.appendChild(el);
|
|
48732
|
+
}
|
|
48412
48733
|
|
|
48413
48734
|
this._container = container;
|
|
48414
48735
|
|
|
@@ -48442,7 +48763,8 @@ function TooltipContent(container, api) {
|
|
|
48442
48763
|
// Try trigger zrender event to avoid mouse
|
|
48443
48764
|
// in and out shape too frequently
|
|
48444
48765
|
var handler = zr.handler;
|
|
48445
|
-
|
|
48766
|
+
var zrViewportRoot = zr.painter.getViewportRoot();
|
|
48767
|
+
normalizeEvent(zrViewportRoot, e, true);
|
|
48446
48768
|
handler.dispatch('mousemove', e);
|
|
48447
48769
|
}
|
|
48448
48770
|
};
|
|
@@ -48487,12 +48809,13 @@ TooltipContent.prototype = {
|
|
|
48487
48809
|
show: function (tooltipModel) {
|
|
48488
48810
|
clearTimeout(this._hideTimeout);
|
|
48489
48811
|
var el = this.el;
|
|
48812
|
+
var styleCoord = this._styleCoord;
|
|
48490
48813
|
|
|
48491
48814
|
el.style.cssText = gCssText + assembleCssText(tooltipModel)
|
|
48492
48815
|
// Because of the reason described in:
|
|
48493
48816
|
// http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore
|
|
48494
48817
|
// we should set initial value to `left` and `top`.
|
|
48495
|
-
+ ';left:' +
|
|
48818
|
+
+ ';left:' + styleCoord[0] + 'px;top:' + styleCoord[1] + 'px;'
|
|
48496
48819
|
+ (tooltipModel.get('extraCssText') || '');
|
|
48497
48820
|
|
|
48498
48821
|
el.style.display = el.innerHTML ? 'block' : 'none';
|
|
@@ -48520,23 +48843,13 @@ TooltipContent.prototype = {
|
|
|
48520
48843
|
return [el.clientWidth, el.clientHeight];
|
|
48521
48844
|
},
|
|
48522
48845
|
|
|
48523
|
-
moveTo: function (
|
|
48524
|
-
|
|
48525
|
-
|
|
48526
|
-
// should be considered here.
|
|
48527
|
-
var zr = this._zr;
|
|
48528
|
-
var viewportRootOffset;
|
|
48529
|
-
if (zr && zr.painter && (viewportRootOffset = zr.painter.getViewportRootOffset())) {
|
|
48530
|
-
x += viewportRootOffset.offsetLeft;
|
|
48531
|
-
y += viewportRootOffset.offsetTop;
|
|
48532
|
-
}
|
|
48846
|
+
moveTo: function (zrX, zrY) {
|
|
48847
|
+
var styleCoord = this._styleCoord;
|
|
48848
|
+
makeStyleCoord(styleCoord, this._zr, this._appendToBody, zrX, zrY);
|
|
48533
48849
|
|
|
48534
48850
|
var style = this.el.style;
|
|
48535
|
-
style.left =
|
|
48536
|
-
style.top =
|
|
48537
|
-
|
|
48538
|
-
this._x = x;
|
|
48539
|
-
this._y = y;
|
|
48851
|
+
style.left = styleCoord[0] + 'px';
|
|
48852
|
+
style.top = styleCoord[1] + 'px';
|
|
48540
48853
|
},
|
|
48541
48854
|
|
|
48542
48855
|
hide: function () {
|
|
@@ -48562,6 +48875,10 @@ TooltipContent.prototype = {
|
|
|
48562
48875
|
return this._show;
|
|
48563
48876
|
},
|
|
48564
48877
|
|
|
48878
|
+
dispose: function () {
|
|
48879
|
+
this.el.parentNode.removeChild(this.el);
|
|
48880
|
+
},
|
|
48881
|
+
|
|
48565
48882
|
getOuterSize: function () {
|
|
48566
48883
|
var width = this.el.clientWidth;
|
|
48567
48884
|
var height = this.el.clientHeight;
|
|
@@ -48578,6 +48895,7 @@ TooltipContent.prototype = {
|
|
|
48578
48895
|
|
|
48579
48896
|
return {width: width, height: height};
|
|
48580
48897
|
}
|
|
48898
|
+
|
|
48581
48899
|
};
|
|
48582
48900
|
|
|
48583
48901
|
/*
|
|
@@ -48809,7 +49127,9 @@ extendComponentView({
|
|
|
48809
49127
|
|
|
48810
49128
|
var tooltipContent;
|
|
48811
49129
|
if (this._renderMode === 'html') {
|
|
48812
|
-
tooltipContent = new TooltipContent(api.getDom(), api
|
|
49130
|
+
tooltipContent = new TooltipContent(api.getDom(), api, {
|
|
49131
|
+
appendToBody: tooltipModel.get('appendToBody', true)
|
|
49132
|
+
});
|
|
48813
49133
|
this._newLine = '<br/>';
|
|
48814
49134
|
}
|
|
48815
49135
|
else {
|
|
@@ -48962,7 +49282,6 @@ extendComponentView({
|
|
|
48962
49282
|
offsetX: payload.x,
|
|
48963
49283
|
offsetY: payload.y,
|
|
48964
49284
|
position: payload.position,
|
|
48965
|
-
event: {},
|
|
48966
49285
|
dataByCoordSys: payload.dataByCoordSys,
|
|
48967
49286
|
tooltipOption: payload.tooltipOption
|
|
48968
49287
|
}, dispatchAction);
|
|
@@ -48981,8 +49300,7 @@ extendComponentView({
|
|
|
48981
49300
|
offsetX: cx,
|
|
48982
49301
|
offsetY: cy,
|
|
48983
49302
|
position: payload.position,
|
|
48984
|
-
target: pointInfo.el
|
|
48985
|
-
event: {}
|
|
49303
|
+
target: pointInfo.el
|
|
48986
49304
|
}, dispatchAction);
|
|
48987
49305
|
}
|
|
48988
49306
|
}
|
|
@@ -48999,8 +49317,7 @@ extendComponentView({
|
|
|
48999
49317
|
offsetX: payload.x,
|
|
49000
49318
|
offsetY: payload.y,
|
|
49001
49319
|
position: payload.position,
|
|
49002
|
-
target: api.getZr().findHover(payload.x, payload.y).target
|
|
49003
|
-
event: {}
|
|
49320
|
+
target: api.getZr().findHover(payload.x, payload.y).target
|
|
49004
49321
|
}, dispatchAction);
|
|
49005
49322
|
}
|
|
49006
49323
|
},
|
|
@@ -49106,7 +49423,9 @@ extendComponentView({
|
|
|
49106
49423
|
_showAxisTooltip: function (dataByCoordSys, e) {
|
|
49107
49424
|
var ecModel = this._ecModel;
|
|
49108
49425
|
var globalTooltipModel = this._tooltipModel;
|
|
49426
|
+
|
|
49109
49427
|
var point = [e.offsetX, e.offsetY];
|
|
49428
|
+
|
|
49110
49429
|
var singleDefaultHTML = [];
|
|
49111
49430
|
var singleParamsList = [];
|
|
49112
49431
|
var singleTooltipModel = buildTooltipModel([
|
|
@@ -49362,6 +49681,7 @@ extendComponentView({
|
|
|
49362
49681
|
_updatePosition: function (tooltipModel, positionExpr, x, y, content, params, el) {
|
|
49363
49682
|
var viewWidth = this._api.getWidth();
|
|
49364
49683
|
var viewHeight = this._api.getHeight();
|
|
49684
|
+
|
|
49365
49685
|
positionExpr = positionExpr || tooltipModel.get('position');
|
|
49366
49686
|
|
|
49367
49687
|
var contentSize = content.getSize();
|
|
@@ -49480,7 +49800,7 @@ extendComponentView({
|
|
|
49480
49800
|
if (env$1.node) {
|
|
49481
49801
|
return;
|
|
49482
49802
|
}
|
|
49483
|
-
this._tooltipContent.
|
|
49803
|
+
this._tooltipContent.dispose();
|
|
49484
49804
|
unregister('itemTooltip', api);
|
|
49485
49805
|
}
|
|
49486
49806
|
});
|
|
@@ -51325,26 +51645,28 @@ var ScrollableLegendView = LegendView.extend({
|
|
|
51325
51645
|
},
|
|
51326
51646
|
|
|
51327
51647
|
_findTargetItemIndex: function (targetDataIndex) {
|
|
51648
|
+
if (!this._showController) {
|
|
51649
|
+
return 0;
|
|
51650
|
+
}
|
|
51651
|
+
|
|
51328
51652
|
var index;
|
|
51329
51653
|
var contentGroup = this.getContentGroup();
|
|
51330
51654
|
var defaultIndex;
|
|
51331
51655
|
|
|
51332
|
-
|
|
51333
|
-
|
|
51334
|
-
|
|
51335
|
-
|
|
51336
|
-
|
|
51337
|
-
|
|
51338
|
-
|
|
51339
|
-
|
|
51340
|
-
|
|
51341
|
-
|
|
51342
|
-
|
|
51343
|
-
|
|
51344
|
-
|
|
51345
|
-
|
|
51346
|
-
});
|
|
51347
|
-
}
|
|
51656
|
+
contentGroup.eachChild(function (child, idx) {
|
|
51657
|
+
var legendDataIdx = child.__legendDataIndex;
|
|
51658
|
+
// FIXME
|
|
51659
|
+
// If the given targetDataIndex (from model) is illegal,
|
|
51660
|
+
// we use defualtIndex. But the index on the legend model and
|
|
51661
|
+
// action payload is still illegal. That case will not be
|
|
51662
|
+
// changed until some scenario requires.
|
|
51663
|
+
if (defaultIndex == null && legendDataIdx != null) {
|
|
51664
|
+
defaultIndex = idx;
|
|
51665
|
+
}
|
|
51666
|
+
if (legendDataIdx === targetDataIndex) {
|
|
51667
|
+
index = idx;
|
|
51668
|
+
}
|
|
51669
|
+
});
|
|
51348
51670
|
|
|
51349
51671
|
return index != null ? index : defaultIndex;
|
|
51350
51672
|
}
|
|
@@ -51926,8 +52248,8 @@ function markerTypeCalculatorWithExtent(
|
|
|
51926
52248
|
|
|
51927
52249
|
var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];
|
|
51928
52250
|
coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);
|
|
51929
|
-
coordArr[targetCoordIndex] = data.get(
|
|
51930
|
-
|
|
52251
|
+
coordArr[targetCoordIndex] = data.get(calcDataDim, dataIndex);
|
|
52252
|
+
var coordArrValue = data.get(targetDataDim, dataIndex);
|
|
51931
52253
|
// Make it simple, do not visit all stacked value to count precision.
|
|
51932
52254
|
var precision = getPrecision(data.get(targetDataDim, dataIndex));
|
|
51933
52255
|
precision = Math.min(precision, 20);
|
|
@@ -51935,7 +52257,7 @@ function markerTypeCalculatorWithExtent(
|
|
|
51935
52257
|
coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
|
|
51936
52258
|
}
|
|
51937
52259
|
|
|
51938
|
-
return coordArr;
|
|
52260
|
+
return [coordArr, coordArrValue];
|
|
51939
52261
|
}
|
|
51940
52262
|
|
|
51941
52263
|
var curry$4 = curry;
|
|
@@ -51998,12 +52320,15 @@ function dataTransform(seriesModel, item) {
|
|
|
51998
52320
|
var otherCoordIndex = indexOf$1(dims, axisInfo.baseAxis.dim);
|
|
51999
52321
|
var targetCoordIndex = indexOf$1(dims, axisInfo.valueAxis.dim);
|
|
52000
52322
|
|
|
52001
|
-
|
|
52323
|
+
var coordInfo = markerTypeCalculator[item.type](
|
|
52002
52324
|
data, axisInfo.baseDataDim, axisInfo.valueDataDim,
|
|
52003
52325
|
otherCoordIndex, targetCoordIndex
|
|
52004
52326
|
);
|
|
52327
|
+
item.coord = coordInfo[0];
|
|
52005
52328
|
// Force to use the value of calculated value.
|
|
52006
|
-
item
|
|
52329
|
+
// let item use the value without stack.
|
|
52330
|
+
item.value = coordInfo[1];
|
|
52331
|
+
|
|
52007
52332
|
}
|
|
52008
52333
|
else {
|
|
52009
52334
|
// FIXME Only has one of xAxis and yAxis.
|
|
@@ -52395,7 +52720,8 @@ MarkerModel.extend({
|
|
|
52395
52720
|
},
|
|
52396
52721
|
label: {
|
|
52397
52722
|
show: true,
|
|
52398
|
-
position: 'end'
|
|
52723
|
+
position: 'end',
|
|
52724
|
+
distance: 5
|
|
52399
52725
|
},
|
|
52400
52726
|
lineStyle: {
|
|
52401
52727
|
type: 'dashed'
|
|
@@ -52620,39 +52946,90 @@ function updateSymbolAndLabelBeforeLineUpdate() {
|
|
|
52620
52946
|
var textPosition;
|
|
52621
52947
|
var textAlign;
|
|
52622
52948
|
var textVerticalAlign;
|
|
52623
|
-
|
|
52624
|
-
|
|
52625
|
-
|
|
52626
|
-
|
|
52627
|
-
|
|
52628
|
-
|
|
52629
|
-
|
|
52630
|
-
|
|
52631
|
-
|
|
52632
|
-
|
|
52633
|
-
|
|
52634
|
-
|
|
52635
|
-
|
|
52636
|
-
|
|
52637
|
-
|
|
52638
|
-
|
|
52639
|
-
n[1] = -n[1];
|
|
52640
|
-
}
|
|
52641
|
-
textPosition = [cp[0] + n[0] * distance$$1, cp[1] + n[1] * distance$$1];
|
|
52642
|
-
textAlign = 'center';
|
|
52643
|
-
textVerticalAlign = 'bottom';
|
|
52949
|
+
var textOrigin;
|
|
52950
|
+
|
|
52951
|
+
var distance$$1 = label.__labelDistance;
|
|
52952
|
+
var distanceX = distance$$1[0] * invScale;
|
|
52953
|
+
var distanceY = distance$$1[1] * invScale;
|
|
52954
|
+
var halfPercent = percent / 2;
|
|
52955
|
+
var tangent = line.tangentAt(halfPercent);
|
|
52956
|
+
var n = [tangent[1], -tangent[0]];
|
|
52957
|
+
var cp = line.pointAt(halfPercent);
|
|
52958
|
+
if (n[1] > 0) {
|
|
52959
|
+
n[0] = -n[0];
|
|
52960
|
+
n[1] = -n[1];
|
|
52961
|
+
}
|
|
52962
|
+
var dir = tangent[0] < 0 ? -1 : 1;
|
|
52963
|
+
|
|
52964
|
+
if (label.__position !== 'start' && label.__position !== 'end') {
|
|
52644
52965
|
var rotation = -Math.atan2(tangent[1], tangent[0]);
|
|
52645
52966
|
if (toPos[0] < fromPos[0]) {
|
|
52646
52967
|
rotation = Math.PI + rotation;
|
|
52647
52968
|
}
|
|
52648
52969
|
label.attr('rotation', rotation);
|
|
52649
52970
|
}
|
|
52650
|
-
|
|
52651
|
-
|
|
52652
|
-
|
|
52653
|
-
|
|
52654
|
-
|
|
52971
|
+
|
|
52972
|
+
var dy;
|
|
52973
|
+
switch (label.__position) {
|
|
52974
|
+
case 'insideStartTop':
|
|
52975
|
+
case 'insideMiddleTop':
|
|
52976
|
+
case 'insideEndTop':
|
|
52977
|
+
case 'middle':
|
|
52978
|
+
dy = -distanceY;
|
|
52979
|
+
textVerticalAlign = 'bottom';
|
|
52980
|
+
break;
|
|
52981
|
+
|
|
52982
|
+
case 'insideStartBottom':
|
|
52983
|
+
case 'insideMiddleBottom':
|
|
52984
|
+
case 'insideEndBottom':
|
|
52985
|
+
dy = distanceY;
|
|
52986
|
+
textVerticalAlign = 'top';
|
|
52987
|
+
break;
|
|
52988
|
+
|
|
52989
|
+
default:
|
|
52990
|
+
dy = 0;
|
|
52991
|
+
textVerticalAlign = 'middle';
|
|
52992
|
+
}
|
|
52993
|
+
|
|
52994
|
+
switch (label.__position) {
|
|
52995
|
+
case 'end':
|
|
52996
|
+
textPosition = [d[0] * distanceX + toPos[0], d[1] * distanceY + toPos[1]];
|
|
52997
|
+
textAlign = d[0] > 0.8 ? 'left' : (d[0] < -0.8 ? 'right' : 'center');
|
|
52998
|
+
textVerticalAlign = d[1] > 0.8 ? 'top' : (d[1] < -0.8 ? 'bottom' : 'middle');
|
|
52999
|
+
break;
|
|
53000
|
+
|
|
53001
|
+
case 'start':
|
|
53002
|
+
textPosition = [-d[0] * distanceX + fromPos[0], -d[1] * distanceY + fromPos[1]];
|
|
53003
|
+
textAlign = d[0] > 0.8 ? 'right' : (d[0] < -0.8 ? 'left' : 'center');
|
|
53004
|
+
textVerticalAlign = d[1] > 0.8 ? 'bottom' : (d[1] < -0.8 ? 'top' : 'middle');
|
|
53005
|
+
break;
|
|
53006
|
+
|
|
53007
|
+
case 'insideStartTop':
|
|
53008
|
+
case 'insideStart':
|
|
53009
|
+
case 'insideStartBottom':
|
|
53010
|
+
textPosition = [distanceX * dir + fromPos[0], fromPos[1] + dy];
|
|
53011
|
+
textAlign = tangent[0] < 0 ? 'right' : 'left';
|
|
53012
|
+
textOrigin = [-distanceX * dir, -dy];
|
|
53013
|
+
break;
|
|
53014
|
+
|
|
53015
|
+
case 'insideMiddleTop':
|
|
53016
|
+
case 'insideMiddle':
|
|
53017
|
+
case 'insideMiddleBottom':
|
|
53018
|
+
case 'middle':
|
|
53019
|
+
textPosition = [cp[0], cp[1] + dy];
|
|
53020
|
+
textAlign = 'center';
|
|
53021
|
+
textOrigin = [0, -dy];
|
|
53022
|
+
break;
|
|
53023
|
+
|
|
53024
|
+
case 'insideEndTop':
|
|
53025
|
+
case 'insideEnd':
|
|
53026
|
+
case 'insideEndBottom':
|
|
53027
|
+
textPosition = [-distanceX * dir + toPos[0], toPos[1] + dy];
|
|
53028
|
+
textAlign = tangent[0] >= 0 ? 'right' : 'left';
|
|
53029
|
+
textOrigin = [distanceX * dir, -dy];
|
|
53030
|
+
break;
|
|
52655
53031
|
}
|
|
53032
|
+
|
|
52656
53033
|
label.attr({
|
|
52657
53034
|
style: {
|
|
52658
53035
|
// Use the user specified text align and baseline first
|
|
@@ -52660,7 +53037,8 @@ function updateSymbolAndLabelBeforeLineUpdate() {
|
|
|
52660
53037
|
textAlign: label.__textAlign || textAlign
|
|
52661
53038
|
},
|
|
52662
53039
|
position: textPosition,
|
|
52663
|
-
scale: [invScale, invScale]
|
|
53040
|
+
scale: [invScale, invScale],
|
|
53041
|
+
origin: textOrigin
|
|
52664
53042
|
});
|
|
52665
53043
|
}
|
|
52666
53044
|
}
|
|
@@ -52836,6 +53214,12 @@ lineProto._updateCommonStl = function (lineData, idx, seriesScope) {
|
|
|
52836
53214
|
label.__verticalAlign = labelStyle.textVerticalAlign;
|
|
52837
53215
|
// 'start', 'middle', 'end'
|
|
52838
53216
|
label.__position = labelModel.get('position') || 'middle';
|
|
53217
|
+
|
|
53218
|
+
var distance$$1 = labelModel.get('distance');
|
|
53219
|
+
if (!isArray(distance$$1)) {
|
|
53220
|
+
distance$$1 = [distance$$1, distance$$1];
|
|
53221
|
+
}
|
|
53222
|
+
label.__labelDistance = distance$$1;
|
|
52839
53223
|
}
|
|
52840
53224
|
|
|
52841
53225
|
if (emphasisText != null) {
|