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
@@ -294,8 +294,10 @@ export default MarkerView.extend({
294
294
  ]);
295
295
 
296
296
  lineData.setItemVisual(idx, {
297
+ 'fromSymbolRotate': fromData.getItemVisual(idx, 'symbolRotate'),
297
298
  'fromSymbolSize': fromData.getItemVisual(idx, 'symbolSize'),
298
299
  'fromSymbol': fromData.getItemVisual(idx, 'symbol'),
300
+ 'toSymbolRotate': toData.getItemVisual(idx, 'symbolRotate'),
299
301
  'toSymbolSize': toData.getItemVisual(idx, 'symbolSize'),
300
302
  'toSymbol': toData.getItemVisual(idx, 'symbol')
301
303
  });
@@ -317,8 +319,8 @@ export default MarkerView.extend({
317
319
  updateSingleMarkerEndLayout(
318
320
  data, idx, isFrom, seriesModel, api
319
321
  );
320
-
321
322
  data.setItemVisual(idx, {
323
+ symbolRotate: itemModel.get('symbolRotate'),
322
324
  symbolSize: itemModel.get('symbolSize') || symbolSize[isFrom ? 0 : 1],
323
325
  symbol: itemModel.get('symbol', true) || symbolType[isFrom ? 0 : 1],
324
326
  color: itemModel.get('itemStyle.color') || seriesData.getVisual('color')
@@ -104,10 +104,12 @@ export default MarkerView.extend({
104
104
  var itemModel = mpData.getItemModel(idx);
105
105
  var symbol = itemModel.getShallow('symbol');
106
106
  var symbolSize = itemModel.getShallow('symbolSize');
107
+ var symbolRotate = itemModel.getShallow('symbolRotate');
107
108
  var isFnSymbol = zrUtil.isFunction(symbol);
108
109
  var isFnSymbolSize = zrUtil.isFunction(symbolSize);
110
+ var isFnSymbolRotate = zrUtil.isFunction(symbolRotate);
109
111
 
110
- if (isFnSymbol || isFnSymbolSize) {
112
+ if (isFnSymbol || isFnSymbolSize || isFnSymbolRotate) {
111
113
  var rawIdx = mpModel.getRawValue(idx);
112
114
  var dataParams = mpModel.getDataParams(idx);
113
115
  if (isFnSymbol) {
@@ -117,11 +119,15 @@ export default MarkerView.extend({
117
119
  // FIXME 这里不兼容 ECharts 2.x,2.x 貌似参数是整个数据?
118
120
  symbolSize = symbolSize(rawIdx, dataParams);
119
121
  }
122
+ if (isFnSymbolRotate) {
123
+ symbolRotate = symbolRotate(rawIdx, dataParams);
124
+ }
120
125
  }
121
126
 
122
127
  mpData.setItemVisual(idx, {
123
128
  symbol: symbol,
124
129
  symbolSize: symbolSize,
130
+ symbolRotate: symbolRotate,
125
131
  color: itemModel.get('itemStyle.color')
126
132
  || seriesData.getVisual('color')
127
133
  });
@@ -121,15 +121,16 @@ var MarkerModel = echarts.extendComponentModel({
121
121
  }
122
122
  },
123
123
 
124
- formatTooltip: function (dataIndex) {
124
+ formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
125
125
  var data = this.getData();
126
126
  var value = this.getRawValue(dataIndex);
127
127
  var formattedValue = zrUtil.isArray(value)
128
128
  ? zrUtil.map(value, addCommas).join(', ') : addCommas(value);
129
129
  var name = data.getName(dataIndex);
130
130
  var html = encodeHTML(this.name);
131
+ var newLine = renderMode === 'html' ? '<br/>' : '\n';
131
132
  if (value != null || name) {
132
- html += '<br />';
133
+ html += newLine;
133
134
  }
134
135
  if (name) {
135
136
  html += encodeHTML(name);
@@ -69,8 +69,8 @@ function markerTypeCalculatorWithExtent(
69
69
 
70
70
  var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];
71
71
  coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);
72
- coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex);
73
-
72
+ coordArr[targetCoordIndex] = data.get(calcDataDim, dataIndex);
73
+ var coordArrValue = data.get(targetDataDim, dataIndex);
74
74
  // Make it simple, do not visit all stacked value to count precision.
75
75
  var precision = numberUtil.getPrecision(data.get(targetDataDim, dataIndex));
76
76
  precision = Math.min(precision, 20);
@@ -78,7 +78,7 @@ function markerTypeCalculatorWithExtent(
78
78
  coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
79
79
  }
80
80
 
81
- return coordArr;
81
+ return [coordArr, coordArrValue];
82
82
  }
83
83
 
84
84
  var curry = zrUtil.curry;
@@ -141,12 +141,15 @@ export function dataTransform(seriesModel, item) {
141
141
  var otherCoordIndex = indexOf(dims, axisInfo.baseAxis.dim);
142
142
  var targetCoordIndex = indexOf(dims, axisInfo.valueAxis.dim);
143
143
 
144
- item.coord = markerTypeCalculator[item.type](
144
+ var coordInfo = markerTypeCalculator[item.type](
145
145
  data, axisInfo.baseDataDim, axisInfo.valueDataDim,
146
146
  otherCoordIndex, targetCoordIndex
147
147
  );
148
+ item.coord = coordInfo[0];
148
149
  // Force to use the value of calculated value.
149
- item.value = item.coord[targetCoordIndex];
150
+ // let item use the value without stack.
151
+ item.value = coordInfo[1];
152
+
150
153
  }
151
154
  else {
152
155
  // FIXME Only has one of xAxis and yAxis.
@@ -618,13 +618,16 @@ function getViewRect(model, api) {
618
618
  }
619
619
 
620
620
  function makeIcon(timelineModel, objPath, rect, opts) {
621
- var icon = graphic.makePath(
622
- timelineModel.get(objPath).replace(/^path:\/\//, ''),
623
- zrUtil.clone(opts || {}),
624
- new BoundingRect(rect[0], rect[1], rect[2], rect[3]),
625
- 'center'
621
+ var style = opts.style;
622
+ var icon = graphic.createIcon(
623
+ timelineModel.get(objPath),
624
+ opts || {},
625
+ new BoundingRect(rect[0], rect[1], rect[2], rect[3])
626
626
  );
627
-
627
+ // TODO createIcon won't use style in opt.
628
+ if (style) {
629
+ icon.setStyle(style);
630
+ }
628
631
  return icon;
629
632
  }
630
633
 
@@ -21,6 +21,7 @@ import * as zrUtil from 'zrender/src/core/util';
21
21
  import * as echarts from '../echarts';
22
22
  import * as graphic from '../util/graphic';
23
23
  import {getLayoutRect} from '../util/layout';
24
+ import {windowOpen} from '../util/format';
24
25
 
25
26
  // Model
26
27
  echarts.extendComponentModel({
@@ -143,12 +144,12 @@ echarts.extendComponentView({
143
144
 
144
145
  if (link) {
145
146
  textEl.on('click', function () {
146
- window.open(link, '_' + titleModel.get('target'));
147
+ windowOpen(link, '_' + titleModel.get('target'));
147
148
  });
148
149
  }
149
150
  if (sublink) {
150
151
  subTextEl.on('click', function () {
151
- window.open(sublink, '_' + titleModel.get('subtarget'));
152
+ windowOpen(sublink, '_' + titleModel.get('subtarget'));
152
153
  });
153
154
  }
154
155
 
@@ -232,4 +233,4 @@ echarts.extendComponentView({
232
233
 
233
234
  group.add(rect);
234
235
  }
235
- });
236
+ });
Binary file
@@ -63,6 +63,11 @@ export default echarts.extendComponentView({
63
63
  var featureModel = new Model(featureOpt, toolboxModel, toolboxModel.ecModel);
64
64
  var feature;
65
65
 
66
+ // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
67
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
68
+ featureOpt.title = payload.newTitle;
69
+ }
70
+
66
71
  if (featureName && !oldName) { // Create
67
72
  if (isUserFeatureName(featureName)) {
68
73
  feature = {
@@ -93,7 +93,8 @@ function assembleSeriesWithCategoryAxis(series) {
93
93
  }));
94
94
  var columns = [categoryAxis.model.getCategories()];
95
95
  zrUtil.each(group.series, function (series) {
96
- columns.push(series.getRawData().mapArray(valueAxisDim, function (val) {
96
+ var rawData = series.getRawData();
97
+ columns.push(series.getRawData().mapArray(rawData.mapDimension(valueAxisDim), function (val) {
97
98
  return val;
98
99
  }));
99
100
  });
@@ -211,7 +212,13 @@ function parseListContents(str) {
211
212
 
212
213
  var data = [];
213
214
  for (var i = 0; i < lines.length; i++) {
214
- var items = trim(lines[i]).split(itemSplitRegex);
215
+ // if line is empty, ignore it.
216
+ // there is a case that a user forgot to delete `\n`.
217
+ var line = trim(lines[i]);
218
+ if (!line) {
219
+ continue;
220
+ }
221
+ var items = line.split(itemSplitRegex);
215
222
  var name = '';
216
223
  var value;
217
224
  var hasName = false;
@@ -426,13 +433,18 @@ function tryMergeDataOption(newData, originalData) {
426
433
  return zrUtil.map(newData, function (newVal, idx) {
427
434
  var original = originalData && originalData[idx];
428
435
  if (zrUtil.isObject(original) && !zrUtil.isArray(original)) {
429
- if (zrUtil.isObject(newVal) && !zrUtil.isArray(newVal)) {
430
- newVal = newVal.value;
436
+ var newValIsObject = zrUtil.isObject(newVal) && !zrUtil.isArray(newVal);
437
+ if (!newValIsObject) {
438
+ newVal = {
439
+ value: newVal
440
+ };
431
441
  }
442
+ // original data has name but new data has no name
443
+ var shouldDeleteName = original.name != null && newVal.name == null;
432
444
  // Original data has option
433
- return zrUtil.defaults({
434
- value: newVal
435
- }, original);
445
+ newVal = zrUtil.defaults(newVal, original);
446
+ shouldDeleteName && (delete newVal.name);
447
+ return newVal;
436
448
  }
437
449
  else {
438
450
  return newVal;
@@ -472,4 +484,4 @@ echarts.registerAction({
472
484
  }, payload.newOption));
473
485
  });
474
486
 
475
- export default DataView;
487
+ export default DataView;
@@ -61,7 +61,11 @@ DataZoom.defaultOption = {
61
61
  back: 'M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26'
62
62
  },
63
63
  // `zoom`, `back`
64
- title: zrUtil.clone(dataZoomLang.title)
64
+ title: zrUtil.clone(dataZoomLang.title),
65
+ brushStyle: {
66
+ borderWidth: 0,
67
+ color: 'rgba(0,0,0,0.2)'
68
+ }
65
69
  };
66
70
 
67
71
  var proto = DataZoom.prototype;
@@ -236,11 +240,7 @@ function updateZoomBtnStatus(featureModel, ecModel, view, payload, api) {
236
240
  zoomActive
237
241
  ? {
238
242
  brushType: 'auto',
239
- brushStyle: {
240
- // FIXME user customized?
241
- lineWidth: 0,
242
- fill: 'rgba(0,0,0,0.2)'
243
- }
243
+ brushStyle: featureModel.getModel('brushStyle').getItemStyle()
244
244
  }
245
245
  : false
246
246
  );
@@ -23,6 +23,7 @@ import lang from '../../../lang';
23
23
  import * as featureManager from '../featureManager';
24
24
 
25
25
  var magicTypeLang = lang.toolbox.magicType;
26
+ var INNER_STACK_KEYWORD = '__ec_magicType_stack__';
26
27
 
27
28
  function MagicType(model) {
28
29
  this.model = model;
@@ -36,8 +37,7 @@ MagicType.defaultOption = {
36
37
  /* eslint-disable */
37
38
  line: 'M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4',
38
39
  bar: 'M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7',
39
- stack: 'M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z', // jshint ignore:line
40
- tiled: 'M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z'
40
+ stack: 'M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z' // jshint ignore:line
41
41
  /* eslint-enable */
42
42
  },
43
43
  // `line`, `bar`, `stack`, `tiled`
@@ -88,26 +88,20 @@ var seriesOptGenreator = {
88
88
  }
89
89
  },
90
90
  'stack': function (seriesType, seriesId, seriesModel, model) {
91
+ var isStack = seriesModel.get('stack') === INNER_STACK_KEYWORD;
91
92
  if (seriesType === 'line' || seriesType === 'bar') {
93
+ model.setIconStatus('stack', isStack ? 'normal' : 'emphasis');
92
94
  return zrUtil.merge({
93
95
  id: seriesId,
94
- stack: '__ec_magicType_stack__'
96
+ stack: isStack ? '' : INNER_STACK_KEYWORD
95
97
  }, model.get('option.stack') || {}, true);
96
98
  }
97
- },
98
- 'tiled': function (seriesType, seriesId, seriesModel, model) {
99
- if (seriesType === 'line' || seriesType === 'bar') {
100
- return zrUtil.merge({
101
- id: seriesId,
102
- stack: ''
103
- }, model.get('option.tiled') || {}, true);
104
- }
105
99
  }
106
100
  };
107
101
 
108
102
  var radioTypes = [
109
103
  ['line', 'bar'],
110
- ['stack', 'tiled']
104
+ ['stack']
111
105
  ];
112
106
 
113
107
  proto.onclick = function (ecModel, api, type) {
@@ -172,10 +166,22 @@ proto.onclick = function (ecModel, api, type) {
172
166
  }
173
167
  }, generateNewSeriesTypes
174
168
  );
169
+
170
+ var newTitle;
171
+ // Change title of stack
172
+ if (type === 'stack') {
173
+ var isStack = newOption.series && newOption.series[0] && newOption.series[0].stack === INNER_STACK_KEYWORD;
174
+ newTitle = isStack
175
+ ? zrUtil.merge({ stack: magicTypeLang.title.tiled }, magicTypeLang.title)
176
+ : zrUtil.clone(magicTypeLang.title);
177
+ }
178
+
175
179
  api.dispatchAction({
176
180
  type: 'changeMagicType',
177
181
  currentType: type,
178
- newOption: newOption
182
+ newOption: newOption,
183
+ newTitle: newTitle,
184
+ featureName: 'magicType'
179
185
  });
180
186
  };
181
187
 
@@ -50,7 +50,8 @@ var proto = SaveAsImage.prototype;
50
50
  proto.onclick = function (ecModel, api) {
51
51
  var model = this.model;
52
52
  var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
53
- var type = model.get('type', true) || 'png';
53
+ var isSvg = api.getZr().painter.getType() === 'svg';
54
+ var type = isSvg ? 'svg' : model.get('type', true) || 'png';
54
55
  var url = api.getConnectedDataURL({
55
56
  type: type,
56
57
  backgroundColor: model.get('backgroundColor', true)
@@ -66,7 +67,8 @@ proto.onclick = function (ecModel, api) {
66
67
  $a.target = '_blank';
67
68
  $a.href = url;
68
69
  var evt = new MouseEvent('click', {
69
- view: window,
70
+ // some micro front-end framework, window maybe is a Proxy
71
+ view: document.defaultView,
70
72
  bubbles: true,
71
73
  cancelable: false
72
74
  });
@@ -20,6 +20,7 @@
20
20
  import * as zrUtil from 'zrender/src/core/util';
21
21
  import * as zrColor from 'zrender/src/tool/color';
22
22
  import * as eventUtil from 'zrender/src/core/event';
23
+ import * as domUtil from 'zrender/src/core/dom';
23
24
  import env from 'zrender/src/core/env';
24
25
  import * as formatUtil from '../../util/format';
25
26
 
@@ -59,8 +60,21 @@ function assembleFont(textStyleModel) {
59
60
 
60
61
  cssText.push('font:' + textStyleModel.getFont());
61
62
 
63
+ var lineHeight = textStyleModel.get('lineHeight');
64
+ if (lineHeight == null) {
65
+ lineHeight = Math.round(fontSize * 3 / 2);
66
+ }
67
+
62
68
  fontSize
63
- && cssText.push('line-height:' + Math.round(fontSize * 3 / 2) + 'px');
69
+ && cssText.push('line-height:' + lineHeight + 'px');
70
+
71
+ var shadowColor = textStyleModel.get('textShadowColor');
72
+ var shadowBlur = textStyleModel.get('textShadowBlur') || 0;
73
+ var shadowOffsetX = textStyleModel.get('textShadowOffsetX') || 0;
74
+ var shadowOffsetY = textStyleModel.get('textShadowOffsetY') || 0;
75
+ shadowBlur
76
+ && cssText.push('text-shadow:' + shadowOffsetX + 'px ' + shadowOffsetY + 'px '
77
+ + shadowBlur + 'px ' + shadowColor);
64
78
 
65
79
  each(['decoration', 'align'], function (name) {
66
80
  var val = textStyleModel.get(name);
@@ -121,24 +135,65 @@ function assembleCssText(tooltipModel) {
121
135
  return cssText.join(';') + ';';
122
136
  }
123
137
 
138
+ // If not able to make, do not modify the input `out`.
139
+ function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
140
+ var zrPainter = zr && zr.painter;
141
+
142
+ if (appendToBody) {
143
+ var zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
144
+ if (zrViewportRoot) {
145
+ // Some APPs might use scale on body, so we support CSS transform here.
146
+ domUtil.transformLocalCoord(out, zrViewportRoot, document.body, zrX, zrY);
147
+ }
148
+ }
149
+ else {
150
+ out[0] = zrX;
151
+ out[1] = zrY;
152
+ // xy should be based on canvas root. But tooltipContent is
153
+ // the sibling of canvas root. So padding of ec container
154
+ // should be considered here.
155
+ var viewportRootOffset = zrPainter && zrPainter.getViewportRootOffset();
156
+ if (viewportRootOffset) {
157
+ out[0] += viewportRootOffset.offsetLeft;
158
+ out[1] += viewportRootOffset.offsetTop;
159
+ }
160
+ }
161
+ out[2] = out[0] / zr.getWidth(); // The ratio of left to width
162
+ out[3] = out[1] / zr.getHeight(); // The ratio of top to height
163
+ }
164
+
124
165
  /**
125
166
  * @alias module:echarts/component/tooltip/TooltipContent
167
+ * @param {HTMLElement} container
168
+ * @param {ExtensionAPI} api
169
+ * @param {Object} [opt]
170
+ * @param {boolean} [opt.appendToBody]
171
+ * `false`: the DOM element will be inside the container. Default value.
172
+ * `true`: the DOM element will be appended to HTML body, which avoid
173
+ * some overflow clip but intrude outside of the container.
126
174
  * @constructor
127
175
  */
128
- function TooltipContent(container, api) {
176
+ function TooltipContent(container, api, opt) {
129
177
  if (env.wxa) {
130
178
  return null;
131
179
  }
132
180
 
133
181
  var el = document.createElement('div');
182
+ el.domBelongToZr = true;
183
+ this.el = el;
134
184
  var zr = this._zr = api.getZr();
185
+ var appendToBody = this._appendToBody = opt && opt.appendToBody;
135
186
 
136
- this.el = el;
187
+ this._styleCoord = [0, 0, 0, 0]; // [left, top, left/width, top/height]
137
188
 
138
- this._x = api.getWidth() / 2;
139
- this._y = api.getHeight() / 2;
189
+ makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
140
190
 
141
- container.appendChild(el);
191
+ if (appendToBody) {
192
+ document.body.appendChild(el);
193
+ }
194
+ else {
195
+ container.appendChild(el);
196
+ }
142
197
 
143
198
  this._container = container;
144
199
 
@@ -172,7 +227,8 @@ function TooltipContent(container, api) {
172
227
  // Try trigger zrender event to avoid mouse
173
228
  // in and out shape too frequently
174
229
  var handler = zr.handler;
175
- eventUtil.normalizeEvent(container, e, true);
230
+ var zrViewportRoot = zr.painter.getViewportRoot();
231
+ eventUtil.normalizeEvent(zrViewportRoot, e, true);
176
232
  handler.dispatch('mousemove', e);
177
233
  }
178
234
  };
@@ -199,7 +255,7 @@ TooltipContent.prototype = {
199
255
  /**
200
256
  * Update when tooltip is rendered
201
257
  */
202
- update: function () {
258
+ update: function (tooltipModel) {
203
259
  // FIXME
204
260
  // Move this logic to ec main?
205
261
  var container = this._container;
@@ -209,28 +265,43 @@ TooltipContent.prototype = {
209
265
  if (domStyle.position !== 'absolute' && stl.position !== 'absolute') {
210
266
  domStyle.position = 'relative';
211
267
  }
268
+ var alwaysShowContent = tooltipModel.get('alwaysShowContent');
269
+ alwaysShowContent && this._moveTooltipIfResized();
212
270
  // Hide the tooltip
213
271
  // PENDING
214
272
  // this.hide();
215
273
  },
216
274
 
275
+ /**
276
+ * when `alwaysShowContent` is true,
277
+ * we should move the tooltip after chart resized
278
+ */
279
+ _moveTooltipIfResized: function () {
280
+ var ratioX = this._styleCoord[2]; // The ratio of left to width
281
+ var ratioY = this._styleCoord[3]; // The ratio of top to height
282
+ var realX = ratioX * this._zr.getWidth();
283
+ var realY = ratioY * this._zr.getHeight();
284
+ this.moveTo(realX, realY);
285
+ },
286
+
217
287
  show: function (tooltipModel) {
218
288
  clearTimeout(this._hideTimeout);
219
289
  var el = this.el;
290
+ var styleCoord = this._styleCoord;
220
291
 
221
292
  el.style.cssText = gCssText + assembleCssText(tooltipModel)
222
293
  // Because of the reason described in:
223
294
  // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore
224
295
  // we should set initial value to `left` and `top`.
225
- + ';left:' + this._x + 'px;top:' + this._y + 'px;'
296
+ + ';left:' + styleCoord[0] + 'px;top:' + styleCoord[1] + 'px;'
226
297
  + (tooltipModel.get('extraCssText') || '');
227
298
 
228
299
  el.style.display = el.innerHTML ? 'block' : 'none';
229
300
 
230
- // If mouse occsionally move over the tooltip, a mouseout event will be
231
- // triggered by canvas, and cuase some unexpectable result like dragging
301
+ // If mouse occasionally move over the tooltip, a mouseout event will be
302
+ // triggered by canvas, and cause some unexpectable result like dragging
232
303
  // stop, "unfocusAdjacency". Here `pointer-events: none` is used to solve
233
- // it. Although it is not suppored by IE8~IE10, fortunately it is a rare
304
+ // it. Although it is not supported by IE8~IE10, fortunately it is a rare
234
305
  // scenario.
235
306
  el.style.pointerEvents = this._enterable ? 'auto' : 'none';
236
307
 
@@ -250,23 +321,13 @@ TooltipContent.prototype = {
250
321
  return [el.clientWidth, el.clientHeight];
251
322
  },
252
323
 
253
- moveTo: function (x, y) {
254
- // xy should be based on canvas root. But tooltipContent is
255
- // the sibling of canvas root. So padding of ec container
256
- // should be considered here.
257
- var zr = this._zr;
258
- var viewportRootOffset;
259
- if (zr && zr.painter && (viewportRootOffset = zr.painter.getViewportRootOffset())) {
260
- x += viewportRootOffset.offsetLeft;
261
- y += viewportRootOffset.offsetTop;
262
- }
324
+ moveTo: function (zrX, zrY) {
325
+ var styleCoord = this._styleCoord;
326
+ makeStyleCoord(styleCoord, this._zr, this._appendToBody, zrX, zrY);
263
327
 
264
328
  var style = this.el.style;
265
- style.left = x + 'px';
266
- style.top = y + 'px';
267
-
268
- this._x = x;
269
- this._y = y;
329
+ style.left = styleCoord[0] + 'px';
330
+ style.top = styleCoord[1] + 'px';
270
331
  },
271
332
 
272
333
  hide: function () {
@@ -278,7 +339,7 @@ TooltipContent.prototype = {
278
339
  if (this._show && !(this._inContent && this._enterable)) {
279
340
  if (time) {
280
341
  this._hideDelay = time;
281
- // Set show false to avoid invoke hideLater mutiple times
342
+ // Set show false to avoid invoke hideLater multiple times
282
343
  this._show = false;
283
344
  this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);
284
345
  }
@@ -292,6 +353,10 @@ TooltipContent.prototype = {
292
353
  return this._show;
293
354
  },
294
355
 
356
+ dispose: function () {
357
+ this.el.parentNode.removeChild(this.el);
358
+ },
359
+
295
360
  getOuterSize: function () {
296
361
  var width = this.el.clientWidth;
297
362
  var height = this.el.clientHeight;
@@ -308,6 +373,7 @@ TooltipContent.prototype = {
308
373
 
309
374
  return {width: width, height: height};
310
375
  }
376
+
311
377
  };
312
378
 
313
379
  export default TooltipContent;