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
@@ -28,6 +28,11 @@ var singleAxisHelper = require("../../coord/single/singleAxisHelper");
28
28
 
29
29
  var AxisView = require("./AxisView");
30
30
 
31
+ var _axisSplitHelper = require("./axisSplitHelper");
32
+
33
+ var rectCoordAxisBuildSplitArea = _axisSplitHelper.rectCoordAxisBuildSplitArea;
34
+ var rectCoordAxisHandleRemove = _axisSplitHelper.rectCoordAxisHandleRemove;
35
+
31
36
  /*
32
37
  * Licensed to the Apache Software Foundation (ASF) under one
33
38
  * or more contributor license agreements. See the NOTICE file
@@ -47,24 +52,31 @@ var AxisView = require("./AxisView");
47
52
  * under the License.
48
53
  */
49
54
  var axisBuilderAttrs = ['axisLine', 'axisTickLabel', 'axisName'];
50
- var selfBuilderAttr = 'splitLine';
55
+ var selfBuilderAttrs = ['splitArea', 'splitLine'];
51
56
  var SingleAxisView = AxisView.extend({
52
57
  type: 'singleAxis',
53
58
  axisPointerClass: 'SingleAxisPointer',
54
59
  render: function (axisModel, ecModel, api, payload) {
55
60
  var group = this.group;
56
61
  group.removeAll();
62
+ var oldAxisGroup = this._axisGroup;
63
+ this._axisGroup = new graphic.Group();
57
64
  var layout = singleAxisHelper.layout(axisModel);
58
65
  var axisBuilder = new AxisBuilder(axisModel, layout);
59
66
  zrUtil.each(axisBuilderAttrs, axisBuilder.add, axisBuilder);
67
+ group.add(this._axisGroup);
60
68
  group.add(axisBuilder.getGroup());
61
-
62
- if (axisModel.get(selfBuilderAttr + '.show')) {
63
- this['_' + selfBuilderAttr](axisModel);
64
- }
65
-
69
+ zrUtil.each(selfBuilderAttrs, function (name) {
70
+ if (axisModel.get(name + '.show')) {
71
+ this['_' + name](axisModel);
72
+ }
73
+ }, this);
74
+ graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel);
66
75
  SingleAxisView.superCall(this, 'render', axisModel, ecModel, api, payload);
67
76
  },
77
+ remove: function () {
78
+ rectCoordAxisHandleRemove(this);
79
+ },
68
80
  _splitLine: function (axisModel) {
69
81
  var axis = axisModel.axis;
70
82
 
@@ -129,6 +141,9 @@ var SingleAxisView = AxisView.extend({
129
141
  silent: true
130
142
  }));
131
143
  }
144
+ },
145
+ _splitArea: function (axisModel) {
146
+ rectCoordAxisBuildSplitArea(this, this._axisGroup, axisModel, axisModel);
132
147
  }
133
148
  });
134
149
  var _default = SingleAxisView;
@@ -0,0 +1,132 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+ var zrUtil = require("zrender/lib/core/util");
22
+
23
+ var graphic = require("../../util/graphic");
24
+
25
+ /*
26
+ * Licensed to the Apache Software Foundation (ASF) under one
27
+ * or more contributor license agreements. See the NOTICE file
28
+ * distributed with this work for additional information
29
+ * regarding copyright ownership. The ASF licenses this file
30
+ * to you under the Apache License, Version 2.0 (the
31
+ * "License"); you may not use this file except in compliance
32
+ * with the License. You may obtain a copy of the License at
33
+ *
34
+ * http://www.apache.org/licenses/LICENSE-2.0
35
+ *
36
+ * Unless required by applicable law or agreed to in writing,
37
+ * software distributed under the License is distributed on an
38
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
39
+ * KIND, either express or implied. See the License for the
40
+ * specific language governing permissions and limitations
41
+ * under the License.
42
+ */
43
+ function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
44
+ var axis = axisModel.axis;
45
+
46
+ if (axis.scale.isBlank()) {
47
+ return;
48
+ }
49
+
50
+ var splitAreaModel = axisModel.getModel('splitArea');
51
+ var areaStyleModel = splitAreaModel.getModel('areaStyle');
52
+ var areaColors = areaStyleModel.get('color');
53
+ var gridRect = gridModel.coordinateSystem.getRect();
54
+ var ticksCoords = axis.getTicksCoords({
55
+ tickModel: splitAreaModel,
56
+ clamp: true
57
+ });
58
+
59
+ if (!ticksCoords.length) {
60
+ return;
61
+ } // For Making appropriate splitArea animation, the color and anid
62
+ // should be corresponding to previous one if possible.
63
+
64
+
65
+ var areaColorsLen = areaColors.length;
66
+ var lastSplitAreaColors = axisView.__splitAreaColors;
67
+ var newSplitAreaColors = zrUtil.createHashMap();
68
+ var colorIndex = 0;
69
+
70
+ if (lastSplitAreaColors) {
71
+ for (var i = 0; i < ticksCoords.length; i++) {
72
+ var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
73
+
74
+ if (cIndex != null) {
75
+ colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
76
+ break;
77
+ }
78
+ }
79
+ }
80
+
81
+ var prev = axis.toGlobalCoord(ticksCoords[0].coord);
82
+ var areaStyle = areaStyleModel.getAreaStyle();
83
+ areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors];
84
+
85
+ for (var i = 1; i < ticksCoords.length; i++) {
86
+ var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
87
+ var x;
88
+ var y;
89
+ var width;
90
+ var height;
91
+
92
+ if (axis.isHorizontal()) {
93
+ x = prev;
94
+ y = gridRect.y;
95
+ width = tickCoord - x;
96
+ height = gridRect.height;
97
+ prev = x + width;
98
+ } else {
99
+ x = gridRect.x;
100
+ y = prev;
101
+ width = gridRect.width;
102
+ height = tickCoord - y;
103
+ prev = y + height;
104
+ }
105
+
106
+ var tickValue = ticksCoords[i - 1].tickValue;
107
+ tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
108
+ axisGroup.add(new graphic.Rect({
109
+ anid: tickValue != null ? 'area_' + tickValue : null,
110
+ shape: {
111
+ x: x,
112
+ y: y,
113
+ width: width,
114
+ height: height
115
+ },
116
+ style: zrUtil.defaults({
117
+ fill: areaColors[colorIndex]
118
+ }, areaStyle),
119
+ silent: true
120
+ }));
121
+ colorIndex = (colorIndex + 1) % areaColorsLen;
122
+ }
123
+
124
+ axisView.__splitAreaColors = newSplitAreaColors;
125
+ }
126
+
127
+ function rectCoordAxisHandleRemove(axisView) {
128
+ axisView.__splitAreaColors = null;
129
+ }
130
+
131
+ exports.rectCoordAxisBuildSplitArea = rectCoordAxisBuildSplitArea;
132
+ exports.rectCoordAxisHandleRemove = rectCoordAxisHandleRemove;
@@ -24,6 +24,10 @@ var zrUtil = require("zrender/lib/core/util");
24
24
 
25
25
  var BrushController = require("../helper/BrushController");
26
26
 
27
+ var _visualEncoding = require("./visualEncoding");
28
+
29
+ var layoutCovers = _visualEncoding.layoutCovers;
30
+
27
31
  /*
28
32
  * Licensed to the Apache Software Foundation (ASF) under one
29
33
  * or more contributor license agreements. See the NOTICE file
@@ -81,7 +85,13 @@ var _default = echarts.extendComponentView({
81
85
  /**
82
86
  * @override
83
87
  */
84
- updateTransform: updateController,
88
+ updateTransform: function (brushModel, ecModel) {
89
+ // PENDING: `updateTransform` is a little tricky, whose layout need
90
+ // to be calculate mandatorily and other stages will not be performed.
91
+ // Take care the correctness of the logic. See #11754 .
92
+ layoutCovers(ecModel);
93
+ return updateController.apply(this, arguments);
94
+ },
85
95
 
86
96
  /**
87
97
  * @override
@@ -65,14 +65,23 @@ echarts.registerLayout(PRIORITY_BRUSH, function (ecModel, api, payload) {
65
65
  payload && payload.type === 'takeGlobalCursor' && brushModel.setBrushOption(payload.key === 'brush' ? payload.brushOption : {
66
66
  brushType: false
67
67
  });
68
+ });
69
+ layoutCovers(ecModel);
70
+ });
71
+
72
+ function layoutCovers(ecModel) {
73
+ ecModel.eachComponent({
74
+ mainType: 'brush'
75
+ }, function (brushModel) {
68
76
  var brushTargetManager = brushModel.brushTargetManager = new BrushTargetManager(brushModel.option, ecModel);
69
77
  brushTargetManager.setInputRanges(brushModel.areas, ecModel);
70
78
  });
71
- });
79
+ }
72
80
  /**
73
81
  * Register the visual encoding if this modules required.
74
82
  */
75
83
 
84
+
76
85
  echarts.registerVisual(PRIORITY_BRUSH, function (ecModel, api, payload) {
77
86
  var brushSelected = [];
78
87
  var throttleType;
@@ -314,4 +323,6 @@ var boundingRectBuilders = {
314
323
 
315
324
  function getBoundingRectFromMinMax(minMax) {
316
325
  return new BoundingRect(minMax[0][0], minMax[1][0], minMax[0][1] - minMax[0][0], minMax[1][1] - minMax[1][0]);
317
- }
326
+ }
327
+
328
+ exports.layoutCovers = layoutCovers;
@@ -206,14 +206,12 @@ MapDraw.prototype = {
206
206
 
207
207
  var regionsGroup = this._regionsGroup;
208
208
  var group = this.group;
209
-
210
- if (geo._roamTransformable.transform) {
211
- group.transform = geo._roamTransformable.transform.slice();
212
- group.decomposeTransform();
213
- }
214
-
215
- var scale = geo._rawTransformable.scale;
216
- var position = geo._rawTransformable.position;
209
+ var transformInfo = geo.getTransformInfo();
210
+ group.transform = transformInfo.roamTransform;
211
+ group.decomposeTransform();
212
+ group.dirty();
213
+ var scale = transformInfo.rawScale;
214
+ var position = transformInfo.rawPosition;
217
215
  regionsGroup.removeAll();
218
216
  var itemStyleAccessPath = ['itemStyle'];
219
217
  var hoverItemStyleAccessPath = ['emphasis', 'itemStyle'];
@@ -418,28 +418,28 @@ var ScrollableLegendView = LegendView.extend({
418
418
  }
419
419
  },
420
420
  _findTargetItemIndex: function (targetDataIndex) {
421
+ if (!this._showController) {
422
+ return 0;
423
+ }
424
+
421
425
  var index;
422
426
  var contentGroup = this.getContentGroup();
423
427
  var defaultIndex;
428
+ contentGroup.eachChild(function (child, idx) {
429
+ var legendDataIdx = child.__legendDataIndex; // FIXME
430
+ // If the given targetDataIndex (from model) is illegal,
431
+ // we use defualtIndex. But the index on the legend model and
432
+ // action payload is still illegal. That case will not be
433
+ // changed until some scenario requires.
434
+
435
+ if (defaultIndex == null && legendDataIdx != null) {
436
+ defaultIndex = idx;
437
+ }
424
438
 
425
- if (this._showController) {
426
- contentGroup.eachChild(function (child, idx) {
427
- var legendDataIdx = child.__legendDataIndex; // FIXME
428
- // If the given targetDataIndex (from model) is illegal,
429
- // we use defualtIndex. But the index on the legend model and
430
- // action payload is still illegal. That case will not be
431
- // changed until some scenario requires.
432
-
433
- if (defaultIndex == null && legendDataIdx != null) {
434
- defaultIndex = idx;
435
- }
436
-
437
- if (legendDataIdx === targetDataIndex) {
438
- index = idx;
439
- }
440
- });
441
- }
442
-
439
+ if (legendDataIdx === targetDataIndex) {
440
+ index = idx;
441
+ }
442
+ });
443
443
  return index != null ? index : defaultIndex;
444
444
  }
445
445
  });
@@ -52,7 +52,8 @@ var _default = MarkerModel.extend({
52
52
  },
53
53
  label: {
54
54
  show: true,
55
- position: 'end'
55
+ position: 'end',
56
+ distance: 5
56
57
  },
57
58
  lineStyle: {
58
59
  type: 'dashed'
@@ -85,7 +85,8 @@ function markerTypeCalculatorWithExtent(mlType, data, otherDataDim, targetDataDi
85
85
  var value = numCalculate(data, calcDataDim, mlType);
86
86
  var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];
87
87
  coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);
88
- coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex); // Make it simple, do not visit all stacked value to count precision.
88
+ coordArr[targetCoordIndex] = data.get(calcDataDim, dataIndex);
89
+ var coordArrValue = data.get(targetDataDim, dataIndex); // Make it simple, do not visit all stacked value to count precision.
89
90
 
90
91
  var precision = numberUtil.getPrecision(data.get(targetDataDim, dataIndex));
91
92
  precision = Math.min(precision, 20);
@@ -94,7 +95,7 @@ function markerTypeCalculatorWithExtent(mlType, data, otherDataDim, targetDataDi
94
95
  coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
95
96
  }
96
97
 
97
- return coordArr;
98
+ return [coordArr, coordArrValue];
98
99
  }
99
100
 
100
101
  var curry = zrUtil.curry; // TODO Specified percent
@@ -151,9 +152,11 @@ function dataTransform(seriesModel, item) {
151
152
  if (item.type && markerTypeCalculator[item.type] && axisInfo.baseAxis && axisInfo.valueAxis) {
152
153
  var otherCoordIndex = indexOf(dims, axisInfo.baseAxis.dim);
153
154
  var targetCoordIndex = indexOf(dims, axisInfo.valueAxis.dim);
154
- item.coord = markerTypeCalculator[item.type](data, axisInfo.baseDataDim, axisInfo.valueDataDim, otherCoordIndex, targetCoordIndex); // Force to use the value of calculated value.
155
+ var coordInfo = markerTypeCalculator[item.type](data, axisInfo.baseDataDim, axisInfo.valueDataDim, otherCoordIndex, targetCoordIndex);
156
+ item.coord = coordInfo[0]; // Force to use the value of calculated value.
157
+ // let item use the value without stack.
155
158
 
156
- item.value = item.coord[targetCoordIndex];
159
+ item.value = coordInfo[1];
157
160
  } else {
158
161
  // FIXME Only has one of xAxis and yAxis.
159
162
  var coord = [item.xAxis != null ? item.xAxis : item.radiusAxis, item.yAxis != null ? item.yAxis : item.angleAxis]; // Each coord support max, min, average
@@ -24,6 +24,8 @@ var zrColor = require("zrender/lib/tool/color");
24
24
 
25
25
  var eventUtil = require("zrender/lib/core/event");
26
26
 
27
+ var domUtil = require("zrender/lib/core/dom");
28
+
27
29
  var env = require("zrender/lib/core/env");
28
30
 
29
31
  var formatUtil = require("../../util/format");
@@ -124,24 +126,65 @@ function assembleCssText(tooltipModel) {
124
126
  }
125
127
 
126
128
  return cssText.join(';') + ';';
129
+ } // If not able to make, do not modify the input `out`.
130
+
131
+
132
+ function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
133
+ var zrPainter = zr && zr.painter;
134
+
135
+ if (appendToBody) {
136
+ var zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
137
+
138
+ if (zrViewportRoot) {
139
+ // Some APPs might use scale on body, so we support CSS transform here.
140
+ domUtil.transformLocalCoord(out, zrViewportRoot, document.body, zrX, zrY);
141
+ }
142
+ } else {
143
+ out[0] = zrX;
144
+ out[1] = zrY; // xy should be based on canvas root. But tooltipContent is
145
+ // the sibling of canvas root. So padding of ec container
146
+ // should be considered here.
147
+
148
+ var viewportRootOffset = zrPainter && zrPainter.getViewportRootOffset();
149
+
150
+ if (viewportRootOffset) {
151
+ out[0] += viewportRootOffset.offsetLeft;
152
+ out[1] += viewportRootOffset.offsetTop;
153
+ }
154
+ }
127
155
  }
128
156
  /**
129
157
  * @alias module:echarts/component/tooltip/TooltipContent
158
+ * @param {HTMLElement} container
159
+ * @param {ExtensionAPI} api
160
+ * @param {Object} [opt]
161
+ * @param {boolean} [opt.appendToBody]
162
+ * `false`: the DOM element will be inside the container. Default value.
163
+ * `true`: the DOM element will be appended to HTML body, which avoid
164
+ * some overflow clip but intrude outside of the container.
130
165
  * @constructor
131
166
  */
132
167
 
133
168
 
134
- function TooltipContent(container, api) {
169
+ function TooltipContent(container, api, opt) {
135
170
  if (env.wxa) {
136
171
  return null;
137
172
  }
138
173
 
139
174
  var el = document.createElement('div');
140
- var zr = this._zr = api.getZr();
175
+ el.domBelongToZr = true;
141
176
  this.el = el;
142
- this._x = api.getWidth() / 2;
143
- this._y = api.getHeight() / 2;
144
- container.appendChild(el);
177
+ var zr = this._zr = api.getZr();
178
+ var appendToBody = this._appendToBody = opt && opt.appendToBody;
179
+ this._styleCoord = [0, 0];
180
+ makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
181
+
182
+ if (appendToBody) {
183
+ document.body.appendChild(el);
184
+ } else {
185
+ container.appendChild(el);
186
+ }
187
+
145
188
  this._container = container;
146
189
  this._show = false;
147
190
  /**
@@ -175,7 +218,8 @@ function TooltipContent(container, api) {
175
218
  // Try trigger zrender event to avoid mouse
176
219
  // in and out shape too frequently
177
220
  var handler = zr.handler;
178
- eventUtil.normalizeEvent(container, e, true);
221
+ var zrViewportRoot = zr.painter.getViewportRoot();
222
+ eventUtil.normalizeEvent(zrViewportRoot, e, true);
179
223
  handler.dispatch('mousemove', e);
180
224
  }
181
225
  };
@@ -220,10 +264,11 @@ TooltipContent.prototype = {
220
264
  show: function (tooltipModel) {
221
265
  clearTimeout(this._hideTimeout);
222
266
  var el = this.el;
267
+ var styleCoord = this._styleCoord;
223
268
  el.style.cssText = gCssText + assembleCssText(tooltipModel) // Because of the reason described in:
224
269
  // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore
225
270
  // we should set initial value to `left` and `top`.
226
- + ';left:' + this._x + 'px;top:' + this._y + 'px;' + (tooltipModel.get('extraCssText') || '');
271
+ + ';left:' + styleCoord[0] + 'px;top:' + styleCoord[1] + 'px;' + (tooltipModel.get('extraCssText') || '');
227
272
  el.style.display = el.innerHTML ? 'block' : 'none'; // If mouse occsionally move over the tooltip, a mouseout event will be
228
273
  // triggered by canvas, and cuase some unexpectable result like dragging
229
274
  // stop, "unfocusAdjacency". Here `pointer-events: none` is used to solve
@@ -243,23 +288,12 @@ TooltipContent.prototype = {
243
288
  var el = this.el;
244
289
  return [el.clientWidth, el.clientHeight];
245
290
  },
246
- moveTo: function (x, y) {
247
- // xy should be based on canvas root. But tooltipContent is
248
- // the sibling of canvas root. So padding of ec container
249
- // should be considered here.
250
- var zr = this._zr;
251
- var viewportRootOffset;
252
-
253
- if (zr && zr.painter && (viewportRootOffset = zr.painter.getViewportRootOffset())) {
254
- x += viewportRootOffset.offsetLeft;
255
- y += viewportRootOffset.offsetTop;
256
- }
257
-
291
+ moveTo: function (zrX, zrY) {
292
+ var styleCoord = this._styleCoord;
293
+ makeStyleCoord(styleCoord, this._zr, this._appendToBody, zrX, zrY);
258
294
  var style = this.el.style;
259
- style.left = x + 'px';
260
- style.top = y + 'px';
261
- this._x = x;
262
- this._y = y;
295
+ style.left = styleCoord[0] + 'px';
296
+ style.top = styleCoord[1] + 'px';
263
297
  },
264
298
  hide: function () {
265
299
  this.el.style.display = 'none';
@@ -280,6 +314,9 @@ TooltipContent.prototype = {
280
314
  isShow: function () {
281
315
  return this._show;
282
316
  },
317
+ dispose: function () {
318
+ this.el.parentNode.removeChild(this.el);
319
+ },
283
320
  getOuterSize: function () {
284
321
  var width = this.el.clientWidth;
285
322
  var height = this.el.clientHeight; // Consider browser compatibility.
@@ -93,7 +93,9 @@ var _default = echarts.extendComponentView({
93
93
  var tooltipContent;
94
94
 
95
95
  if (this._renderMode === 'html') {
96
- tooltipContent = new TooltipContent(api.getDom(), api);
96
+ tooltipContent = new TooltipContent(api.getDom(), api, {
97
+ appendToBody: tooltipModel.get('appendToBody', true)
98
+ });
97
99
  this._newLine = '<br/>';
98
100
  } else {
99
101
  tooltipContent = new TooltipRichContent(api);
@@ -228,7 +230,6 @@ var _default = echarts.extendComponentView({
228
230
  offsetX: payload.x,
229
231
  offsetY: payload.y,
230
232
  position: payload.position,
231
- event: {},
232
233
  dataByCoordSys: payload.dataByCoordSys,
233
234
  tooltipOption: payload.tooltipOption
234
235
  }, dispatchAction);
@@ -246,8 +247,7 @@ var _default = echarts.extendComponentView({
246
247
  offsetX: cx,
247
248
  offsetY: cy,
248
249
  position: payload.position,
249
- target: pointInfo.el,
250
- event: {}
250
+ target: pointInfo.el
251
251
  }, dispatchAction);
252
252
  }
253
253
  } else if (payload.x != null && payload.y != null) {
@@ -263,8 +263,7 @@ var _default = echarts.extendComponentView({
263
263
  offsetX: payload.x,
264
264
  offsetY: payload.y,
265
265
  position: payload.position,
266
- target: api.getZr().findHover(payload.x, payload.y).target,
267
- event: {}
266
+ target: api.getZr().findHover(payload.x, payload.y).target
268
267
  }, dispatchAction);
269
268
  }
270
269
  },
@@ -658,7 +657,7 @@ var _default = echarts.extendComponentView({
658
657
  return;
659
658
  }
660
659
 
661
- this._tooltipContent.hide();
660
+ this._tooltipContent.dispose();
662
661
 
663
662
  globalListener.unregister('itemTooltip', api);
664
663
  }
package/lib/coord/View.js CHANGED
@@ -230,6 +230,15 @@ View.prototype = {
230
230
  matrix.invert(this.invTransform, this.transform);
231
231
  this.decomposeTransform();
232
232
  },
233
+ getTransformInfo: function () {
234
+ var roamTransform = this._roamTransformable.transform;
235
+ var rawTransformable = this._rawTransformable;
236
+ return {
237
+ roamTransform: roamTransform ? zrUtil.slice(roamTransform) : matrix.create(),
238
+ rawScale: zrUtil.slice(rawTransformable.scale),
239
+ rawPosition: zrUtil.slice(rawTransformable.position)
240
+ };
241
+ },
233
242
 
234
243
  /**
235
244
  * @return {module:zrender/core/BoundingRect}
@@ -247,12 +247,12 @@ Radar.prototype.update = function (ecModel, api) {
247
247
 
248
248
  if (nicedSplitNumber > splitNumber) {
249
249
  interval = increaseInterval(interval);
250
- } // PENDING
250
+ } // TODO
251
251
 
252
252
 
253
- var center = Math.round((rawExtent[0] + rawExtent[1]) / 2 / interval) * interval;
254
- var halfSplitNumber = Math.round(splitNumber / 2);
255
- scale.setExtent(numberUtil.round(center - halfSplitNumber * interval), numberUtil.round(center + (splitNumber - halfSplitNumber) * interval));
253
+ var max = Math.ceil(rawExtent[1] / interval) * interval;
254
+ var min = numberUtil.round(max - interval * splitNumber);
255
+ scale.setExtent(min, max);
256
256
  scale.setInterval(interval);
257
257
  }
258
258
  });
package/lib/echarts.js CHANGED
@@ -101,9 +101,9 @@ var each = zrUtil.each;
101
101
  var isFunction = zrUtil.isFunction;
102
102
  var isObject = zrUtil.isObject;
103
103
  var parseClassType = ComponentModel.parseClassType;
104
- var version = '4.6.0';
104
+ var version = '4.7.0';
105
105
  var dependencies = {
106
- zrender: '4.2.0'
106
+ zrender: '4.3.0'
107
107
  };
108
108
  var TEST_FRAME_REMAIN_TIME = 1;
109
109
  var PRIORITY_PROCESSOR_FILTER = 1000;