echarts 4.5.0-rc.2 → 4.8.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 (256) 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 +2808 -1188
  7. package/dist/echarts-en.common.min.js +1 -1
  8. package/dist/echarts-en.js +3559 -1437
  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 +2453 -1002
  12. package/dist/echarts-en.simple.min.js +1 -1
  13. package/dist/echarts.common.js +2782 -1188
  14. package/dist/echarts.common.min.js +1 -1
  15. package/dist/echarts.js +3533 -1437
  16. package/dist/echarts.js.map +1 -1
  17. package/dist/echarts.min.js +1 -1
  18. package/dist/echarts.simple.js +2427 -1002
  19. package/dist/echarts.simple.min.js +1 -1
  20. package/dist/extension/bmap.js +336 -2
  21. package/dist/extension/bmap.js.map +1 -1
  22. package/dist/extension/bmap.min.js +1 -1
  23. package/extension/bmap/BMapView.js +6 -2
  24. package/extension-src/bmap/BMapView.js +3 -2
  25. package/lib/chart/bar/BarSeries.js +14 -1
  26. package/lib/chart/bar/BarView.js +161 -16
  27. package/lib/chart/bar/BaseBarSeries.js +3 -1
  28. package/lib/chart/candlestick/candlestickVisual.js +1 -1
  29. package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
  30. package/lib/chart/funnel/FunnelSeries.js +13 -5
  31. package/lib/chart/gauge/GaugeSeries.js +0 -2
  32. package/lib/chart/graph/GraphSeries.js +11 -5
  33. package/lib/chart/graph/GraphView.js +30 -12
  34. package/lib/chart/heatmap/HeatmapView.js +4 -4
  35. package/lib/chart/helper/EffectLine.js +23 -1
  36. package/lib/chart/helper/EffectSymbol.js +2 -1
  37. package/lib/chart/helper/Line.js +94 -33
  38. package/lib/chart/helper/LineDraw.js +5 -1
  39. package/lib/chart/helper/Symbol.js +1 -2
  40. package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
  41. package/lib/chart/helper/createListFromArray.js +14 -8
  42. package/lib/chart/helper/createRenderPlanner.js +6 -3
  43. package/lib/chart/helper/whiskerBoxCommon.js +22 -16
  44. package/lib/chart/line/LineSeries.js +3 -1
  45. package/lib/chart/line/LineView.js +41 -2
  46. package/lib/chart/map/MapSeries.js +11 -3
  47. package/lib/chart/pie/PieSeries.js +27 -6
  48. package/lib/chart/pie/PieView.js +22 -15
  49. package/lib/chart/pie/labelLayout.js +102 -19
  50. package/lib/chart/pie/pieLayout.js +19 -7
  51. package/lib/chart/radar/RadarSeries.js +23 -3
  52. package/lib/chart/sankey/SankeySeries.js +13 -1
  53. package/lib/chart/sankey/SankeyView.js +70 -32
  54. package/lib/chart/sankey/sankeyLayout.js +22 -3
  55. package/lib/chart/scatter/ScatterSeries.js +3 -1
  56. package/lib/chart/sunburst/SunburstPiece.js +1 -0
  57. package/lib/chart/sunburst/SunburstSeries.js +12 -7
  58. package/lib/chart/sunburst/SunburstView.js +5 -1
  59. package/lib/chart/themeRiver/ThemeRiverSeries.js +3 -3
  60. package/lib/chart/tree/TreeSeries.js +20 -3
  61. package/lib/chart/tree/TreeView.js +151 -25
  62. package/lib/chart/treemap/TreemapSeries.js +15 -3
  63. package/lib/chart/treemap/TreemapView.js +80 -38
  64. package/lib/component/axis/AngleAxisView.js +64 -7
  65. package/lib/component/axis/AxisBuilder.js +62 -24
  66. package/lib/component/axis/CartesianAxisView.js +52 -85
  67. package/lib/component/axis/RadiusAxisView.js +36 -4
  68. package/lib/component/axis/SingleAxisView.js +21 -6
  69. package/lib/component/axis/axisSplitHelper.js +132 -0
  70. package/lib/component/brush/BrushView.js +11 -1
  71. package/lib/component/brush/visualEncoding.js +13 -2
  72. package/lib/component/dataZoom/SliderZoomView.js +4 -10
  73. package/lib/component/helper/BrushController.js +33 -43
  74. package/lib/component/helper/MapDraw.js +30 -4
  75. package/lib/component/legend/LegendModel.js +3 -3
  76. package/lib/component/legend/LegendView.js +17 -13
  77. package/lib/component/legend/ScrollableLegendView.js +18 -18
  78. package/lib/component/marker/MarkLineModel.js +2 -1
  79. package/lib/component/marker/markerHelper.js +7 -4
  80. package/lib/component/title.js +6 -2
  81. package/lib/component/toolbox/ToolboxView.js +5 -1
  82. package/lib/component/toolbox/feature/MagicType.js +20 -14
  83. package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
  84. package/lib/component/tooltip/TooltipContent.js +60 -23
  85. package/lib/component/tooltip/TooltipView.js +7 -8
  86. package/lib/component/visualMap/PiecewiseModel.js +3 -6
  87. package/lib/coord/Axis.js +30 -2
  88. package/lib/coord/View.js +9 -0
  89. package/lib/coord/axisDefault.js +21 -2
  90. package/lib/coord/axisHelper.js +22 -16
  91. package/lib/coord/calendar/Calendar.js +8 -4
  92. package/lib/coord/geo/geoJSONLoader.js +3 -2
  93. package/lib/coord/geo/geoSourceManager.js +3 -2
  94. package/lib/coord/geo/parseGeoJson.js +3 -2
  95. package/lib/coord/radar/Radar.js +5 -5
  96. package/lib/data/DataDimensionInfo.js +157 -0
  97. package/lib/data/List.js +25 -19
  98. package/lib/data/Tree.js +9 -19
  99. package/lib/data/helper/completeDimensions.js +43 -32
  100. package/lib/data/helper/createDimensions.js +2 -0
  101. package/lib/data/helper/sourceHelper.js +214 -114
  102. package/lib/echarts.js +57 -34
  103. package/lib/langEN.js +26 -0
  104. package/lib/layout/barGrid.js +19 -13
  105. package/lib/layout/barPolar.js +0 -5
  106. package/lib/loading/default.js +43 -27
  107. package/lib/model/Series.js +4 -4
  108. package/lib/model/referHelper.js +40 -12
  109. package/lib/scale/Interval.js +87 -2
  110. package/lib/scale/Log.js +9 -2
  111. package/lib/scale/helper.js +1 -43
  112. package/lib/stream/Scheduler.js +9 -1
  113. package/lib/theme/dark.js +3 -0
  114. package/lib/util/format.js +19 -2
  115. package/lib/util/graphic.js +14 -12
  116. package/lib/visual/LegendVisualProvider.js +75 -0
  117. package/lib/visual/dataColor.js +2 -12
  118. package/lib/visual/seriesColor.js +15 -7
  119. package/lib/visual/symbol.js +12 -2
  120. package/map/js/china.js +1 -1
  121. package/map/js/province/chongqing.js +1 -1
  122. package/map/js/province/gansu.js +2 -2
  123. package/map/js/province/tianjin.js +1 -28
  124. package/map/json/china.json +1 -1
  125. package/map/json/province/chongqing.json +1 -1
  126. package/map/json/province/tianjin.json +1 -1
  127. package/package.json +11 -6
  128. package/src/chart/bar/BarSeries.js +15 -1
  129. package/src/chart/bar/BarView.js +162 -15
  130. package/src/chart/bar/BaseBarSeries.js +1 -1
  131. package/src/chart/candlestick/candlestickVisual.js +1 -1
  132. package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
  133. package/src/chart/funnel/FunnelSeries.js +10 -4
  134. package/src/chart/gauge/GaugeSeries.js +0 -1
  135. package/src/chart/graph/GraphSeries.js +10 -4
  136. package/src/chart/graph/GraphView.js +28 -10
  137. package/src/chart/heatmap/HeatmapView.js +4 -4
  138. package/src/chart/helper/EffectLine.js +23 -1
  139. package/src/chart/helper/EffectSymbol.js +2 -1
  140. package/src/chart/helper/Line.js +84 -26
  141. package/src/chart/helper/LineDraw.js +5 -1
  142. package/src/chart/helper/Symbol.js +2 -2
  143. package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
  144. package/src/chart/helper/createListFromArray.js +13 -8
  145. package/src/chart/helper/createRenderPlanner.js +5 -2
  146. package/src/chart/helper/whiskerBoxCommon.js +21 -16
  147. package/src/chart/line/LineSeries.js +1 -1
  148. package/src/chart/line/LineView.js +45 -1
  149. package/src/chart/map/MapSeries.js +8 -3
  150. package/src/chart/pie/PieSeries.js +26 -5
  151. package/src/chart/pie/PieView.js +20 -15
  152. package/src/chart/pie/labelLayout.js +114 -22
  153. package/src/chart/pie/pieLayout.js +20 -7
  154. package/src/chart/radar/RadarSeries.js +27 -3
  155. package/src/chart/sankey/SankeySeries.js +12 -1
  156. package/src/chart/sankey/SankeyView.js +75 -30
  157. package/src/chart/sankey/sankeyLayout.js +25 -5
  158. package/src/chart/scatter/ScatterSeries.js +1 -1
  159. package/src/chart/sunburst/SunburstPiece.js +2 -0
  160. package/src/chart/sunburst/SunburstSeries.js +12 -7
  161. package/src/chart/sunburst/SunburstView.js +2 -1
  162. package/src/chart/themeRiver/ThemeRiverSeries.js +4 -3
  163. package/src/chart/tree/TreeSeries.js +19 -6
  164. package/src/chart/tree/TreeView.js +155 -22
  165. package/src/chart/treemap/TreemapSeries.js +15 -5
  166. package/src/chart/treemap/TreemapView.js +77 -41
  167. package/src/component/axis/AngleAxisView.js +75 -7
  168. package/src/component/axis/AxisBuilder.js +77 -32
  169. package/src/component/axis/CartesianAxisView.js +47 -83
  170. package/src/component/axis/RadiusAxisView.js +37 -4
  171. package/src/component/axis/SingleAxisView.js +21 -4
  172. package/src/component/axis/axisSplitHelper.js +114 -0
  173. package/src/component/brush/BrushView.js +8 -1
  174. package/src/component/brush/visualEncoding.js +6 -3
  175. package/src/component/dataZoom/SliderZoomView.js +4 -9
  176. package/src/component/helper/BrushController.js +40 -47
  177. package/src/component/helper/MapDraw.js +27 -4
  178. package/src/component/legend/LegendModel.js +3 -3
  179. package/src/component/legend/LegendView.js +18 -12
  180. package/src/component/legend/ScrollableLegendView.js +18 -16
  181. package/src/component/marker/MarkLineModel.js +2 -1
  182. package/src/component/marker/markerHelper.js +8 -5
  183. package/src/component/title.js +3 -2
  184. package/src/component/toolbox/ToolboxView.js +5 -0
  185. package/src/component/toolbox/feature/MagicType.js +19 -13
  186. package/src/component/toolbox/feature/SaveAsImage.js +2 -1
  187. package/src/component/tooltip/TooltipContent.js +59 -22
  188. package/src/component/tooltip/TooltipView.js +10 -8
  189. package/src/component/visualMap/PiecewiseModel.js +5 -9
  190. package/src/coord/Axis.js +29 -2
  191. package/src/coord/View.js +10 -1
  192. package/src/coord/axisDefault.js +25 -1
  193. package/src/coord/axisHelper.js +26 -19
  194. package/src/coord/calendar/Calendar.js +12 -5
  195. package/src/coord/geo/geoJSONLoader.js +3 -2
  196. package/src/coord/geo/geoSourceManager.js +3 -2
  197. package/src/coord/geo/parseGeoJson.js +3 -2
  198. package/src/coord/radar/Radar.js +6 -8
  199. package/src/data/DataDimensionInfo.js +135 -0
  200. package/src/data/List.js +29 -16
  201. package/src/data/Tree.js +12 -17
  202. package/src/data/helper/completeDimensions.js +49 -30
  203. package/src/data/helper/createDimensions.js +2 -0
  204. package/src/data/helper/sourceHelper.js +216 -124
  205. package/src/echarts.js +60 -36
  206. package/src/langEN.js +26 -0
  207. package/src/layout/barGrid.js +22 -10
  208. package/src/layout/barPolar.js +0 -4
  209. package/src/loading/default.js +46 -34
  210. package/src/model/Series.js +4 -4
  211. package/src/model/referHelper.js +34 -11
  212. package/src/scale/Interval.js +84 -4
  213. package/src/scale/Log.js +9 -2
  214. package/src/scale/helper.js +1 -39
  215. package/src/stream/Scheduler.js +8 -0
  216. package/src/theme/dark.js +3 -0
  217. package/src/util/format.js +17 -1
  218. package/src/util/graphic.js +13 -11
  219. package/src/visual/LegendVisualProvider.js +55 -0
  220. package/src/visual/dataColor.js +0 -13
  221. package/src/visual/seriesColor.js +13 -7
  222. package/src/visual/symbol.js +11 -2
  223. package/theme/azul.js +163 -0
  224. package/theme/bee-inspired.js +178 -0
  225. package/theme/blue.js +178 -0
  226. package/theme/caravan.js +178 -0
  227. package/theme/carp.js +163 -0
  228. package/theme/cool.js +180 -0
  229. package/theme/dark-blue.js +168 -0
  230. package/theme/dark-bold.js +168 -0
  231. package/theme/dark-digerati.js +168 -0
  232. package/theme/dark-fresh-cut.js +168 -0
  233. package/theme/dark-mushroom.js +168 -0
  234. package/theme/dark.js +69 -62
  235. package/theme/eduardo.js +178 -0
  236. package/theme/forest.js +163 -0
  237. package/theme/fresh-cut.js +163 -0
  238. package/theme/fruit.js +178 -0
  239. package/theme/gray.js +220 -0
  240. package/theme/green.js +222 -0
  241. package/theme/helianthus.js +263 -0
  242. package/theme/infographic.js +72 -57
  243. package/theme/inspired.js +163 -0
  244. package/theme/jazz.js +163 -0
  245. package/theme/london.js +163 -0
  246. package/theme/macarons.js +80 -57
  247. package/theme/macarons2.js +251 -0
  248. package/theme/mint.js +155 -0
  249. package/theme/red-velvet.js +163 -0
  250. package/theme/red.js +225 -0
  251. package/theme/roma.js +55 -22
  252. package/theme/royal.js +163 -0
  253. package/theme/sakura.js +140 -0
  254. package/theme/shine.js +52 -45
  255. package/theme/tech-blue.js +180 -0
  256. package/theme/vintage.js +37 -23
@@ -38,6 +38,8 @@ var barItemStyle = require("./barItemStyle");
38
38
 
39
39
  var Path = require("zrender/lib/graphic/Path");
40
40
 
41
+ var Group = require("zrender/lib/container/Group");
42
+
41
43
  var _throttle = require("../../util/throttle");
42
44
 
43
45
  var throttle = _throttle.throttle;
@@ -149,14 +151,32 @@ var _default = echarts.extendChartView({
149
151
  // And don't want the label are clipped.
150
152
 
151
153
  var roundCap = seriesModel.get('roundCap', true);
154
+ var drawBackground = seriesModel.get('showBackground', true);
155
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
156
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
157
+ var bgEls = [];
158
+ var oldBgEls = this._backgroundEls || [];
152
159
  data.diff(oldData).add(function (dataIndex) {
160
+ var itemModel = data.getItemModel(dataIndex);
161
+ var layout = getLayout[coord.type](data, dataIndex, itemModel);
162
+
163
+ if (drawBackground) {
164
+ var bgLayout = getLayout[coord.type](data, dataIndex);
165
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
166
+ bgEl.useStyle(backgroundModel.getBarItemStyle()); // Only cartesian2d support borderRadius.
167
+
168
+ if (coord.type === 'cartesian2d') {
169
+ bgEl.setShape('r', barBorderRadius);
170
+ }
171
+
172
+ bgEls[dataIndex] = bgEl;
173
+ } // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
174
+
175
+
153
176
  if (!data.hasValue(dataIndex)) {
154
177
  return;
155
178
  }
156
179
 
157
- var itemModel = data.getItemModel(dataIndex);
158
- var layout = getLayout[coord.type](data, dataIndex, itemModel);
159
-
160
180
  if (needsClip) {
161
181
  // Clip will modify the layout params.
162
182
  // And return a boolean to determine if the shape are fully clipped.
@@ -173,6 +193,25 @@ var _default = echarts.extendChartView({
173
193
  group.add(el);
174
194
  updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontalOrRadial, coord.type === 'polar');
175
195
  }).update(function (newIndex, oldIndex) {
196
+ var itemModel = data.getItemModel(newIndex);
197
+ var layout = getLayout[coord.type](data, newIndex, itemModel);
198
+
199
+ if (drawBackground) {
200
+ var bgEl = oldBgEls[oldIndex];
201
+ bgEl.useStyle(backgroundModel.getBarItemStyle()); // Only cartesian2d support borderRadius.
202
+
203
+ if (coord.type === 'cartesian2d') {
204
+ bgEl.setShape('r', barBorderRadius);
205
+ }
206
+
207
+ bgEls[newIndex] = bgEl;
208
+ var bgLayout = getLayout[coord.type](data, newIndex);
209
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
210
+ graphic.updateProps(bgEl, {
211
+ shape: shape
212
+ }, animationModel, newIndex);
213
+ }
214
+
176
215
  var el = oldData.getItemGraphicEl(oldIndex);
177
216
 
178
217
  if (!data.hasValue(newIndex)) {
@@ -180,9 +219,6 @@ var _default = echarts.extendChartView({
180
219
  return;
181
220
  }
182
221
 
183
- var itemModel = data.getItemModel(newIndex);
184
- var layout = getLayout[coord.type](data, newIndex, itemModel);
185
-
186
222
  if (needsClip) {
187
223
  var isClipped = clip[coord.type](coordSysClipArea, layout);
188
224
 
@@ -213,6 +249,15 @@ var _default = echarts.extendChartView({
213
249
  el && removeSector(dataIndex, animationModel, el);
214
250
  }
215
251
  }).execute();
252
+ var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group());
253
+ bgGroup.removeAll();
254
+
255
+ for (var i = 0; i < bgEls.length; ++i) {
256
+ bgGroup.add(bgEls[i]);
257
+ }
258
+
259
+ group.add(bgGroup);
260
+ this._backgroundEls = bgEls;
216
261
  this._data = data;
217
262
  },
218
263
  _renderLarge: function (seriesModel, ecModel, api) {
@@ -229,6 +274,8 @@ var _default = echarts.extendChartView({
229
274
  }
230
275
  },
231
276
  _incrementalRenderLarge: function (params, seriesModel) {
277
+ this._removeBackground();
278
+
232
279
  createLarge(seriesModel, this.group, true);
233
280
  },
234
281
  dispose: zrUtil.noop,
@@ -240,6 +287,9 @@ var _default = echarts.extendChartView({
240
287
  var data = this._data;
241
288
 
242
289
  if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
290
+ this._removeBackground();
291
+
292
+ this._backgroundEls = [];
243
293
  data.eachItemGraphicEl(function (el) {
244
294
  if (el.type === 'sector') {
245
295
  removeSector(el.dataIndex, ecModel, el);
@@ -252,6 +302,10 @@ var _default = echarts.extendChartView({
252
302
  }
253
303
 
254
304
  this._data = null;
305
+ },
306
+ _removeBackground: function () {
307
+ this.group.remove(this._backgroundGroup);
308
+ this._backgroundGroup = null;
255
309
  }
256
310
  });
257
311
 
@@ -301,8 +355,10 @@ var clip = {
301
355
  var elementCreator = {
302
356
  cartesian2d: function (dataIndex, layout, isHorizontal, animationModel, isUpdate) {
303
357
  var rect = new graphic.Rect({
304
- shape: zrUtil.extend({}, layout)
305
- }); // Animation
358
+ shape: zrUtil.extend({}, layout),
359
+ z2: 1
360
+ });
361
+ rect.name = 'item'; // Animation
306
362
 
307
363
  if (animationModel) {
308
364
  var rectShape = rect.shape;
@@ -327,8 +383,10 @@ var elementCreator = {
327
383
  var sector = new ShapeClass({
328
384
  shape: zrUtil.defaults({
329
385
  clockwise: clockwise
330
- }, layout)
331
- }); // Animation
386
+ }, layout),
387
+ z2: 1
388
+ });
389
+ sector.name = 'item'; // Animation
332
390
 
333
391
  if (animationModel) {
334
392
  var sectorShape = sector.shape;
@@ -370,9 +428,11 @@ function removeSector(dataIndex, animationModel, el) {
370
428
  }
371
429
 
372
430
  var getLayout = {
431
+ // itemModel is only used to get borderWidth, which is not needed
432
+ // when calculating bar background layout.
373
433
  cartesian2d: function (data, dataIndex, itemModel) {
374
434
  var layout = data.getItemLayout(dataIndex);
375
- var fixedLineWidth = getLineWidth(itemModel, layout); // fix layout with lineWidth
435
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0; // fix layout with lineWidth
376
436
 
377
437
  var signX = layout.width > 0 ? 1 : -1;
378
438
  var signY = layout.height > 0 ? 1 : -1;
@@ -396,9 +456,14 @@ var getLayout = {
396
456
  }
397
457
  };
398
458
 
459
+ function isZeroOnPolar(layout) {
460
+ return layout.startAngle != null && layout.endAngle != null && layout.startAngle === layout.endAngle;
461
+ }
462
+
399
463
  function updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal, isPolar) {
400
464
  var color = data.getItemVisual(dataIndex, 'color');
401
465
  var opacity = data.getItemVisual(dataIndex, 'opacity');
466
+ var stroke = data.getVisual('borderColor');
402
467
  var itemStyleModel = itemModel.getModel('itemStyle');
403
468
  var hoverStyle = itemModel.getModel('emphasis.itemStyle').getBarItemStyle();
404
469
 
@@ -407,7 +472,8 @@ function updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHori
407
472
  }
408
473
 
409
474
  el.useStyle(zrUtil.defaults({
410
- fill: color,
475
+ stroke: isZeroOnPolar(layout) ? 'none' : stroke,
476
+ fill: isZeroOnPolar(layout) ? 'none' : color,
411
477
  opacity: opacity
412
478
  }, itemStyleModel.getBarItemStyle()));
413
479
  var cursorStyle = itemModel.getShallow('cursor');
@@ -418,13 +484,20 @@ function updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHori
418
484
  setLabel(el.style, hoverStyle, itemModel, color, seriesModel, dataIndex, labelPositionOutside);
419
485
  }
420
486
 
487
+ if (isZeroOnPolar(layout)) {
488
+ hoverStyle.fill = hoverStyle.stroke = 'none';
489
+ }
490
+
421
491
  graphic.setHoverStyle(el, hoverStyle);
422
492
  } // In case width or height are too small.
423
493
 
424
494
 
425
495
  function getLineWidth(itemModel, rawLayout) {
426
- var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
427
- return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height));
496
+ var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0; // width or height may be NaN for empty data
497
+
498
+ var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
499
+ var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
500
+ return Math.min(lineWidth, width, height);
428
501
  }
429
502
 
430
503
  var LargePath = Path.extend({
@@ -453,6 +526,31 @@ function createLarge(seriesModel, group, incremental) {
453
526
  var startPoint = [];
454
527
  var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
455
528
  startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart');
529
+ var largeDataIndices = data.getLayout('largeDataIndices');
530
+ var barWidth = data.getLayout('barWidth');
531
+ var backgroundModel = seriesModel.getModel('backgroundStyle');
532
+ var drawBackground = seriesModel.get('showBackground', true);
533
+
534
+ if (drawBackground) {
535
+ var points = data.getLayout('largeBackgroundPoints');
536
+ var backgroundStartPoint = [];
537
+ backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart');
538
+ var bgEl = new LargePath({
539
+ shape: {
540
+ points: points
541
+ },
542
+ incremental: !!incremental,
543
+ __startPoint: backgroundStartPoint,
544
+ __baseDimIdx: baseDimIdx,
545
+ __largeDataIndices: largeDataIndices,
546
+ __barWidth: barWidth,
547
+ silent: true,
548
+ z2: 0
549
+ });
550
+ setLargeBackgroundStyle(bgEl, backgroundModel, data);
551
+ group.add(bgEl);
552
+ }
553
+
456
554
  var el = new LargePath({
457
555
  shape: {
458
556
  points: data.getLayout('largePoints')
@@ -460,8 +558,8 @@ function createLarge(seriesModel, group, incremental) {
460
558
  incremental: !!incremental,
461
559
  __startPoint: startPoint,
462
560
  __baseDimIdx: baseDimIdx,
463
- __largeDataIndices: data.getLayout('largeDataIndices'),
464
- __barWidth: data.getLayout('barWidth')
561
+ __largeDataIndices: largeDataIndices,
562
+ __barWidth: barWidth
465
563
  });
466
564
  group.add(el);
467
565
  setLargeStyle(el, seriesModel, data); // Enable tooltip and user mouse/touch event handlers.
@@ -517,4 +615,51 @@ function setLargeStyle(el, seriesModel, data) {
517
615
  el.style.lineWidth = data.getLayout('barWidth');
518
616
  }
519
617
 
618
+ function setLargeBackgroundStyle(el, backgroundModel, data) {
619
+ var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color');
620
+ var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']);
621
+ el.useStyle(itemStyle);
622
+ el.style.fill = null;
623
+ el.style.stroke = borderColor;
624
+ el.style.lineWidth = data.getLayout('barWidth');
625
+ }
626
+
627
+ function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
628
+ var coordLayout;
629
+ var isPolar = coord.type === 'polar';
630
+
631
+ if (isPolar) {
632
+ coordLayout = coord.getArea();
633
+ } else {
634
+ coordLayout = coord.grid.getRect();
635
+ }
636
+
637
+ if (isPolar) {
638
+ return {
639
+ cx: coordLayout.cx,
640
+ cy: coordLayout.cy,
641
+ r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0,
642
+ r: isHorizontalOrRadial ? coordLayout.r : layout.r,
643
+ startAngle: isHorizontalOrRadial ? layout.startAngle : 0,
644
+ endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2
645
+ };
646
+ } else {
647
+ return {
648
+ x: isHorizontalOrRadial ? layout.x : coordLayout.x,
649
+ y: isHorizontalOrRadial ? coordLayout.y : layout.y,
650
+ width: isHorizontalOrRadial ? layout.width : coordLayout.width,
651
+ height: isHorizontalOrRadial ? coordLayout.height : layout.height
652
+ };
653
+ }
654
+ }
655
+
656
+ function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
657
+ var ElementClz = coord.type === 'polar' ? graphic.Sector : graphic.Rect;
658
+ return new ElementClz({
659
+ shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
660
+ silent: true,
661
+ z2: 0
662
+ });
663
+ }
664
+
520
665
  module.exports = _default;
@@ -43,7 +43,9 @@ var createListFromArray = require("../helper/createListFromArray");
43
43
  var _default = SeriesModel.extend({
44
44
  type: 'series.__base_bar__',
45
45
  getInitialData: function (option, ecModel) {
46
- return createListFromArray(this.getSource(), this);
46
+ return createListFromArray(this.getSource(), this, {
47
+ useEncodeDefaulter: true
48
+ });
47
49
  },
48
50
  getMarkerPosition: function (value) {
49
51
  var coordSys = this.coordinateSystem;
@@ -49,7 +49,6 @@ var _default = {
49
49
  performRawSeries: true,
50
50
  reset: function (seriesModel, ecModel) {
51
51
  var data = seriesModel.getData();
52
- var isLargeRender = seriesModel.pipelineContext.large;
53
52
  data.setVisual({
54
53
  legendSymbol: 'roundRect',
55
54
  colorP: getColor(1, seriesModel),
@@ -62,6 +61,7 @@ var _default = {
62
61
  return;
63
62
  }
64
63
 
64
+ var isLargeRender = seriesModel.pipelineContext.large;
65
65
  return !isLargeRender && {
66
66
  progress: progress
67
67
  };
@@ -44,7 +44,9 @@ var _default = SeriesModel.extend({
44
44
  type: 'series.effectScatter',
45
45
  dependencies: ['grid', 'polar'],
46
46
  getInitialData: function (option, ecModel) {
47
- return createListFromArray(this.getSource(), this);
47
+ return createListFromArray(this.getSource(), this, {
48
+ useEncodeDefaulter: true
49
+ });
48
50
  },
49
51
  brushSelector: 'point',
50
52
  defaultOption: {
@@ -20,12 +20,20 @@
20
20
 
21
21
  var echarts = require("../../echarts");
22
22
 
23
+ var zrUtil = require("zrender/lib/core/util");
24
+
23
25
  var createListSimply = require("../helper/createListSimply");
24
26
 
25
27
  var _model = require("../../util/model");
26
28
 
27
29
  var defaultEmphasis = _model.defaultEmphasis;
28
30
 
31
+ var _sourceHelper = require("../../data/helper/sourceHelper");
32
+
33
+ var makeSeriesEncodeForNameBased = _sourceHelper.makeSeriesEncodeForNameBased;
34
+
35
+ var LegendVisualProvider = require("../../visual/LegendVisualProvider");
36
+
29
37
  /*
30
38
  * Licensed to the Apache Software Foundation (ASF) under one
31
39
  * or more contributor license agreements. See the NOTICE file
@@ -50,15 +58,15 @@ var FunnelSeries = echarts.extendSeriesModel({
50
58
  FunnelSeries.superApply(this, 'init', arguments); // Enable legend selection for each data item
51
59
  // Use a function instead of direct access because data reference may changed
52
60
 
53
- this.legendDataProvider = function () {
54
- return this.getRawData();
55
- }; // Extend labelLine emphasis
56
-
61
+ this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this)); // Extend labelLine emphasis
57
62
 
58
63
  this._defaultLabelLine(option);
59
64
  },
60
65
  getInitialData: function (option, ecModel) {
61
- return createListSimply(this, ['value']);
66
+ return createListSimply(this, {
67
+ coordDimensions: ['value'],
68
+ encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this)
69
+ });
62
70
  },
63
71
  _defaultLabelLine: function (option) {
64
72
  // Extend labelLine emphasis
@@ -22,8 +22,6 @@ var createListSimply = require("../helper/createListSimply");
22
22
 
23
23
  var SeriesModel = require("../../model/Series");
24
24
 
25
- var zrUtil = require("zrender/lib/core/util");
26
-
27
25
  /*
28
26
  * Licensed to the Apache Software Foundation (ASF) under one
29
27
  * or more contributor license agreements. See the NOTICE file
@@ -36,6 +36,8 @@ var encodeHTML = _format.encodeHTML;
36
36
 
37
37
  var createGraphFromNodeEdge = require("../helper/createGraphFromNodeEdge");
38
38
 
39
+ var LegendVisualProvider = require("../../visual/LegendVisualProvider");
40
+
39
41
  /*
40
42
  * Licensed to the Apache Software Foundation (ASF) under one
41
43
  * or more contributor license agreements. See the NOTICE file
@@ -57,12 +59,15 @@ var createGraphFromNodeEdge = require("../helper/createGraphFromNodeEdge");
57
59
  var GraphSeries = echarts.extendSeriesModel({
58
60
  type: 'series.graph',
59
61
  init: function (option) {
60
- GraphSeries.superApply(this, 'init', arguments); // Provide data for legend select
62
+ GraphSeries.superApply(this, 'init', arguments);
63
+ var self = this;
64
+
65
+ function getCategoriesData() {
66
+ return self._categoriesData;
67
+ } // Provide data for legend select
61
68
 
62
- this.legendDataProvider = function () {
63
- return this._categoriesData;
64
- };
65
69
 
70
+ this.legendVisualProvider = new LegendVisualProvider(getCategoriesData, getCategoriesData);
66
71
  this.fillDataTextStyle(option.edges || option.links);
67
72
 
68
73
  this._updateCategoriesData();
@@ -233,7 +238,8 @@ var GraphSeries = echarts.extendSeriesModel({
233
238
  edgeSymbol: ['none', 'none'],
234
239
  edgeSymbolSize: 10,
235
240
  edgeLabel: {
236
- position: 'middle'
241
+ position: 'middle',
242
+ distance: 5
237
243
  },
238
244
  draggable: false,
239
245
  roam: false,
@@ -122,6 +122,7 @@ var _default = echarts.extendChartView({
122
122
  this._firstRender = true;
123
123
  },
124
124
  render: function (seriesModel, ecModel, api) {
125
+ var graphView = this;
125
126
  var coordSys = seriesModel.coordinateSystem;
126
127
  this._model = seriesModel;
127
128
  var symbolDraw = this._symbolDraw;
@@ -188,6 +189,8 @@ var _default = echarts.extendChartView({
188
189
 
189
190
  if (itemModel.get('focusNodeAdjacency')) {
190
191
  el.on('mouseover', el[FOCUS_ADJACENCY] = function () {
192
+ graphView._clearTimer();
193
+
191
194
  api.dispatchAction({
192
195
  type: 'focusNodeAdjacency',
193
196
  seriesId: seriesModel.id,
@@ -195,10 +198,7 @@ var _default = echarts.extendChartView({
195
198
  });
196
199
  });
197
200
  el.on('mouseout', el[UNFOCUS_ADJACENCY] = function () {
198
- api.dispatchAction({
199
- type: 'unfocusNodeAdjacency',
200
- seriesId: seriesModel.id
201
- });
201
+ graphView._dispatchUnfocus(api);
202
202
  });
203
203
  }
204
204
  }, this);
@@ -209,6 +209,8 @@ var _default = echarts.extendChartView({
209
209
 
210
210
  if (edge.getModel().get('focusNodeAdjacency')) {
211
211
  el.on('mouseover', el[FOCUS_ADJACENCY] = function () {
212
+ graphView._clearTimer();
213
+
212
214
  api.dispatchAction({
213
215
  type: 'focusNodeAdjacency',
214
216
  seriesId: seriesModel.id,
@@ -216,10 +218,7 @@ var _default = echarts.extendChartView({
216
218
  });
217
219
  });
218
220
  el.on('mouseout', el[UNFOCUS_ADJACENCY] = function () {
219
- api.dispatchAction({
220
- type: 'unfocusNodeAdjacency',
221
- seriesId: seriesModel.id
222
- });
221
+ graphView._dispatchUnfocus(api);
223
222
  });
224
223
  }
225
224
  });
@@ -264,10 +263,30 @@ var _default = echarts.extendChartView({
264
263
  dispose: function () {
265
264
  this._controller && this._controller.dispose();
266
265
  this._controllerHost = {};
266
+
267
+ this._clearTimer();
267
268
  },
268
- focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
269
- var data = this._model.getData();
269
+ _dispatchUnfocus: function (api, opt) {
270
+ var self = this;
270
271
 
272
+ this._clearTimer();
273
+
274
+ this._unfocusDelayTimer = setTimeout(function () {
275
+ self._unfocusDelayTimer = null;
276
+ api.dispatchAction({
277
+ type: 'unfocusNodeAdjacency',
278
+ seriesId: self._model.id
279
+ });
280
+ }, 500);
281
+ },
282
+ _clearTimer: function () {
283
+ if (this._unfocusDelayTimer) {
284
+ clearTimeout(this._unfocusDelayTimer);
285
+ this._unfocusDelayTimer = null;
286
+ }
287
+ },
288
+ focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
289
+ var data = seriesModel.getData();
271
290
  var graph = data.graph;
272
291
  var dataIndex = payload.dataIndex;
273
292
  var edgeDataIndex = payload.edgeDataIndex;
@@ -305,8 +324,7 @@ var _default = echarts.extendChartView({
305
324
  }
306
325
  },
307
326
  unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
308
- var graph = this._model.getData().graph;
309
-
327
+ var graph = seriesModel.getData().graph;
310
328
  graph.eachNode(function (node) {
311
329
  fadeOutItem(node, nodeOpacityPath);
312
330
  });
@@ -166,10 +166,10 @@ var _default = echarts.extendChartView({
166
166
  var point = coordSys.dataToPoint([data.get(dataDims[0], idx), data.get(dataDims[1], idx)]);
167
167
  rect = new graphic.Rect({
168
168
  shape: {
169
- x: point[0] - width / 2,
170
- y: point[1] - height / 2,
171
- width: width,
172
- height: height
169
+ x: Math.floor(Math.round(point[0]) - width / 2),
170
+ y: Math.floor(Math.round(point[1]) - height / 2),
171
+ width: Math.ceil(width),
172
+ height: Math.ceil(height)
173
173
  },
174
174
  style: {
175
175
  fill: data.getItemVisual(idx, 'color'),
@@ -108,6 +108,7 @@ effectLineProto._updateEffectSymbol = function (lineData, idx) {
108
108
  symbol.setColor(color);
109
109
  symbol.attr('scale', size);
110
110
  this._symbolType = symbolType;
111
+ this._symbolScale = size;
111
112
 
112
113
  this._updateEffectAnimation(lineData, effectModel, idx);
113
114
  };
@@ -191,6 +192,7 @@ effectLineProto.updateSymbolPosition = function (symbol) {
191
192
  var cp1 = symbol.__cp1;
192
193
  var t = symbol.__t;
193
194
  var pos = symbol.position;
195
+ var lastPos = [pos[0], pos[1]];
194
196
  var quadraticAt = curveUtil.quadraticAt;
195
197
  var quadraticDerivativeAt = curveUtil.quadraticDerivativeAt;
196
198
  pos[0] = quadraticAt(p1[0], cp1[0], p2[0], t);
@@ -198,7 +200,27 @@ effectLineProto.updateSymbolPosition = function (symbol) {
198
200
 
199
201
  var tx = quadraticDerivativeAt(p1[0], cp1[0], p2[0], t);
200
202
  var ty = quadraticDerivativeAt(p1[1], cp1[1], p2[1], t);
201
- symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
203
+ symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2; // enable continuity trail for 'line', 'rect', 'roundRect' symbolType
204
+
205
+ if (this._symbolType === 'line' || this._symbolType === 'rect' || this._symbolType === 'roundRect') {
206
+ if (symbol.__lastT !== undefined && symbol.__lastT < symbol.__t) {
207
+ var scaleY = vec2.dist(lastPos, pos) * 1.05;
208
+ symbol.attr('scale', [symbol.scale[0], scaleY]); // make sure the last segment render within endPoint
209
+
210
+ if (t === 1) {
211
+ pos[0] = lastPos[0] + (pos[0] - lastPos[0]) / 2;
212
+ pos[1] = lastPos[1] + (pos[1] - lastPos[1]) / 2;
213
+ }
214
+ } else if (symbol.__lastT === 1) {
215
+ // After first loop, symbol.__t does NOT start with 0, so connect p1 to pos directly.
216
+ var scaleY = 2 * vec2.dist(p1, pos);
217
+ symbol.attr('scale', [symbol.scale[0], scaleY]);
218
+ } else {
219
+ symbol.attr('scale', this._symbolScale);
220
+ }
221
+ }
222
+
223
+ symbol.__lastT = symbol.__t;
202
224
  symbol.ignore = false;
203
225
  };
204
226
 
@@ -207,7 +207,8 @@ effectSymbolProto.updateData = function (data, idx) {
207
207
  pos[1] = parsePercent(symbolOffset[1], symbolSize[1]);
208
208
  }
209
209
 
210
- rippleGroup.rotation = (itemModel.getShallow('symbolRotate') || 0) * Math.PI / 180 || 0;
210
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
211
+ rippleGroup.rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
211
212
  var effectCfg = {};
212
213
  effectCfg.showEffectOn = seriesModel.get('showEffectOn');
213
214
  effectCfg.rippleScale = itemModel.get('rippleEffect.scale');