echarts 4.8.0 → 4.9.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 (145) hide show
  1. package/.DS_Store +0 -0
  2. package/.gitattributes +3 -0
  3. package/.github/workflows/nodejs.yml +3 -1
  4. package/.huskyrc +5 -0
  5. package/README.md +1 -1
  6. package/asset/.DS_Store +0 -0
  7. package/build/.DS_Store +0 -0
  8. package/dist/echarts-en.common.js +284 -93
  9. package/dist/echarts-en.common.min.js +1 -1
  10. package/dist/echarts-en.js +816 -284
  11. package/dist/echarts-en.js.map +1 -1
  12. package/dist/echarts-en.min.js +1 -1
  13. package/dist/echarts-en.simple.js +60 -26
  14. package/dist/echarts-en.simple.min.js +1 -1
  15. package/dist/echarts.common.js +284 -93
  16. package/dist/echarts.common.min.js +1 -1
  17. package/dist/echarts.js +816 -284
  18. package/dist/echarts.js.map +1 -1
  19. package/dist/echarts.min.js +1 -1
  20. package/dist/echarts.simple.js +60 -26
  21. package/dist/echarts.simple.min.js +1 -1
  22. package/dist/extension/bmap.js +33 -345
  23. package/dist/extension/bmap.js.map +1 -1
  24. package/dist/extension/bmap.min.js +1 -1
  25. package/dist/extension/dataTool.js.map +1 -1
  26. package/extension/.DS_Store +0 -0
  27. package/extension/bmap/BMapCoordSys.js +14 -4
  28. package/extension/bmap/BMapModel.js +4 -0
  29. package/extension/bmap/BMapView.js +18 -14
  30. package/extension-src/bmap/BMapCoordSys.js +14 -4
  31. package/extension-src/bmap/BMapModel.js +6 -1
  32. package/extension-src/bmap/BMapView.js +16 -10
  33. package/lib/chart/bar/BarView.js +49 -16
  34. package/lib/chart/bar/PictorialBarSeries.js +1 -1
  35. package/lib/chart/funnel/FunnelSeries.js +1 -0
  36. package/lib/chart/funnel/funnelLayout.js +162 -46
  37. package/lib/chart/graph/GraphSeries.js +12 -2
  38. package/lib/chart/graph/circularLayoutHelper.js +8 -2
  39. package/lib/chart/graph/forceLayout.js +6 -1
  40. package/lib/chart/graph/simpleLayout.js +1 -1
  41. package/lib/chart/graph/simpleLayoutHelper.js +10 -4
  42. package/lib/chart/helper/Line.js +35 -9
  43. package/lib/chart/helper/Symbol.js +1 -1
  44. package/lib/chart/helper/multipleGraphEdgeHelper.js +258 -0
  45. package/lib/chart/lines/LinesSeries.js +0 -2
  46. package/lib/chart/map/MapSeries.js +3 -2
  47. package/lib/chart/radar/RadarSeries.js +4 -3
  48. package/lib/chart/radar/RadarView.js +3 -1
  49. package/lib/chart/sunburst/SunburstPiece.js +4 -1
  50. package/lib/chart/sunburst/SunburstSeries.js +17 -5
  51. package/lib/chart/themeRiver/ThemeRiverSeries.js +21 -30
  52. package/lib/chart/tree/TreeSeries.js +1 -1
  53. package/lib/chart/tree/TreeView.js +4 -4
  54. package/lib/chart/treemap/TreemapSeries.js +14 -5
  55. package/lib/chart/treemap/treemapLayout.js +1 -1
  56. package/lib/chart/treemap/treemapVisual.js +9 -15
  57. package/lib/component/axisPointer/axisTrigger.js +1 -1
  58. package/lib/component/legend/ScrollableLegendView.js +1 -1
  59. package/lib/component/marker/MarkAreaView.js +53 -15
  60. package/lib/component/marker/MarkLineView.js +3 -0
  61. package/lib/component/marker/MarkPointView.js +8 -1
  62. package/lib/component/marker/MarkerModel.js +3 -2
  63. package/lib/component/timeline/SliderTimelineView.js +7 -1
  64. package/lib/component/title.js +1 -1
  65. package/lib/component/toolbox/feature/DataView.js +23 -8
  66. package/lib/component/toolbox/feature/DataZoom.js +6 -6
  67. package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
  68. package/lib/component/tooltip/TooltipContent.js +42 -8
  69. package/lib/component/tooltip/TooltipRichContent.js +56 -8
  70. package/lib/component/tooltip/TooltipView.js +4 -4
  71. package/lib/component/visualMap/VisualMapModel.js +1 -1
  72. package/lib/coord/axisDefault.js +1 -1
  73. package/lib/coord/axisHelper.js +2 -2
  74. package/lib/coord/geo/GeoModel.js +2 -1
  75. package/lib/data/Graph.js +1 -6
  76. package/lib/data/List.js +1 -1
  77. package/lib/data/Tree.js +4 -31
  78. package/lib/echarts.js +2 -2
  79. package/lib/layout/barPolar.js +1 -1
  80. package/lib/processor/dataSample.js +1 -1
  81. package/lib/stream/Scheduler.js +1 -1
  82. package/lib/visual/VisualMapping.js +1 -1
  83. package/map/.DS_Store +0 -0
  84. package/map/js/.DS_Store +0 -0
  85. package/map/js/province/.DS_Store +0 -0
  86. package/map/json/.DS_Store +0 -0
  87. package/package.json +3 -2
  88. package/src/.DS_Store +0 -0
  89. package/src/chart/.DS_Store +0 -0
  90. package/src/chart/bar/BarView.js +50 -16
  91. package/src/chart/bar/PictorialBarSeries.js +2 -2
  92. package/src/chart/funnel/FunnelSeries.js +1 -0
  93. package/src/chart/funnel/funnelLayout.js +179 -53
  94. package/src/chart/graph/GraphSeries.js +9 -3
  95. package/src/chart/graph/circularLayoutHelper.js +8 -2
  96. package/src/chart/graph/forceLayout.js +7 -1
  97. package/src/chart/graph/simpleLayout.js +1 -1
  98. package/src/chart/graph/simpleLayoutHelper.js +12 -5
  99. package/src/chart/helper/Line.js +38 -11
  100. package/src/chart/helper/Symbol.js +2 -2
  101. package/src/chart/helper/createGraphFromNodeEdge.js +2 -1
  102. package/src/chart/helper/multipleGraphEdgeHelper.js +229 -0
  103. package/src/chart/lines/LinesSeries.js +1 -3
  104. package/src/chart/map/MapSeries.js +3 -2
  105. package/src/chart/radar/RadarSeries.js +4 -3
  106. package/src/chart/radar/RadarView.js +4 -2
  107. package/src/chart/sunburst/SunburstPiece.js +5 -1
  108. package/src/chart/sunburst/SunburstSeries.js +16 -8
  109. package/src/chart/themeRiver/ThemeRiverSeries.js +21 -27
  110. package/src/chart/tree/TreeSeries.js +1 -1
  111. package/src/chart/tree/TreeView.js +3 -3
  112. package/src/chart/treemap/TreemapSeries.js +11 -3
  113. package/src/chart/treemap/treemapLayout.js +2 -2
  114. package/src/chart/treemap/treemapVisual.js +8 -25
  115. package/src/component/axisPointer/axisTrigger.js +1 -1
  116. package/src/component/legend/ScrollableLegendView.js +1 -1
  117. package/src/component/marker/MarkAreaView.js +53 -15
  118. package/src/component/marker/MarkLineView.js +3 -1
  119. package/src/component/marker/MarkPointView.js +7 -1
  120. package/src/component/marker/MarkerModel.js +3 -2
  121. package/src/component/timeline/SliderTimelineView.js +9 -6
  122. package/src/component/title.js +2 -2
  123. package/src/component/toolbox/.DS_Store +0 -0
  124. package/src/component/toolbox/feature/DataView.js +20 -8
  125. package/src/component/toolbox/feature/DataZoom.js +6 -6
  126. package/src/component/toolbox/feature/SaveAsImage.js +2 -1
  127. package/src/component/tooltip/TooltipContent.js +36 -7
  128. package/src/component/tooltip/TooltipRichContent.js +52 -9
  129. package/src/component/tooltip/TooltipView.js +4 -4
  130. package/src/component/visualMap/VisualMapModel.js +1 -1
  131. package/src/coord/axisDefault.js +1 -1
  132. package/src/coord/axisHelper.js +4 -2
  133. package/src/coord/geo/GeoModel.js +3 -6
  134. package/src/data/Graph.js +0 -5
  135. package/src/data/List.js +1 -1
  136. package/src/data/Tree.js +4 -32
  137. package/src/echarts.js +2 -2
  138. package/src/layout/barPolar.js +4 -2
  139. package/src/model/.DS_Store +0 -0
  140. package/src/preprocessor/.DS_Store +0 -0
  141. package/src/processor/dataSample.js +1 -1
  142. package/src/stream/Scheduler.js +1 -1
  143. package/src/util/.DS_Store +0 -0
  144. package/src/visual/VisualMapping.js +1 -1
  145. package/theme/.DS_Store +0 -0
@@ -212,32 +212,70 @@ MarkerView.extend({
212
212
 
213
213
  areaData.each(function (idx) {
214
214
  // Layout
215
- areaData.setItemLayout(idx, zrUtil.map(dimPermutations, function (dim) {
215
+ var points = zrUtil.map(dimPermutations, function (dim) {
216
216
  return getSingleMarkerEndPoint(areaData, idx, dim, seriesModel, api);
217
- })); // Visual
217
+ }); // If none of the area is inside coordSys, allClipped is set to be true
218
+ // in layout so that label will not be displayed. See #12591
219
+
220
+ var allClipped = true;
221
+ zrUtil.each(dimPermutations, function (dim) {
222
+ if (!allClipped) {
223
+ return;
224
+ }
225
+
226
+ var xValue = areaData.get(dim[0], idx);
227
+ var yValue = areaData.get(dim[1], idx); // If is infinity, the axis should be considered not clipped
228
+
229
+ if ((isInifinity(xValue) || coordSys.getAxis('x').containData(xValue)) && (isInifinity(yValue) || coordSys.getAxis('y').containData(yValue))) {
230
+ allClipped = false;
231
+ }
232
+ });
233
+ areaData.setItemLayout(idx, {
234
+ points: points,
235
+ allClipped: allClipped
236
+ }); // Visual
218
237
 
219
238
  areaData.setItemVisual(idx, {
220
239
  color: seriesData.getVisual('color')
221
240
  });
222
241
  });
223
242
  areaData.diff(polygonGroup.__data).add(function (idx) {
224
- var polygon = new graphic.Polygon({
225
- shape: {
226
- points: areaData.getItemLayout(idx)
227
- }
228
- });
229
- areaData.setItemGraphicEl(idx, polygon);
230
- polygonGroup.group.add(polygon);
243
+ var layout = areaData.getItemLayout(idx);
244
+
245
+ if (!layout.allClipped) {
246
+ var polygon = new graphic.Polygon({
247
+ shape: {
248
+ points: layout.points
249
+ }
250
+ });
251
+ areaData.setItemGraphicEl(idx, polygon);
252
+ polygonGroup.group.add(polygon);
253
+ }
231
254
  }).update(function (newIdx, oldIdx) {
232
255
  var polygon = polygonGroup.__data.getItemGraphicEl(oldIdx);
233
256
 
234
- graphic.updateProps(polygon, {
235
- shape: {
236
- points: areaData.getItemLayout(newIdx)
257
+ var layout = areaData.getItemLayout(newIdx);
258
+
259
+ if (!layout.allClipped) {
260
+ if (polygon) {
261
+ graphic.updateProps(polygon, {
262
+ shape: {
263
+ points: layout.points
264
+ }
265
+ }, maModel, newIdx);
266
+ } else {
267
+ polygon = new graphic.Polygon({
268
+ shape: {
269
+ points: layout.points
270
+ }
271
+ });
237
272
  }
238
- }, maModel, newIdx);
239
- polygonGroup.group.add(polygon);
240
- areaData.setItemGraphicEl(newIdx, polygon);
273
+
274
+ areaData.setItemGraphicEl(newIdx, polygon);
275
+ polygonGroup.group.add(polygon);
276
+ } else if (polygon) {
277
+ polygonGroup.group.remove(polygon);
278
+ }
241
279
  }).remove(function (idx) {
242
280
  var polygon = polygonGroup.__data.getItemGraphicEl(idx);
243
281
 
@@ -278,8 +278,10 @@ var _default = MarkerView.extend({
278
278
  });
279
279
  lineData.setItemLayout(idx, [fromData.getItemLayout(idx), toData.getItemLayout(idx)]);
280
280
  lineData.setItemVisual(idx, {
281
+ 'fromSymbolRotate': fromData.getItemVisual(idx, 'symbolRotate'),
281
282
  'fromSymbolSize': fromData.getItemVisual(idx, 'symbolSize'),
282
283
  'fromSymbol': fromData.getItemVisual(idx, 'symbol'),
284
+ 'toSymbolRotate': toData.getItemVisual(idx, 'symbolRotate'),
283
285
  'toSymbolSize': toData.getItemVisual(idx, 'symbolSize'),
284
286
  'toSymbol': toData.getItemVisual(idx, 'symbol')
285
287
  });
@@ -297,6 +299,7 @@ var _default = MarkerView.extend({
297
299
  var itemModel = data.getItemModel(idx);
298
300
  updateSingleMarkerEndLayout(data, idx, isFrom, seriesModel, api);
299
301
  data.setItemVisual(idx, {
302
+ symbolRotate: itemModel.get('symbolRotate'),
300
303
  symbolSize: itemModel.get('symbolSize') || symbolSize[isFrom ? 0 : 1],
301
304
  symbol: itemModel.get('symbol', true) || symbolType[isFrom ? 0 : 1],
302
305
  color: itemModel.get('itemStyle.color') || seriesData.getVisual('color')
@@ -116,10 +116,12 @@ var _default = MarkerView.extend({
116
116
  var itemModel = mpData.getItemModel(idx);
117
117
  var symbol = itemModel.getShallow('symbol');
118
118
  var symbolSize = itemModel.getShallow('symbolSize');
119
+ var symbolRotate = itemModel.getShallow('symbolRotate');
119
120
  var isFnSymbol = zrUtil.isFunction(symbol);
120
121
  var isFnSymbolSize = zrUtil.isFunction(symbolSize);
122
+ var isFnSymbolRotate = zrUtil.isFunction(symbolRotate);
121
123
 
122
- if (isFnSymbol || isFnSymbolSize) {
124
+ if (isFnSymbol || isFnSymbolSize || isFnSymbolRotate) {
123
125
  var rawIdx = mpModel.getRawValue(idx);
124
126
  var dataParams = mpModel.getDataParams(idx);
125
127
 
@@ -131,11 +133,16 @@ var _default = MarkerView.extend({
131
133
  // FIXME 这里不兼容 ECharts 2.x,2.x 貌似参数是整个数据?
132
134
  symbolSize = symbolSize(rawIdx, dataParams);
133
135
  }
136
+
137
+ if (isFnSymbolRotate) {
138
+ symbolRotate = symbolRotate(rawIdx, dataParams);
139
+ }
134
140
  }
135
141
 
136
142
  mpData.setItemVisual(idx, {
137
143
  symbol: symbol,
138
144
  symbolSize: symbolSize,
145
+ symbolRotate: symbolRotate,
139
146
  color: itemModel.get('itemStyle.color') || seriesData.getVisual('color')
140
147
  });
141
148
  }); // TODO Text are wrong
@@ -136,15 +136,16 @@ var MarkerModel = echarts.extendComponentModel({
136
136
  }, this);
137
137
  }
138
138
  },
139
- formatTooltip: function (dataIndex) {
139
+ formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
140
140
  var data = this.getData();
141
141
  var value = this.getRawValue(dataIndex);
142
142
  var formattedValue = zrUtil.isArray(value) ? zrUtil.map(value, addCommas).join(', ') : addCommas(value);
143
143
  var name = data.getName(dataIndex);
144
144
  var html = encodeHTML(this.name);
145
+ var newLine = renderMode === 'html' ? '<br/>' : '\n';
145
146
 
146
147
  if (value != null || name) {
147
- html += '<br />';
148
+ html += newLine;
148
149
  }
149
150
 
150
151
  if (name) {
@@ -571,7 +571,13 @@ function getViewRect(model, api) {
571
571
  }
572
572
 
573
573
  function makeIcon(timelineModel, objPath, rect, opts) {
574
- var icon = graphic.makePath(timelineModel.get(objPath).replace(/^path:\/\//, ''), zrUtil.clone(opts || {}), new BoundingRect(rect[0], rect[1], rect[2], rect[3]), 'center');
574
+ var style = opts.style;
575
+ var icon = graphic.createIcon(timelineModel.get(objPath), opts || {}, new BoundingRect(rect[0], rect[1], rect[2], rect[3])); // TODO createIcon won't use style in opt.
576
+
577
+ if (style) {
578
+ icon.setStyle(style);
579
+ }
580
+
575
581
  return icon;
576
582
  }
577
583
  /**
@@ -160,7 +160,7 @@ echarts.extendComponentView({
160
160
 
161
161
  if (sublink) {
162
162
  subTextEl.on('click', function () {
163
- windowOpen(link, '_' + titleModel.get('subtarget'));
163
+ windowOpen(sublink, '_' + titleModel.get('subtarget'));
164
164
  });
165
165
  }
166
166
 
@@ -116,7 +116,8 @@ function assembleSeriesWithCategoryAxis(series) {
116
116
  }));
117
117
  var columns = [categoryAxis.model.getCategories()];
118
118
  zrUtil.each(group.series, function (series) {
119
- columns.push(series.getRawData().mapArray(valueAxisDim, function (val) {
119
+ var rawData = series.getRawData();
120
+ columns.push(series.getRawData().mapArray(rawData.mapDimension(valueAxisDim), function (val) {
120
121
  return val;
121
122
  }));
122
123
  }); // Assemble table content
@@ -242,7 +243,15 @@ function parseListContents(str) {
242
243
  var data = [];
243
244
 
244
245
  for (var i = 0; i < lines.length; i++) {
245
- var items = trim(lines[i]).split(itemSplitRegex);
246
+ // if line is empty, ignore it.
247
+ // there is a case that a user forgot to delete `\n`.
248
+ var line = trim(lines[i]);
249
+
250
+ if (!line) {
251
+ continue;
252
+ }
253
+
254
+ var items = line.split(itemSplitRegex);
246
255
  var name = '';
247
256
  var value;
248
257
  var hasName = false;
@@ -449,14 +458,20 @@ function tryMergeDataOption(newData, originalData) {
449
458
  var original = originalData && originalData[idx];
450
459
 
451
460
  if (zrUtil.isObject(original) && !zrUtil.isArray(original)) {
452
- if (zrUtil.isObject(newVal) && !zrUtil.isArray(newVal)) {
453
- newVal = newVal.value;
454
- } // Original data has option
461
+ var newValIsObject = zrUtil.isObject(newVal) && !zrUtil.isArray(newVal);
455
462
 
463
+ if (!newValIsObject) {
464
+ newVal = {
465
+ value: newVal
466
+ };
467
+ } // original data has name but new data has no name
456
468
 
457
- return zrUtil.defaults({
458
- value: newVal
459
- }, original);
469
+
470
+ var shouldDeleteName = original.name != null && newVal.name == null; // Original data has option
471
+
472
+ newVal = zrUtil.defaults(newVal, original);
473
+ shouldDeleteName && delete newVal.name;
474
+ return newVal;
460
475
  } else {
461
476
  return newVal;
462
477
  }
@@ -83,7 +83,11 @@ DataZoom.defaultOption = {
83
83
  back: 'M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26'
84
84
  },
85
85
  // `zoom`, `back`
86
- title: zrUtil.clone(dataZoomLang.title)
86
+ title: zrUtil.clone(dataZoomLang.title),
87
+ brushStyle: {
88
+ borderWidth: 0,
89
+ color: 'rgba(0,0,0,0.2)'
90
+ }
87
91
  };
88
92
  var proto = DataZoom.prototype;
89
93
 
@@ -243,11 +247,7 @@ function updateZoomBtnStatus(featureModel, ecModel, view, payload, api) {
243
247
  return targetInfo.xAxisDeclared && !targetInfo.yAxisDeclared ? 'lineX' : !targetInfo.xAxisDeclared && targetInfo.yAxisDeclared ? 'lineY' : 'rect';
244
248
  })).enableBrush(zoomActive ? {
245
249
  brushType: 'auto',
246
- brushStyle: {
247
- // FIXME user customized?
248
- lineWidth: 0,
249
- fill: 'rgba(0,0,0,0.2)'
250
- }
250
+ brushStyle: featureModel.getModel('brushStyle').getItemStyle()
251
251
  } : false);
252
252
  }
253
253
 
@@ -85,7 +85,8 @@ proto.onclick = function (ecModel, api) {
85
85
  $a.target = '_blank';
86
86
  $a.href = url;
87
87
  var evt = new MouseEvent('click', {
88
- view: window,
88
+ // some micro front-end framework, window maybe is a Proxy
89
+ view: document.defaultView,
89
90
  bubbles: true,
90
91
  cancelable: false
91
92
  });
@@ -78,7 +78,18 @@ function assembleFont(textStyleModel) {
78
78
  var color = textStyleModel.getTextColor();
79
79
  color && cssText.push('color:' + color);
80
80
  cssText.push('font:' + textStyleModel.getFont());
81
- fontSize && cssText.push('line-height:' + Math.round(fontSize * 3 / 2) + 'px');
81
+ var lineHeight = textStyleModel.get('lineHeight');
82
+
83
+ if (lineHeight == null) {
84
+ lineHeight = Math.round(fontSize * 3 / 2);
85
+ }
86
+
87
+ fontSize && cssText.push('line-height:' + lineHeight + 'px');
88
+ var shadowColor = textStyleModel.get('textShadowColor');
89
+ var shadowBlur = textStyleModel.get('textShadowBlur') || 0;
90
+ var shadowOffsetX = textStyleModel.get('textShadowOffsetX') || 0;
91
+ var shadowOffsetY = textStyleModel.get('textShadowOffsetY') || 0;
92
+ shadowBlur && cssText.push('text-shadow:' + shadowOffsetX + 'px ' + shadowOffsetY + 'px ' + shadowBlur + 'px ' + shadowColor);
82
93
  each(['decoration', 'align'], function (name) {
83
94
  var val = textStyleModel.get(name);
84
95
  val && cssText.push('text-' + name + ':' + val);
@@ -152,6 +163,10 @@ function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
152
163
  out[1] += viewportRootOffset.offsetTop;
153
164
  }
154
165
  }
166
+
167
+ out[2] = out[0] / zr.getWidth(); // The ratio of left to width
168
+
169
+ out[3] = out[1] / zr.getHeight(); // The ratio of top to height
155
170
  }
156
171
  /**
157
172
  * @alias module:echarts/component/tooltip/TooltipContent
@@ -176,7 +191,8 @@ function TooltipContent(container, api, opt) {
176
191
  this.el = el;
177
192
  var zr = this._zr = api.getZr();
178
193
  var appendToBody = this._appendToBody = opt && opt.appendToBody;
179
- this._styleCoord = [0, 0];
194
+ this._styleCoord = [0, 0, 0, 0]; // [left, top, left/width, top/height]
195
+
180
196
  makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
181
197
 
182
198
  if (appendToBody) {
@@ -247,7 +263,7 @@ TooltipContent.prototype = {
247
263
  /**
248
264
  * Update when tooltip is rendered
249
265
  */
250
- update: function () {
266
+ update: function (tooltipModel) {
251
267
  // FIXME
252
268
  // Move this logic to ec main?
253
269
  var container = this._container;
@@ -256,10 +272,28 @@ TooltipContent.prototype = {
256
272
 
257
273
  if (domStyle.position !== 'absolute' && stl.position !== 'absolute') {
258
274
  domStyle.position = 'relative';
259
- } // Hide the tooltip
275
+ }
276
+
277
+ var alwaysShowContent = tooltipModel.get('alwaysShowContent');
278
+ alwaysShowContent && this._moveTooltipIfResized(); // Hide the tooltip
260
279
  // PENDING
261
280
  // this.hide();
281
+ },
282
+
283
+ /**
284
+ * when `alwaysShowContent` is true,
285
+ * we should move the tooltip after chart resized
286
+ */
287
+ _moveTooltipIfResized: function () {
288
+ var ratioX = this._styleCoord[2]; // The ratio of left to width
289
+
290
+ var ratioY = this._styleCoord[3]; // The ratio of top to height
291
+
292
+ var realX = ratioX * this._zr.getWidth();
293
+
294
+ var realY = ratioY * this._zr.getHeight();
262
295
 
296
+ this.moveTo(realX, realY);
263
297
  },
264
298
  show: function (tooltipModel) {
265
299
  clearTimeout(this._hideTimeout);
@@ -269,10 +303,10 @@ TooltipContent.prototype = {
269
303
  // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore
270
304
  // we should set initial value to `left` and `top`.
271
305
  + ';left:' + styleCoord[0] + 'px;top:' + styleCoord[1] + 'px;' + (tooltipModel.get('extraCssText') || '');
272
- el.style.display = el.innerHTML ? 'block' : 'none'; // If mouse occsionally move over the tooltip, a mouseout event will be
273
- // triggered by canvas, and cuase some unexpectable result like dragging
306
+ el.style.display = el.innerHTML ? 'block' : 'none'; // If mouse occasionally move over the tooltip, a mouseout event will be
307
+ // triggered by canvas, and cause some unexpectable result like dragging
274
308
  // stop, "unfocusAdjacency". Here `pointer-events: none` is used to solve
275
- // it. Although it is not suppored by IE8~IE10, fortunately it is a rare
309
+ // it. Although it is not supported by IE8~IE10, fortunately it is a rare
276
310
  // scenario.
277
311
 
278
312
  el.style.pointerEvents = this._enterable ? 'auto' : 'none';
@@ -302,7 +336,7 @@ TooltipContent.prototype = {
302
336
  hideLater: function (time) {
303
337
  if (this._show && !(this._inContent && this._enterable)) {
304
338
  if (time) {
305
- this._hideDelay = time; // Set show false to avoid invoke hideLater mutiple times
339
+ this._hideDelay = time; // Set show false to avoid invoke hideLater multiple times
306
340
 
307
341
  this._show = false;
308
342
  this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);
@@ -22,6 +22,8 @@ var zrUtil = require("zrender/lib/core/util");
22
22
 
23
23
  var Text = require("zrender/lib/graphic/Text");
24
24
 
25
+ var graphicUtil = require("../../util/graphic");
26
+
25
27
  /*
26
28
  * Licensed to the Apache Software Foundation (ASF) under one
27
29
  * or more contributor license agreements. See the NOTICE file
@@ -41,13 +43,24 @@ var Text = require("zrender/lib/graphic/Text");
41
43
  * under the License.
42
44
  */
43
45
  // import Group from 'zrender/src/container/Group';
46
+ function makeStyleCoord(out, zr, zrX, zrY) {
47
+ out[0] = zrX;
48
+ out[1] = zrY;
49
+ out[2] = out[0] / zr.getWidth(); // The ratio of left to width
44
50
 
51
+ out[3] = out[1] / zr.getHeight(); // The ratio of top to height
52
+ }
45
53
  /**
46
54
  * @alias module:echarts/component/tooltip/TooltipRichContent
47
55
  * @constructor
48
56
  */
57
+
58
+
49
59
  function TooltipRichContent(api) {
50
- this._zr = api.getZr();
60
+ var zr = this._zr = api.getZr();
61
+ this._styleCoord = [0, 0, 0, 0]; // [left, top, left/width, top/height]
62
+
63
+ makeStyleCoord(this._styleCoord, zr, api.getWidth() / 2, api.getHeight() / 2);
51
64
  this._show = false;
52
65
  /**
53
66
  * @private
@@ -68,7 +81,25 @@ TooltipRichContent.prototype = {
68
81
  /**
69
82
  * Update when tooltip is rendered
70
83
  */
71
- update: function () {// noop
84
+ update: function (tooltipModel) {
85
+ var alwaysShowContent = tooltipModel.get('alwaysShowContent');
86
+ alwaysShowContent && this._moveTooltipIfResized();
87
+ },
88
+
89
+ /**
90
+ * when `alwaysShowContent` is true,
91
+ * we should move the tooltip after chart resized
92
+ */
93
+ _moveTooltipIfResized: function () {
94
+ var ratioX = this._styleCoord[2]; // The ratio of left to width
95
+
96
+ var ratioY = this._styleCoord[3]; // The ratio of top to height
97
+
98
+ var realX = ratioX * this._zr.getWidth();
99
+
100
+ var realY = ratioY * this._zr.getHeight();
101
+
102
+ this.moveTo(realX, realY);
72
103
  },
73
104
  show: function (tooltipModel) {
74
105
  if (this._hideTimeout) {
@@ -123,16 +154,24 @@ TooltipRichContent.prototype = {
123
154
  startId = text.indexOf('{marker');
124
155
  }
125
156
 
157
+ var textStyleModel = tooltipModel.getModel('textStyle');
158
+ var fontSize = textStyleModel.get('fontSize');
159
+ var lineHeight = tooltipModel.get('textLineHeight');
160
+
161
+ if (lineHeight == null) {
162
+ lineHeight = Math.round(fontSize * 3 / 2);
163
+ }
164
+
126
165
  this.el = new Text({
127
- style: {
166
+ style: graphicUtil.setTextStyle({}, textStyleModel, {
128
167
  rich: markers,
129
168
  text: content,
130
- textLineHeight: 20,
131
169
  textBackgroundColor: tooltipModel.get('backgroundColor'),
132
170
  textBorderRadius: tooltipModel.get('borderRadius'),
133
171
  textFill: tooltipModel.get('textStyle.color'),
134
- textPadding: tooltipModel.get('padding')
135
- },
172
+ textPadding: tooltipModel.get('padding'),
173
+ textLineHeight: lineHeight
174
+ }),
136
175
  z: tooltipModel.get('z')
137
176
  });
138
177
 
@@ -167,7 +206,9 @@ TooltipRichContent.prototype = {
167
206
  },
168
207
  moveTo: function (x, y) {
169
208
  if (this.el) {
170
- this.el.attr('position', [x, y]);
209
+ var styleCoord = this._styleCoord;
210
+ makeStyleCoord(styleCoord, this._zr, x, y);
211
+ this.el.attr('position', [styleCoord[0], styleCoord[1]]);
171
212
  }
172
213
  },
173
214
  hide: function () {
@@ -180,7 +221,7 @@ TooltipRichContent.prototype = {
180
221
  hideLater: function (time) {
181
222
  if (this._show && !(this._inContent && this._enterable)) {
182
223
  if (time) {
183
- this._hideDelay = time; // Set show false to avoid invoke hideLater mutiple times
224
+ this._hideDelay = time; // Set show false to avoid invoke hideLater multiple times
184
225
 
185
226
  this._show = false;
186
227
  this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);
@@ -192,6 +233,13 @@ TooltipRichContent.prototype = {
192
233
  isShow: function () {
193
234
  return this._show;
194
235
  },
236
+ dispose: function () {
237
+ clearTimeout(this._hideTimeout);
238
+
239
+ if (this.el) {
240
+ this._zr.remove(this.el);
241
+ }
242
+ },
195
243
  getOuterSize: function () {
196
244
  var size = this.getSize();
197
245
  return {
@@ -143,7 +143,7 @@ var _default = echarts.extendComponentView({
143
143
 
144
144
  this._alwaysShowContent = tooltipModel.get('alwaysShowContent');
145
145
  var tooltipContent = this._tooltipContent;
146
- tooltipContent.update();
146
+ tooltipContent.update(tooltipModel);
147
147
  tooltipContent.setEnterable(tooltipModel.get('enterable'));
148
148
 
149
149
  this._initGlobalListener();
@@ -347,7 +347,7 @@ var _default = echarts.extendComponentView({
347
347
  _showOrMove: function (tooltipModel, cb) {
348
348
  // showDelay is used in this case: tooltip.enterable is set
349
349
  // as true. User intent to move mouse into tooltip and click
350
- // something. `showDelay` makes it easyer to enter the content
350
+ // something. `showDelay` makes it easier to enter the content
351
351
  // but tooltip do not move immediately.
352
352
  var delay = tooltipModel.get('showDelay');
353
353
  cb = zrUtil.bind(cb, this);
@@ -413,7 +413,7 @@ var _default = echarts.extendComponentView({
413
413
  }
414
414
  }); // Default tooltip content
415
415
  // FIXME
416
- // (1) shold be the first data which has name?
416
+ // (1) should be the first data which has name?
417
417
  // (2) themeRiver, firstDataIndex is array, and first line is unnecessary.
418
418
 
419
419
  var firstLine = valueLabel;
@@ -503,7 +503,7 @@ var _default = echarts.extendComponentView({
503
503
  var subTooltipModel = new Model(tooltipOpt, this._tooltipModel, this._ecModel);
504
504
  var defaultHtml = subTooltipModel.get('content');
505
505
  var asyncTicket = Math.random(); // Do not check whether `trigger` is 'none' here, because `trigger`
506
- // only works on cooridinate system. In fact, we have not found case
506
+ // only works on coordinate system. In fact, we have not found case
507
507
  // that requires setting `trigger` nothing on component yet.
508
508
 
509
509
  this._showOrMove(subTooltipModel, function () {
@@ -398,7 +398,7 @@ var VisualMapModel = echarts.extendComponentModel({
398
398
  // Originally we use visualMap.color as the default color, but setOption at
399
399
  // the second time the default color will be erased. So we change to use
400
400
  // constant DEFAULT_COLOR.
401
- // If user do not want the defualt color, set inRange: {color: null}.
401
+ // If user do not want the default color, set inRange: {color: null}.
402
402
 
403
403
 
404
404
  base.inRange = base.inRange || {
@@ -48,7 +48,7 @@ var defaultOption = {
48
48
  name: '',
49
49
  // 'start' | 'middle' | 'end'
50
50
  nameLocation: 'end',
51
- // By degree. By defualt auto rotate by nameLocation.
51
+ // By degree. By default auto rotate by nameLocation.
52
52
  nameRotate: null,
53
53
  nameTruncate: {
54
54
  maxWidth: null,
@@ -397,8 +397,8 @@ function rotateTextRect(textRect, rotate) {
397
397
  var boundingBox = textRect.plain();
398
398
  var beforeWidth = boundingBox.width;
399
399
  var beforeHeight = boundingBox.height;
400
- var afterWidth = beforeWidth * Math.cos(rotateRadians) + beforeHeight * Math.sin(rotateRadians);
401
- var afterHeight = beforeWidth * Math.sin(rotateRadians) + beforeHeight * Math.cos(rotateRadians);
400
+ var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians)) + Math.abs(beforeHeight * Math.sin(rotateRadians));
401
+ var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians)) + Math.abs(beforeHeight * Math.cos(rotateRadians));
402
402
  var rotatedRect = new BoundingRect(boundingBox.x, boundingBox.y, afterWidth, afterHeight);
403
403
  return rotatedRect;
404
404
  }
@@ -143,8 +143,9 @@ var GeoModel = ComponentModel.extend({
143
143
  * @return {string}
144
144
  */
145
145
  getFormattedLabel: function (name, status) {
146
+ status = status || 'normal';
146
147
  var regionModel = this.getRegionModel(name);
147
- var formatter = regionModel.get('label' + (status === 'normal' ? '.' : status + '.') + 'formatter');
148
+ var formatter = regionModel.get((status === 'normal' ? '' : status + '.') + 'label.formatter');
148
149
  var params = {
149
150
  name: name
150
151
  };
package/lib/data/Graph.js CHANGED
@@ -191,12 +191,7 @@ graphProto.addEdge = function (n1, n2, dataIndex) {
191
191
  return;
192
192
  }
193
193
 
194
- var key = n1.id + '-' + n2.id; // PENDING
195
-
196
- if (edgesMap[key]) {
197
- return;
198
- }
199
-
194
+ var key = n1.id + '-' + n2.id;
200
195
  var edge = new Edge(n1, n2, dataIndex);
201
196
  edge.hostGraph = this;
202
197
 
package/lib/data/List.js CHANGED
@@ -419,7 +419,7 @@ listProto.mapDimension = function (coordDim, idx) {
419
419
  * Initialize from data
420
420
  * @param {Array.<Object|number|Array>} data source or data or data provider.
421
421
  * @param {Array.<string>} [nameLIst] The name of a datum is used on data diff and
422
- * defualt label/tooltip.
422
+ * default label/tooltip.
423
423
  * A name can be specified in encode.itemName,
424
424
  * or dataItem.name (only for series option data),
425
425
  * or provided in nameList from outside.