echarts 4.5.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 (329) hide show
  1. package/.DS_Store +0 -0
  2. package/.gitattributes +3 -0
  3. package/.github/pull_request_template.md +66 -0
  4. package/.github/workflows/nodejs.yml +15 -3
  5. package/.huskyrc +5 -0
  6. package/CONTRIBUTING.md +16 -160
  7. package/NOTICE +1 -1
  8. package/README.md +3 -3
  9. package/asset/.DS_Store +0 -0
  10. package/build/.DS_Store +0 -0
  11. package/dist/echarts-en.common.js +3072 -1261
  12. package/dist/echarts-en.common.min.js +1 -1
  13. package/dist/echarts-en.js +4339 -1685
  14. package/dist/echarts-en.js.map +1 -1
  15. package/dist/echarts-en.min.js +1 -1
  16. package/dist/echarts-en.simple.js +2496 -1011
  17. package/dist/echarts-en.simple.min.js +1 -1
  18. package/dist/echarts.common.js +3046 -1261
  19. package/dist/echarts.common.min.js +1 -1
  20. package/dist/echarts.js +4313 -1685
  21. package/dist/echarts.js.map +1 -1
  22. package/dist/echarts.min.js +1 -1
  23. package/dist/echarts.simple.js +2470 -1011
  24. package/dist/echarts.simple.min.js +1 -1
  25. package/dist/extension/bmap.js +33 -11
  26. package/dist/extension/bmap.js.map +1 -1
  27. package/dist/extension/bmap.min.js +1 -1
  28. package/dist/extension/dataTool.js.map +1 -1
  29. package/extension/.DS_Store +0 -0
  30. package/extension/bmap/BMapCoordSys.js +14 -4
  31. package/extension/bmap/BMapModel.js +4 -0
  32. package/extension/bmap/BMapView.js +18 -10
  33. package/extension-src/bmap/BMapCoordSys.js +14 -4
  34. package/extension-src/bmap/BMapModel.js +6 -1
  35. package/extension-src/bmap/BMapView.js +16 -9
  36. package/lib/chart/bar/BarSeries.js +14 -1
  37. package/lib/chart/bar/BarView.js +196 -18
  38. package/lib/chart/bar/BaseBarSeries.js +3 -1
  39. package/lib/chart/bar/PictorialBarSeries.js +1 -1
  40. package/lib/chart/candlestick/candlestickVisual.js +1 -1
  41. package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
  42. package/lib/chart/funnel/FunnelSeries.js +14 -5
  43. package/lib/chart/funnel/funnelLayout.js +162 -46
  44. package/lib/chart/gauge/GaugeSeries.js +0 -2
  45. package/lib/chart/graph/GraphSeries.js +23 -7
  46. package/lib/chart/graph/GraphView.js +30 -12
  47. package/lib/chart/graph/circularLayoutHelper.js +8 -2
  48. package/lib/chart/graph/forceLayout.js +6 -1
  49. package/lib/chart/graph/simpleLayout.js +1 -1
  50. package/lib/chart/graph/simpleLayoutHelper.js +10 -4
  51. package/lib/chart/heatmap/HeatmapView.js +4 -4
  52. package/lib/chart/helper/EffectLine.js +23 -1
  53. package/lib/chart/helper/EffectSymbol.js +2 -1
  54. package/lib/chart/helper/Line.js +129 -42
  55. package/lib/chart/helper/LineDraw.js +5 -1
  56. package/lib/chart/helper/Symbol.js +2 -3
  57. package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
  58. package/lib/chart/helper/createListFromArray.js +14 -8
  59. package/lib/chart/helper/createRenderPlanner.js +6 -3
  60. package/lib/chart/helper/multipleGraphEdgeHelper.js +258 -0
  61. package/lib/chart/helper/whiskerBoxCommon.js +22 -16
  62. package/lib/chart/line/LineSeries.js +3 -1
  63. package/lib/chart/line/LineView.js +41 -2
  64. package/lib/chart/lines/LinesSeries.js +0 -2
  65. package/lib/chart/map/MapSeries.js +14 -5
  66. package/lib/chart/pie/PieSeries.js +27 -6
  67. package/lib/chart/pie/PieView.js +22 -15
  68. package/lib/chart/pie/labelLayout.js +102 -19
  69. package/lib/chart/pie/pieLayout.js +19 -7
  70. package/lib/chart/radar/RadarSeries.js +27 -6
  71. package/lib/chart/radar/RadarView.js +3 -1
  72. package/lib/chart/sankey/SankeySeries.js +13 -1
  73. package/lib/chart/sankey/SankeyView.js +70 -32
  74. package/lib/chart/sankey/sankeyLayout.js +22 -3
  75. package/lib/chart/scatter/ScatterSeries.js +3 -1
  76. package/lib/chart/sunburst/SunburstPiece.js +5 -1
  77. package/lib/chart/sunburst/SunburstSeries.js +29 -12
  78. package/lib/chart/sunburst/SunburstView.js +5 -1
  79. package/lib/chart/themeRiver/ThemeRiverSeries.js +24 -33
  80. package/lib/chart/tree/TreeSeries.js +20 -3
  81. package/lib/chart/tree/TreeView.js +149 -23
  82. package/lib/chart/treemap/TreemapSeries.js +25 -4
  83. package/lib/chart/treemap/TreemapView.js +80 -38
  84. package/lib/chart/treemap/treemapLayout.js +1 -1
  85. package/lib/chart/treemap/treemapVisual.js +9 -15
  86. package/lib/component/axis/AngleAxisView.js +64 -7
  87. package/lib/component/axis/AxisBuilder.js +62 -24
  88. package/lib/component/axis/CartesianAxisView.js +52 -85
  89. package/lib/component/axis/RadiusAxisView.js +36 -4
  90. package/lib/component/axis/SingleAxisView.js +21 -6
  91. package/lib/component/axis/axisSplitHelper.js +132 -0
  92. package/lib/component/axisPointer/axisTrigger.js +1 -1
  93. package/lib/component/brush/BrushView.js +11 -1
  94. package/lib/component/brush/visualEncoding.js +13 -2
  95. package/lib/component/dataZoom/SliderZoomView.js +4 -10
  96. package/lib/component/helper/BrushController.js +33 -43
  97. package/lib/component/helper/MapDraw.js +30 -4
  98. package/lib/component/legend/LegendModel.js +3 -3
  99. package/lib/component/legend/LegendView.js +17 -13
  100. package/lib/component/legend/ScrollableLegendView.js +18 -18
  101. package/lib/component/marker/MarkAreaView.js +53 -15
  102. package/lib/component/marker/MarkLineModel.js +2 -1
  103. package/lib/component/marker/MarkLineView.js +3 -0
  104. package/lib/component/marker/MarkPointView.js +8 -1
  105. package/lib/component/marker/MarkerModel.js +3 -2
  106. package/lib/component/marker/markerHelper.js +7 -4
  107. package/lib/component/timeline/SliderTimelineView.js +7 -1
  108. package/lib/component/title.js +6 -2
  109. package/lib/component/toolbox/ToolboxView.js +5 -1
  110. package/lib/component/toolbox/feature/DataView.js +23 -8
  111. package/lib/component/toolbox/feature/DataZoom.js +6 -6
  112. package/lib/component/toolbox/feature/MagicType.js +20 -14
  113. package/lib/component/toolbox/feature/SaveAsImage.js +4 -2
  114. package/lib/component/tooltip/TooltipContent.js +101 -30
  115. package/lib/component/tooltip/TooltipRichContent.js +56 -8
  116. package/lib/component/tooltip/TooltipView.js +11 -12
  117. package/lib/component/visualMap/PiecewiseModel.js +3 -6
  118. package/lib/component/visualMap/VisualMapModel.js +1 -1
  119. package/lib/coord/Axis.js +30 -2
  120. package/lib/coord/View.js +9 -0
  121. package/lib/coord/axisDefault.js +22 -3
  122. package/lib/coord/axisHelper.js +24 -18
  123. package/lib/coord/calendar/Calendar.js +8 -4
  124. package/lib/coord/geo/GeoModel.js +2 -1
  125. package/lib/coord/geo/geoJSONLoader.js +3 -2
  126. package/lib/coord/geo/geoSourceManager.js +3 -2
  127. package/lib/coord/geo/parseGeoJson.js +3 -2
  128. package/lib/coord/radar/Radar.js +5 -5
  129. package/lib/data/DataDimensionInfo.js +157 -0
  130. package/lib/data/Graph.js +1 -6
  131. package/lib/data/List.js +26 -20
  132. package/lib/data/Tree.js +5 -42
  133. package/lib/data/helper/completeDimensions.js +43 -32
  134. package/lib/data/helper/createDimensions.js +2 -0
  135. package/lib/data/helper/sourceHelper.js +214 -114
  136. package/lib/echarts.js +57 -34
  137. package/lib/langEN.js +26 -0
  138. package/lib/layout/barGrid.js +19 -13
  139. package/lib/layout/barPolar.js +1 -6
  140. package/lib/loading/default.js +43 -27
  141. package/lib/model/Series.js +4 -4
  142. package/lib/model/referHelper.js +40 -12
  143. package/lib/processor/dataSample.js +1 -1
  144. package/lib/scale/Interval.js +87 -2
  145. package/lib/scale/Log.js +9 -2
  146. package/lib/scale/helper.js +1 -43
  147. package/lib/stream/Scheduler.js +10 -2
  148. package/lib/theme/dark.js +3 -0
  149. package/lib/util/format.js +19 -2
  150. package/lib/util/graphic.js +14 -12
  151. package/lib/visual/LegendVisualProvider.js +75 -0
  152. package/lib/visual/VisualMapping.js +1 -1
  153. package/lib/visual/dataColor.js +2 -12
  154. package/lib/visual/seriesColor.js +15 -7
  155. package/lib/visual/symbol.js +12 -2
  156. package/map/.DS_Store +0 -0
  157. package/map/js/.DS_Store +0 -0
  158. package/map/js/china.js +1 -1
  159. package/map/js/province/.DS_Store +0 -0
  160. package/map/js/province/chongqing.js +1 -1
  161. package/map/js/province/gansu.js +2 -2
  162. package/map/js/province/tianjin.js +1 -28
  163. package/map/json/.DS_Store +0 -0
  164. package/map/json/china.json +1 -1
  165. package/map/json/province/chongqing.json +1 -1
  166. package/map/json/province/tianjin.json +1 -1
  167. package/package.json +12 -6
  168. package/src/.DS_Store +0 -0
  169. package/src/chart/.DS_Store +0 -0
  170. package/src/chart/bar/BarSeries.js +15 -1
  171. package/src/chart/bar/BarView.js +198 -17
  172. package/src/chart/bar/BaseBarSeries.js +1 -1
  173. package/src/chart/bar/PictorialBarSeries.js +2 -2
  174. package/src/chart/candlestick/candlestickVisual.js +1 -1
  175. package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
  176. package/src/chart/funnel/FunnelSeries.js +11 -4
  177. package/src/chart/funnel/funnelLayout.js +179 -53
  178. package/src/chart/gauge/GaugeSeries.js +0 -1
  179. package/src/chart/graph/GraphSeries.js +19 -7
  180. package/src/chart/graph/GraphView.js +28 -10
  181. package/src/chart/graph/circularLayoutHelper.js +8 -2
  182. package/src/chart/graph/forceLayout.js +7 -1
  183. package/src/chart/graph/simpleLayout.js +1 -1
  184. package/src/chart/graph/simpleLayoutHelper.js +12 -5
  185. package/src/chart/heatmap/HeatmapView.js +4 -4
  186. package/src/chart/helper/EffectLine.js +23 -1
  187. package/src/chart/helper/EffectSymbol.js +2 -1
  188. package/src/chart/helper/Line.js +122 -37
  189. package/src/chart/helper/LineDraw.js +5 -1
  190. package/src/chart/helper/Symbol.js +4 -4
  191. package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
  192. package/src/chart/helper/createGraphFromNodeEdge.js +2 -1
  193. package/src/chart/helper/createListFromArray.js +13 -8
  194. package/src/chart/helper/createRenderPlanner.js +5 -2
  195. package/src/chart/helper/multipleGraphEdgeHelper.js +229 -0
  196. package/src/chart/helper/whiskerBoxCommon.js +21 -16
  197. package/src/chart/line/LineSeries.js +1 -1
  198. package/src/chart/line/LineView.js +45 -1
  199. package/src/chart/lines/LinesSeries.js +1 -3
  200. package/src/chart/map/MapSeries.js +11 -5
  201. package/src/chart/pie/PieSeries.js +26 -5
  202. package/src/chart/pie/PieView.js +20 -15
  203. package/src/chart/pie/labelLayout.js +114 -22
  204. package/src/chart/pie/pieLayout.js +20 -7
  205. package/src/chart/radar/RadarSeries.js +31 -6
  206. package/src/chart/radar/RadarView.js +4 -2
  207. package/src/chart/sankey/SankeySeries.js +12 -1
  208. package/src/chart/sankey/SankeyView.js +75 -30
  209. package/src/chart/sankey/sankeyLayout.js +25 -5
  210. package/src/chart/scatter/ScatterSeries.js +1 -1
  211. package/src/chart/sunburst/SunburstPiece.js +7 -1
  212. package/src/chart/sunburst/SunburstSeries.js +28 -15
  213. package/src/chart/sunburst/SunburstView.js +2 -1
  214. package/src/chart/themeRiver/ThemeRiverSeries.js +25 -30
  215. package/src/chart/tree/TreeSeries.js +19 -6
  216. package/src/chart/tree/TreeView.js +156 -23
  217. package/src/chart/treemap/TreemapSeries.js +23 -5
  218. package/src/chart/treemap/TreemapView.js +77 -41
  219. package/src/chart/treemap/treemapLayout.js +2 -2
  220. package/src/chart/treemap/treemapVisual.js +8 -25
  221. package/src/component/axis/AngleAxisView.js +75 -7
  222. package/src/component/axis/AxisBuilder.js +77 -32
  223. package/src/component/axis/CartesianAxisView.js +47 -83
  224. package/src/component/axis/RadiusAxisView.js +37 -4
  225. package/src/component/axis/SingleAxisView.js +21 -4
  226. package/src/component/axis/axisSplitHelper.js +114 -0
  227. package/src/component/axisPointer/axisTrigger.js +1 -1
  228. package/src/component/brush/BrushView.js +8 -1
  229. package/src/component/brush/visualEncoding.js +6 -3
  230. package/src/component/dataZoom/SliderZoomView.js +4 -9
  231. package/src/component/helper/BrushController.js +40 -47
  232. package/src/component/helper/MapDraw.js +27 -4
  233. package/src/component/legend/LegendModel.js +3 -3
  234. package/src/component/legend/LegendView.js +18 -12
  235. package/src/component/legend/ScrollableLegendView.js +18 -16
  236. package/src/component/marker/MarkAreaView.js +53 -15
  237. package/src/component/marker/MarkLineModel.js +2 -1
  238. package/src/component/marker/MarkLineView.js +3 -1
  239. package/src/component/marker/MarkPointView.js +7 -1
  240. package/src/component/marker/MarkerModel.js +3 -2
  241. package/src/component/marker/markerHelper.js +8 -5
  242. package/src/component/timeline/SliderTimelineView.js +9 -6
  243. package/src/component/title.js +4 -3
  244. package/src/component/toolbox/.DS_Store +0 -0
  245. package/src/component/toolbox/ToolboxView.js +5 -0
  246. package/src/component/toolbox/feature/DataView.js +20 -8
  247. package/src/component/toolbox/feature/DataZoom.js +6 -6
  248. package/src/component/toolbox/feature/MagicType.js +19 -13
  249. package/src/component/toolbox/feature/SaveAsImage.js +4 -2
  250. package/src/component/tooltip/TooltipContent.js +94 -28
  251. package/src/component/tooltip/TooltipRichContent.js +52 -9
  252. package/src/component/tooltip/TooltipView.js +14 -12
  253. package/src/component/visualMap/PiecewiseModel.js +5 -9
  254. package/src/component/visualMap/VisualMapModel.js +1 -1
  255. package/src/coord/Axis.js +29 -2
  256. package/src/coord/View.js +10 -1
  257. package/src/coord/axisDefault.js +26 -2
  258. package/src/coord/axisHelper.js +30 -21
  259. package/src/coord/calendar/Calendar.js +12 -5
  260. package/src/coord/geo/GeoModel.js +3 -6
  261. package/src/coord/geo/geoJSONLoader.js +3 -2
  262. package/src/coord/geo/geoSourceManager.js +3 -2
  263. package/src/coord/geo/parseGeoJson.js +3 -2
  264. package/src/coord/radar/Radar.js +6 -8
  265. package/src/data/DataDimensionInfo.js +135 -0
  266. package/src/data/Graph.js +0 -5
  267. package/src/data/List.js +30 -17
  268. package/src/data/Tree.js +6 -39
  269. package/src/data/helper/completeDimensions.js +49 -30
  270. package/src/data/helper/createDimensions.js +2 -0
  271. package/src/data/helper/sourceHelper.js +216 -124
  272. package/src/echarts.js +60 -36
  273. package/src/langEN.js +26 -0
  274. package/src/layout/barGrid.js +22 -10
  275. package/src/layout/barPolar.js +4 -6
  276. package/src/loading/default.js +46 -34
  277. package/src/model/.DS_Store +0 -0
  278. package/src/model/Series.js +4 -4
  279. package/src/model/referHelper.js +34 -11
  280. package/src/preprocessor/.DS_Store +0 -0
  281. package/src/processor/dataSample.js +1 -1
  282. package/src/scale/Interval.js +84 -4
  283. package/src/scale/Log.js +9 -2
  284. package/src/scale/helper.js +1 -39
  285. package/src/stream/Scheduler.js +9 -1
  286. package/src/theme/dark.js +3 -0
  287. package/src/util/.DS_Store +0 -0
  288. package/src/util/format.js +17 -1
  289. package/src/util/graphic.js +13 -11
  290. package/src/visual/LegendVisualProvider.js +55 -0
  291. package/src/visual/VisualMapping.js +1 -1
  292. package/src/visual/dataColor.js +0 -13
  293. package/src/visual/seriesColor.js +13 -7
  294. package/src/visual/symbol.js +11 -2
  295. package/theme/.DS_Store +0 -0
  296. package/theme/azul.js +163 -0
  297. package/theme/bee-inspired.js +178 -0
  298. package/theme/blue.js +178 -0
  299. package/theme/caravan.js +178 -0
  300. package/theme/carp.js +163 -0
  301. package/theme/cool.js +180 -0
  302. package/theme/dark-blue.js +168 -0
  303. package/theme/dark-bold.js +168 -0
  304. package/theme/dark-digerati.js +168 -0
  305. package/theme/dark-fresh-cut.js +168 -0
  306. package/theme/dark-mushroom.js +168 -0
  307. package/theme/dark.js +69 -62
  308. package/theme/eduardo.js +178 -0
  309. package/theme/forest.js +163 -0
  310. package/theme/fresh-cut.js +163 -0
  311. package/theme/fruit.js +178 -0
  312. package/theme/gray.js +220 -0
  313. package/theme/green.js +222 -0
  314. package/theme/helianthus.js +263 -0
  315. package/theme/infographic.js +72 -57
  316. package/theme/inspired.js +163 -0
  317. package/theme/jazz.js +163 -0
  318. package/theme/london.js +163 -0
  319. package/theme/macarons.js +80 -57
  320. package/theme/macarons2.js +251 -0
  321. package/theme/mint.js +155 -0
  322. package/theme/red-velvet.js +163 -0
  323. package/theme/red.js +225 -0
  324. package/theme/roma.js +55 -22
  325. package/theme/royal.js +163 -0
  326. package/theme/sakura.js +140 -0
  327. package/theme/shine.js +52 -45
  328. package/theme/tech-blue.js +180 -0
  329. package/theme/vintage.js +37 -23
@@ -153,12 +153,6 @@ function BrushController(zr) {
153
153
  */
154
154
 
155
155
  this._dragging;
156
- /**
157
- * @private
158
- * @type {Object}
159
- */
160
-
161
- this._lastMouseMovePoint = {};
162
156
  /**
163
157
  * @private
164
158
  * @type {Array}
@@ -200,7 +194,7 @@ function BrushController(zr) {
200
194
  */
201
195
 
202
196
  this._handlers = {};
203
- each(mouseHandlers, function (handler, eventName) {
197
+ each(pointerHandlers, function (handler, eventName) {
204
198
  this._handlers[eventName] = zrUtil.bind(handler, this);
205
199
  }, this);
206
200
  }
@@ -351,9 +345,7 @@ function doEnableBrush(controller, brushOption) {
351
345
  interactionMutex.take(zr, MUTEX_RESOURCE_KEY, controller._uid);
352
346
  }
353
347
 
354
- each(controller._handlers, function (handler, eventName) {
355
- zr.on(eventName, handler);
356
- });
348
+ mountHandlers(zr, controller._handlers);
357
349
  controller._brushType = brushOption.brushType;
358
350
  controller._brushOption = zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true);
359
351
  }
@@ -361,10 +353,20 @@ function doEnableBrush(controller, brushOption) {
361
353
  function doDisableBrush(controller) {
362
354
  var zr = controller._zr;
363
355
  interactionMutex.release(zr, MUTEX_RESOURCE_KEY, controller._uid);
364
- each(controller._handlers, function (handler, eventName) {
356
+ unmountHandlers(zr, controller._handlers);
357
+ controller._brushType = controller._brushOption = null;
358
+ }
359
+
360
+ function mountHandlers(zr, handlers) {
361
+ each(handlers, function (handler, eventName) {
362
+ zr.on(eventName, handler);
363
+ });
364
+ }
365
+
366
+ function unmountHandlers(zr, handlers) {
367
+ each(handlers, function (handler, eventName) {
365
368
  zr.off(eventName, handler);
366
369
  });
367
- controller._brushType = controller._brushOption = null;
368
370
  }
369
371
 
370
372
  function createCover(controller, brushOption) {
@@ -667,8 +669,11 @@ function pointsToRect(points) {
667
669
  }
668
670
 
669
671
  function resetCursor(controller, e, localCursorPoint) {
670
- // Check active
671
- if (!controller._brushType) {
672
+ if ( // Check active
673
+ !controller._brushType // resetCursor should be always called when mouse is in zr area,
674
+ // but not called when mouse is out of zr area to avoid bad influence
675
+ // if `mousemove`, `mouseup` are triggered from `document` event.
676
+ || isOutsideZrArea(controller, e)) {
672
677
  return;
673
678
  }
674
679
 
@@ -758,7 +763,7 @@ function determineBrushType(brushType, panel) {
758
763
  return brushType;
759
764
  }
760
765
 
761
- var mouseHandlers = {
766
+ var pointerHandlers = {
762
767
  mousedown: function (e) {
763
768
  if (this._dragging) {
764
769
  // In case some browser do not support globalOut,
@@ -777,10 +782,9 @@ var mouseHandlers = {
777
782
  }
778
783
  },
779
784
  mousemove: function (e) {
780
- var lastPoint = this._lastMouseMovePoint;
781
- lastPoint.x = e.offsetX;
782
- lastPoint.y = e.offsetY;
783
- var localCursorPoint = this.group.transformCoordToLocal(lastPoint.x, lastPoint.y);
785
+ var x = e.offsetX;
786
+ var y = e.offsetY;
787
+ var localCursorPoint = this.group.transformCoordToLocal(x, y);
784
788
  resetCursor(this, e, localCursorPoint);
785
789
 
786
790
  if (this._dragging) {
@@ -791,34 +795,15 @@ var mouseHandlers = {
791
795
  },
792
796
  mouseup: function (e) {
793
797
  handleDragEnd(this, e);
794
- },
795
- globalout: function (e) {
796
- handleDragEnd(this, e, true);
797
798
  }
798
799
  };
799
800
 
800
- function handleDragEnd(controller, e, isGlobalOut) {
801
+ function handleDragEnd(controller, e) {
801
802
  if (controller._dragging) {
802
- // Just be worried about bring some side effect to the world
803
- // out of echarts, we do not `preventDefault` for globalout.
804
- !isGlobalOut && preventDefault(e);
805
- var pointerX = e.offsetX;
806
- var pointerY = e.offsetY;
807
- var lastPoint = controller._lastMouseMovePoint;
808
-
809
- if (isGlobalOut) {
810
- pointerX = lastPoint.x;
811
- pointerY = lastPoint.y;
812
- }
813
-
814
- var localCursorPoint = controller.group.transformCoordToLocal(pointerX, pointerY); // FIXME
815
- // Here `e` is used only in `onIrrelevantElement` finally. And it's OK
816
- // that pass the `e` of `globalout` to `onIrrelevantElement`. But it is
817
- // not a good design of these interfaces. However, we do not refactor
818
- // these code now because the implementation of `onIrrelevantElement`
819
- // need to be discussed and probably be changed in future, becuase it
820
- // slows down the performance of zrender in some cases.
821
-
803
+ preventDefault(e);
804
+ var x = e.offsetX;
805
+ var y = e.offsetY;
806
+ var localCursorPoint = controller.group.transformCoordToLocal(x, y);
822
807
  var eventParams = updateCoverByMouse(controller, e, localCursorPoint, true);
823
808
  controller._dragging = false;
824
809
  controller._track = [];
@@ -827,6 +812,11 @@ function handleDragEnd(controller, e, isGlobalOut) {
827
812
  eventParams && trigger(controller, eventParams);
828
813
  }
829
814
  }
815
+
816
+ function isOutsideZrArea(controller, x, y) {
817
+ var zr = controller._zr;
818
+ return x < 0 || x > zr.getWidth() || y < 0 || y > zr.getHeight();
819
+ }
830
820
  /**
831
821
  * key: brushType
832
822
  * @type {Object}
@@ -36,6 +36,8 @@ var _component = require("../../util/component");
36
36
 
37
37
  var getUID = _component.getUID;
38
38
 
39
+ var Transformable = require("zrender/lib/mixin/Transformable");
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
@@ -206,14 +208,29 @@ MapDraw.prototype = {
206
208
 
207
209
  var regionsGroup = this._regionsGroup;
208
210
  var group = this.group;
211
+ var transformInfo = geo.getTransformInfo(); // No animation when first draw or in action
212
+
213
+ var isFirstDraw = !regionsGroup.childAt(0) || payload;
214
+ var targetScale;
209
215
 
210
- if (geo._roamTransformable.transform) {
211
- group.transform = geo._roamTransformable.transform.slice();
216
+ if (isFirstDraw) {
217
+ group.transform = transformInfo.roamTransform;
212
218
  group.decomposeTransform();
219
+ group.dirty();
220
+ } else {
221
+ var target = new Transformable();
222
+ target.transform = transformInfo.roamTransform;
223
+ target.decomposeTransform();
224
+ var props = {
225
+ scale: target.scale,
226
+ position: target.position
227
+ };
228
+ targetScale = target.scale;
229
+ graphic.updateProps(group, props, mapOrGeoModel);
213
230
  }
214
231
 
215
- var scale = geo._rawTransformable.scale;
216
- var position = geo._rawTransformable.position;
232
+ var scale = transformInfo.rawScale;
233
+ var position = transformInfo.rawPosition;
217
234
  regionsGroup.removeAll();
218
235
  var itemStyleAccessPath = ['itemStyle'];
219
236
  var hoverItemStyleAccessPath = ['emphasis', 'itemStyle'];
@@ -333,6 +350,15 @@ MapDraw.prototype = {
333
350
  textAlign: 'center',
334
351
  textVerticalAlign: 'middle'
335
352
  });
353
+
354
+ if (!isFirstDraw) {
355
+ // Text animation
356
+ var textScale = [1 / targetScale[0], 1 / targetScale[1]];
357
+ graphic.updateProps(textEl, {
358
+ scale: textScale
359
+ }, mapOrGeoModel);
360
+ }
361
+
336
362
  regionGroup.add(textEl);
337
363
  } // setItemGraphicEl, setHoverStyle after all polygons and labels
338
364
  // are added to the rigionGroup
@@ -131,9 +131,9 @@ var LegendModel = echarts.extendComponentModel({
131
131
  availableNames.push(seriesName);
132
132
  var isPotential;
133
133
 
134
- if (seriesModel.legendDataProvider) {
135
- var data = seriesModel.legendDataProvider();
136
- var names = data.mapArray(data.getName);
134
+ if (seriesModel.legendVisualProvider) {
135
+ var provider = seriesModel.legendVisualProvider;
136
+ var names = provider.getAllNames();
137
137
 
138
138
  if (!ecModel.isSeriesFiltered(seriesModel)) {
139
139
  availableNames = availableNames.concat(names);
@@ -191,7 +191,7 @@ var _default = echarts.extendComponentView({
191
191
  if (legendDrawnMap.get(name)) {
192
192
  // Have been drawed
193
193
  return;
194
- } // Series legend
194
+ } // Legend to control series.
195
195
 
196
196
 
197
197
  if (seriesModel) {
@@ -216,32 +216,32 @@ var _default = echarts.extendComponentView({
216
216
 
217
217
  var itemGroup = this._createItem(name, dataIndex, itemModel, legendModel, legendSymbolType, symbolType, itemAlign, color, borderColor, selectMode);
218
218
 
219
- itemGroup.on('click', curry(dispatchSelectAction, name, api)).on('mouseover', curry(dispatchHighlightAction, seriesModel.name, null, api, excludeSeriesId)).on('mouseout', curry(dispatchDownplayAction, seriesModel.name, null, api, excludeSeriesId));
219
+ itemGroup.on('click', curry(dispatchSelectAction, name, null, api, excludeSeriesId)).on('mouseover', curry(dispatchHighlightAction, seriesModel.name, null, api, excludeSeriesId)).on('mouseout', curry(dispatchDownplayAction, seriesModel.name, null, api, excludeSeriesId));
220
220
  legendDrawnMap.set(name, true);
221
221
  } else {
222
- // Data legend of pie, funnel
222
+ // Legend to control data. In pie and funnel.
223
223
  ecModel.eachRawSeries(function (seriesModel) {
224
224
  // In case multiple series has same data name
225
225
  if (legendDrawnMap.get(name)) {
226
226
  return;
227
227
  }
228
228
 
229
- if (seriesModel.legendDataProvider) {
230
- var data = seriesModel.legendDataProvider();
231
- var idx = data.indexOfName(name);
229
+ if (seriesModel.legendVisualProvider) {
230
+ var provider = seriesModel.legendVisualProvider;
232
231
 
233
- if (idx < 0) {
232
+ if (!provider.containName(name)) {
234
233
  return;
235
234
  }
236
235
 
237
- var color = data.getItemVisual(idx, 'color');
238
- var borderColor = data.getItemVisual(idx, 'borderColor');
236
+ var idx = provider.indexOfName(name);
237
+ var color = provider.getItemVisual(idx, 'color');
238
+ var borderColor = provider.getItemVisual(idx, 'borderColor');
239
239
  var legendSymbolType = 'roundRect';
240
240
 
241
241
  var itemGroup = this._createItem(name, dataIndex, itemModel, legendModel, legendSymbolType, null, itemAlign, color, borderColor, selectMode); // FIXME: consider different series has items with the same name.
242
242
 
243
243
 
244
- itemGroup.on('click', curry(dispatchSelectAction, name, api)) // Should not specify the series name, consider legend controls
244
+ itemGroup.on('click', curry(dispatchSelectAction, null, name, api, excludeSeriesId)) // Should not specify the series name, consider legend controls
245
245
  // more than one pie series.
246
246
  .on('mouseover', curry(dispatchHighlightAction, null, name, api, excludeSeriesId)).on('mouseout', curry(dispatchDownplayAction, null, name, api, excludeSeriesId));
247
247
  legendDrawnMap.set(name, true);
@@ -442,11 +442,15 @@ function setSymbolStyle(symbol, symbolType, legendModelItemStyle, borderColor, i
442
442
  return symbol.setStyle(itemStyle);
443
443
  }
444
444
 
445
- function dispatchSelectAction(name, api) {
445
+ function dispatchSelectAction(seriesName, dataName, api, excludeSeriesId) {
446
+ // downplay before unselect
447
+ dispatchDownplayAction(seriesName, dataName, api, excludeSeriesId);
446
448
  api.dispatchAction({
447
449
  type: 'legendToggleSelect',
448
- name: name
449
- });
450
+ name: seriesName != null ? seriesName : dataName
451
+ }); // highlight after select
452
+
453
+ dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId);
450
454
  }
451
455
 
452
456
  function dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId) {
@@ -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 defaultIndex. 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
  });
@@ -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
 
@@ -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'
@@ -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) {
@@ -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
@@ -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
  /**
@@ -28,6 +28,10 @@ var _layout = require("../util/layout");
28
28
 
29
29
  var getLayoutRect = _layout.getLayoutRect;
30
30
 
31
+ var _format = require("../util/format");
32
+
33
+ var windowOpen = _format.windowOpen;
34
+
31
35
  /*
32
36
  * Licensed to the Apache Software Foundation (ASF) under one
33
37
  * or more contributor license agreements. See the NOTICE file
@@ -150,13 +154,13 @@ echarts.extendComponentView({
150
154
 
151
155
  if (link) {
152
156
  textEl.on('click', function () {
153
- window.open(link, '_' + titleModel.get('target'));
157
+ windowOpen(link, '_' + titleModel.get('target'));
154
158
  });
155
159
  }
156
160
 
157
161
  if (sublink) {
158
162
  subTextEl.on('click', function () {
159
- window.open(sublink, '_' + titleModel.get('subtarget'));
163
+ windowOpen(sublink, '_' + titleModel.get('subtarget'));
160
164
  });
161
165
  }
162
166
 
@@ -78,7 +78,11 @@ var _default = echarts.extendComponentView({
78
78
  var oldName = featureNames[oldIndex];
79
79
  var featureOpt = featureOpts[featureName];
80
80
  var featureModel = new Model(featureOpt, toolboxModel, toolboxModel.ecModel);
81
- var feature;
81
+ var feature; // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
82
+
83
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
84
+ featureOpt.title = payload.newTitle;
85
+ }
82
86
 
83
87
  if (featureName && !oldName) {
84
88
  // Create
@@ -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
  }