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
@@ -45,6 +45,7 @@ var featureManager = require("../featureManager");
45
45
  * under the License.
46
46
  */
47
47
  var magicTypeLang = lang.toolbox.magicType;
48
+ var INNER_STACK_KEYWORD = '__ec_magicType_stack__';
48
49
 
49
50
  function MagicType(model) {
50
51
  this.model = model;
@@ -58,9 +59,8 @@ MagicType.defaultOption = {
58
59
  /* eslint-disable */
59
60
  line: 'M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4',
60
61
  bar: 'M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7',
61
- 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',
62
- // jshint ignore:line
63
- tiled: 'M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z'
62
+ 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
63
+
64
64
  /* eslint-enable */
65
65
 
66
66
  },
@@ -111,23 +111,18 @@ var seriesOptGenreator = {
111
111
  }
112
112
  },
113
113
  'stack': function (seriesType, seriesId, seriesModel, model) {
114
+ var isStack = seriesModel.get('stack') === INNER_STACK_KEYWORD;
115
+
114
116
  if (seriesType === 'line' || seriesType === 'bar') {
117
+ model.setIconStatus('stack', isStack ? 'normal' : 'emphasis');
115
118
  return zrUtil.merge({
116
119
  id: seriesId,
117
- stack: '__ec_magicType_stack__'
120
+ stack: isStack ? '' : INNER_STACK_KEYWORD
118
121
  }, model.get('option.stack') || {}, true);
119
122
  }
120
- },
121
- 'tiled': function (seriesType, seriesId, seriesModel, model) {
122
- if (seriesType === 'line' || seriesType === 'bar') {
123
- return zrUtil.merge({
124
- id: seriesId,
125
- stack: ''
126
- }, model.get('option.tiled') || {}, true);
127
- }
128
123
  }
129
124
  };
130
- var radioTypes = [['line', 'bar'], ['stack', 'tiled']];
125
+ var radioTypes = [['line', 'bar'], ['stack']];
131
126
 
132
127
  proto.onclick = function (ecModel, api, type) {
133
128
  var model = this.model;
@@ -192,10 +187,21 @@ proto.onclick = function (ecModel, api, type) {
192
187
  seriesIndex: seriesIndex
193
188
  }
194
189
  }, generateNewSeriesTypes);
190
+ var newTitle; // Change title of stack
191
+
192
+ if (type === 'stack') {
193
+ var isStack = newOption.series && newOption.series[0] && newOption.series[0].stack === INNER_STACK_KEYWORD;
194
+ newTitle = isStack ? zrUtil.merge({
195
+ stack: magicTypeLang.title.tiled
196
+ }, magicTypeLang.title) : zrUtil.clone(magicTypeLang.title);
197
+ }
198
+
195
199
  api.dispatchAction({
196
200
  type: 'changeMagicType',
197
201
  currentType: type,
198
- newOption: newOption
202
+ newOption: newOption,
203
+ newTitle: newTitle,
204
+ featureName: 'magicType'
199
205
  });
200
206
  };
201
207
 
@@ -69,7 +69,8 @@ var proto = SaveAsImage.prototype;
69
69
  proto.onclick = function (ecModel, api) {
70
70
  var model = this.model;
71
71
  var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
72
- var type = model.get('type', true) || 'png';
72
+ var isSvg = api.getZr().painter.getType() === 'svg';
73
+ var type = isSvg ? 'svg' : model.get('type', true) || 'png';
73
74
  var url = api.getConnectedDataURL({
74
75
  type: type,
75
76
  backgroundColor: model.get('backgroundColor', true) || ecModel.get('backgroundColor') || '#fff',
@@ -24,6 +24,8 @@ var zrColor = require("zrender/lib/tool/color");
24
24
 
25
25
  var eventUtil = require("zrender/lib/core/event");
26
26
 
27
+ var domUtil = require("zrender/lib/core/dom");
28
+
27
29
  var env = require("zrender/lib/core/env");
28
30
 
29
31
  var formatUtil = require("../../util/format");
@@ -124,24 +126,65 @@ function assembleCssText(tooltipModel) {
124
126
  }
125
127
 
126
128
  return cssText.join(';') + ';';
129
+ } // If not able to make, do not modify the input `out`.
130
+
131
+
132
+ function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
133
+ var zrPainter = zr && zr.painter;
134
+
135
+ if (appendToBody) {
136
+ var zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
137
+
138
+ if (zrViewportRoot) {
139
+ // Some APPs might use scale on body, so we support CSS transform here.
140
+ domUtil.transformLocalCoord(out, zrViewportRoot, document.body, zrX, zrY);
141
+ }
142
+ } else {
143
+ out[0] = zrX;
144
+ out[1] = zrY; // xy should be based on canvas root. But tooltipContent is
145
+ // the sibling of canvas root. So padding of ec container
146
+ // should be considered here.
147
+
148
+ var viewportRootOffset = zrPainter && zrPainter.getViewportRootOffset();
149
+
150
+ if (viewportRootOffset) {
151
+ out[0] += viewportRootOffset.offsetLeft;
152
+ out[1] += viewportRootOffset.offsetTop;
153
+ }
154
+ }
127
155
  }
128
156
  /**
129
157
  * @alias module:echarts/component/tooltip/TooltipContent
158
+ * @param {HTMLElement} container
159
+ * @param {ExtensionAPI} api
160
+ * @param {Object} [opt]
161
+ * @param {boolean} [opt.appendToBody]
162
+ * `false`: the DOM element will be inside the container. Default value.
163
+ * `true`: the DOM element will be appended to HTML body, which avoid
164
+ * some overflow clip but intrude outside of the container.
130
165
  * @constructor
131
166
  */
132
167
 
133
168
 
134
- function TooltipContent(container, api) {
169
+ function TooltipContent(container, api, opt) {
135
170
  if (env.wxa) {
136
171
  return null;
137
172
  }
138
173
 
139
174
  var el = document.createElement('div');
140
- var zr = this._zr = api.getZr();
175
+ el.domBelongToZr = true;
141
176
  this.el = el;
142
- this._x = api.getWidth() / 2;
143
- this._y = api.getHeight() / 2;
144
- container.appendChild(el);
177
+ var zr = this._zr = api.getZr();
178
+ var appendToBody = this._appendToBody = opt && opt.appendToBody;
179
+ this._styleCoord = [0, 0];
180
+ makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
181
+
182
+ if (appendToBody) {
183
+ document.body.appendChild(el);
184
+ } else {
185
+ container.appendChild(el);
186
+ }
187
+
145
188
  this._container = container;
146
189
  this._show = false;
147
190
  /**
@@ -175,7 +218,8 @@ function TooltipContent(container, api) {
175
218
  // Try trigger zrender event to avoid mouse
176
219
  // in and out shape too frequently
177
220
  var handler = zr.handler;
178
- eventUtil.normalizeEvent(container, e, true);
221
+ var zrViewportRoot = zr.painter.getViewportRoot();
222
+ eventUtil.normalizeEvent(zrViewportRoot, e, true);
179
223
  handler.dispatch('mousemove', e);
180
224
  }
181
225
  };
@@ -220,10 +264,11 @@ TooltipContent.prototype = {
220
264
  show: function (tooltipModel) {
221
265
  clearTimeout(this._hideTimeout);
222
266
  var el = this.el;
267
+ var styleCoord = this._styleCoord;
223
268
  el.style.cssText = gCssText + assembleCssText(tooltipModel) // Because of the reason described in:
224
269
  // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore
225
270
  // we should set initial value to `left` and `top`.
226
- + ';left:' + this._x + 'px;top:' + this._y + 'px;' + (tooltipModel.get('extraCssText') || '');
271
+ + ';left:' + styleCoord[0] + 'px;top:' + styleCoord[1] + 'px;' + (tooltipModel.get('extraCssText') || '');
227
272
  el.style.display = el.innerHTML ? 'block' : 'none'; // If mouse occsionally move over the tooltip, a mouseout event will be
228
273
  // triggered by canvas, and cuase some unexpectable result like dragging
229
274
  // stop, "unfocusAdjacency". Here `pointer-events: none` is used to solve
@@ -243,23 +288,12 @@ TooltipContent.prototype = {
243
288
  var el = this.el;
244
289
  return [el.clientWidth, el.clientHeight];
245
290
  },
246
- moveTo: function (x, y) {
247
- // xy should be based on canvas root. But tooltipContent is
248
- // the sibling of canvas root. So padding of ec container
249
- // should be considered here.
250
- var zr = this._zr;
251
- var viewportRootOffset;
252
-
253
- if (zr && zr.painter && (viewportRootOffset = zr.painter.getViewportRootOffset())) {
254
- x += viewportRootOffset.offsetLeft;
255
- y += viewportRootOffset.offsetTop;
256
- }
257
-
291
+ moveTo: function (zrX, zrY) {
292
+ var styleCoord = this._styleCoord;
293
+ makeStyleCoord(styleCoord, this._zr, this._appendToBody, zrX, zrY);
258
294
  var style = this.el.style;
259
- style.left = x + 'px';
260
- style.top = y + 'px';
261
- this._x = x;
262
- this._y = y;
295
+ style.left = styleCoord[0] + 'px';
296
+ style.top = styleCoord[1] + 'px';
263
297
  },
264
298
  hide: function () {
265
299
  this.el.style.display = 'none';
@@ -280,6 +314,9 @@ TooltipContent.prototype = {
280
314
  isShow: function () {
281
315
  return this._show;
282
316
  },
317
+ dispose: function () {
318
+ this.el.parentNode.removeChild(this.el);
319
+ },
283
320
  getOuterSize: function () {
284
321
  var width = this.el.clientWidth;
285
322
  var height = this.el.clientHeight; // Consider browser compatibility.
@@ -93,7 +93,9 @@ var _default = echarts.extendComponentView({
93
93
  var tooltipContent;
94
94
 
95
95
  if (this._renderMode === 'html') {
96
- tooltipContent = new TooltipContent(api.getDom(), api);
96
+ tooltipContent = new TooltipContent(api.getDom(), api, {
97
+ appendToBody: tooltipModel.get('appendToBody', true)
98
+ });
97
99
  this._newLine = '<br/>';
98
100
  } else {
99
101
  tooltipContent = new TooltipRichContent(api);
@@ -228,7 +230,6 @@ var _default = echarts.extendComponentView({
228
230
  offsetX: payload.x,
229
231
  offsetY: payload.y,
230
232
  position: payload.position,
231
- event: {},
232
233
  dataByCoordSys: payload.dataByCoordSys,
233
234
  tooltipOption: payload.tooltipOption
234
235
  }, dispatchAction);
@@ -246,8 +247,7 @@ var _default = echarts.extendComponentView({
246
247
  offsetX: cx,
247
248
  offsetY: cy,
248
249
  position: payload.position,
249
- target: pointInfo.el,
250
- event: {}
250
+ target: pointInfo.el
251
251
  }, dispatchAction);
252
252
  }
253
253
  } else if (payload.x != null && payload.y != null) {
@@ -263,8 +263,7 @@ var _default = echarts.extendComponentView({
263
263
  offsetX: payload.x,
264
264
  offsetY: payload.y,
265
265
  position: payload.position,
266
- target: api.getZr().findHover(payload.x, payload.y).target,
267
- event: {}
266
+ target: api.getZr().findHover(payload.x, payload.y).target
268
267
  }, dispatchAction);
269
268
  }
270
269
  },
@@ -452,7 +451,7 @@ var _default = echarts.extendComponentView({
452
451
  var dataModel = el.dataModel || seriesModel;
453
452
  var dataIndex = el.dataIndex;
454
453
  var dataType = el.dataType;
455
- var data = dataModel.getData();
454
+ var data = dataModel.getData(dataType);
456
455
  var tooltipModel = buildTooltipModel([data.getItemModel(dataIndex), dataModel, seriesModel && (seriesModel.coordinateSystem || {}).model, this._tooltipModel]);
457
456
  var tooltipTrigger = tooltipModel.get('trigger');
458
457
 
@@ -658,7 +657,7 @@ var _default = echarts.extendComponentView({
658
657
  return;
659
658
  }
660
659
 
661
- this._tooltipContent.hide();
660
+ this._tooltipContent.dispose();
662
661
 
663
662
  globalListener.unregister('itemTooltip', api);
664
663
  }
@@ -417,20 +417,17 @@ var resetMethods = {
417
417
 
418
418
  thisOption.precision = precision;
419
419
  splitStep = +splitStep.toFixed(precision);
420
- var index = 0;
421
420
 
422
421
  if (thisOption.minOpen) {
423
422
  pieceList.push({
424
- index: index++,
425
423
  interval: [-Infinity, dataExtent[0]],
426
424
  close: [0, 0]
427
425
  });
428
426
  }
429
427
 
430
- for (var curr = dataExtent[0], len = index + splitNumber; index < len; curr += splitStep) {
428
+ for (var index = 0, curr = dataExtent[0]; index < splitNumber; curr += splitStep, index++) {
431
429
  var max = index === splitNumber - 1 ? dataExtent[1] : curr + splitStep;
432
430
  pieceList.push({
433
- index: index++,
434
431
  interval: [curr, max],
435
432
  close: [1, 1]
436
433
  });
@@ -438,14 +435,14 @@ var resetMethods = {
438
435
 
439
436
  if (thisOption.maxOpen) {
440
437
  pieceList.push({
441
- index: index++,
442
438
  interval: [dataExtent[1], Infinity],
443
439
  close: [0, 0]
444
440
  });
445
441
  }
446
442
 
447
443
  reformIntervals(pieceList);
448
- zrUtil.each(pieceList, function (piece) {
444
+ zrUtil.each(pieceList, function (piece, index) {
445
+ piece.index = index;
449
446
  piece.text = this.formatValueText(piece.interval);
450
447
  }, this);
451
448
  },
package/lib/coord/Axis.js CHANGED
@@ -111,7 +111,7 @@ Axis.prototype = {
111
111
  * @return {boolean}
112
112
  */
113
113
  containData: function (data) {
114
- return this.contain(this.dataToCoord(data));
114
+ return this.scale.contain(data);
115
115
  },
116
116
 
117
117
  /**
@@ -194,7 +194,7 @@ Axis.prototype = {
194
194
  * `axis.getTicksCoords` considers `onBand`, which is used by
195
195
  * `boundaryGap:true` of category axis and splitLine and splitArea.
196
196
  * @param {Object} [opt]
197
- * @param {number} [opt.tickModel=axis.model.getModel('axisTick')]
197
+ * @param {Model} [opt.tickModel=axis.model.getModel('axisTick')]
198
198
  * @param {boolean} [opt.clamp] If `true`, the first and the last
199
199
  * tick must be at the axis end points. Otherwise, clip ticks
200
200
  * that outside the axis extent.
@@ -219,6 +219,34 @@ Axis.prototype = {
219
219
  return ticksCoords;
220
220
  },
221
221
 
222
+ /**
223
+ * @return {Array.<Array.<Object>>} [{ coord: ..., tickValue: ...}]
224
+ */
225
+ getMinorTicksCoords: function () {
226
+ if (this.scale.type === 'ordinal') {
227
+ // Category axis doesn't support minor ticks
228
+ return [];
229
+ }
230
+
231
+ var minorTickModel = this.model.getModel('minorTick');
232
+ var splitNumber = minorTickModel.get('splitNumber'); // Protection.
233
+
234
+ if (!(splitNumber > 0 && splitNumber < 100)) {
235
+ splitNumber = 5;
236
+ }
237
+
238
+ var minorTicks = this.scale.getMinorTicks(splitNumber);
239
+ var minorTicksCoords = map(minorTicks, function (minorTicksGroup) {
240
+ return map(minorTicksGroup, function (minorTick) {
241
+ return {
242
+ coord: this.dataToCoord(minorTick),
243
+ tickValue: minorTick
244
+ };
245
+ }, this);
246
+ }, this);
247
+ return minorTicksCoords;
248
+ },
249
+
222
250
  /**
223
251
  * @return {Array.<Object>} [{
224
252
  * formattedLabel: string,
package/lib/coord/View.js CHANGED
@@ -230,6 +230,15 @@ View.prototype = {
230
230
  matrix.invert(this.invTransform, this.transform);
231
231
  this.decomposeTransform();
232
232
  },
233
+ getTransformInfo: function () {
234
+ var roamTransform = this._roamTransformable.transform;
235
+ var rawTransformable = this._rawTransformable;
236
+ return {
237
+ roamTransform: roamTransform ? zrUtil.slice(roamTransform) : matrix.create(),
238
+ rawScale: zrUtil.slice(rawTransformable.scale),
239
+ rawPosition: zrUtil.slice(rawTransformable.position)
240
+ };
241
+ },
233
242
 
234
243
  /**
235
244
  * @return {module:zrender/core/BoundingRect}
@@ -170,13 +170,32 @@ axisDefault.valueAxis = zrUtil.merge({
170
170
  // + `true`: the extent do not consider value 0.
171
171
  // scale: false,
172
172
  // AxisTick and axisLabel and splitLine are caculated based on splitNumber.
173
- splitNumber: 5 // Interval specifies the span of the ticks is mandatorily.
173
+ splitNumber: 5,
174
+ // Interval specifies the span of the ticks is mandatorily.
174
175
  // interval: null
175
176
  // Specify min interval when auto calculate tick interval.
176
177
  // minInterval: null
177
178
  // Specify max interval when auto calculate tick interval.
178
179
  // maxInterval: null
179
-
180
+ minorTick: {
181
+ // Minor tick, not available for cateogry axis.
182
+ show: false,
183
+ // Split number of minor ticks. The value should be in range of (0, 100)
184
+ splitNumber: 5,
185
+ // Lenght of minor tick
186
+ length: 3,
187
+ // Same inside with axisTick
188
+ // Line style
189
+ lineStyle: {// Default to be same with axisTick
190
+ }
191
+ },
192
+ minorSplitLine: {
193
+ show: false,
194
+ lineStyle: {
195
+ color: '#eee',
196
+ width: 1
197
+ }
198
+ }
180
199
  }, defaultOption);
181
200
  axisDefault.timeAxis = zrUtil.defaults({
182
201
  scale: true,
@@ -71,8 +71,6 @@ function getScaleExtent(scale, model) {
71
71
  var scaleType = scale.type;
72
72
  var min = model.getMin();
73
73
  var max = model.getMax();
74
- var fixMin = min != null;
75
- var fixMax = max != null;
76
74
  var originalExtent = scale.getExtent();
77
75
  var axisDataLen;
78
76
  var boundaryGap;
@@ -109,14 +107,6 @@ function getScaleExtent(scale, model) {
109
107
  // that the results processed by boundaryGap are positive/negative?
110
108
 
111
109
 
112
- if (min == null) {
113
- min = scaleType === 'ordinal' ? axisDataLen ? 0 : NaN : originalExtent[0] - boundaryGap[0] * span;
114
- }
115
-
116
- if (max == null) {
117
- max = scaleType === 'ordinal' ? axisDataLen ? axisDataLen - 1 : NaN : originalExtent[1] + boundaryGap[1] * span;
118
- }
119
-
120
110
  if (min === 'dataMin') {
121
111
  min = originalExtent[0];
122
112
  } else if (typeof min === 'function') {
@@ -135,6 +125,17 @@ function getScaleExtent(scale, model) {
135
125
  });
136
126
  }
137
127
 
128
+ var fixMin = min != null;
129
+ var fixMax = max != null;
130
+
131
+ if (min == null) {
132
+ min = scaleType === 'ordinal' ? axisDataLen ? 0 : NaN : originalExtent[0] - boundaryGap[0] * span;
133
+ }
134
+
135
+ if (max == null) {
136
+ max = scaleType === 'ordinal' ? axisDataLen ? axisDataLen - 1 : NaN : originalExtent[1] + boundaryGap[1] * span;
137
+ }
138
+
138
139
  (min == null || !isFinite(min)) && (min = NaN);
139
140
  (max == null || !isFinite(max)) && (max = NaN);
140
141
  scale.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max) || scaleType === 'ordinal' && !scale.getOrdinalMeta().categories.length); // Evaluate if axis needs cross zero
@@ -181,7 +182,13 @@ function getScaleExtent(scale, model) {
181
182
  }
182
183
  }
183
184
 
184
- return [min, max];
185
+ return {
186
+ extent: [min, max],
187
+ // "fix" means "fixed", the value should not be
188
+ // changed in the subsequent steps.
189
+ fixMin: fixMin,
190
+ fixMax: fixMax
191
+ };
185
192
  }
186
193
 
187
194
  function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -222,9 +229,8 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
222
229
  }
223
230
 
224
231
  function niceScaleExtent(scale, model) {
225
- var extent = getScaleExtent(scale, model);
226
- var fixMin = model.getMin() != null;
227
- var fixMax = model.getMax() != null;
232
+ var extentInfo = getScaleExtent(scale, model);
233
+ var extent = extentInfo.extent;
228
234
  var splitNumber = model.get('splitNumber');
229
235
 
230
236
  if (scale.type === 'log') {
@@ -235,8 +241,8 @@ function niceScaleExtent(scale, model) {
235
241
  scale.setExtent(extent[0], extent[1]);
236
242
  scale.niceExtent({
237
243
  splitNumber: splitNumber,
238
- fixMin: fixMin,
239
- fixMax: fixMax,
244
+ fixMin: extentInfo.fixMin,
245
+ fixMax: extentInfo.fixMax,
240
246
  minInterval: scaleType === 'interval' || scaleType === 'time' ? model.get('minInterval') : null,
241
247
  maxInterval: scaleType === 'interval' || scaleType === 'time' ? model.get('maxInterval') : null
242
248
  }); // If some one specified the min, max. And the default calculated interval
@@ -336,7 +336,9 @@ Calendar.prototype = {
336
336
  range.reverse();
337
337
  }
338
338
 
339
- var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY) - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1; // Consider case:
339
+ var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY) - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1; // Consider case1 (#11677 #10430):
340
+ // Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
341
+ // Consider case2:
340
342
  // Firstly set system timezone as "Time Zone: America/Toronto",
341
343
  // ```
342
344
  // var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
@@ -350,12 +352,14 @@ Calendar.prototype = {
350
352
  var endDateNum = range[1].date.getDate();
351
353
  date.setDate(startDateNum + allDay - 1); // The bias can not over a month, so just compare date.
352
354
 
353
- if (date.getDate() !== endDateNum) {
355
+ var dateNum = date.getDate();
356
+
357
+ if (dateNum !== endDateNum) {
354
358
  var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
355
359
 
356
- while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
360
+ while ((dateNum = date.getDate()) !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
357
361
  allDay -= sign;
358
- date.setDate(startDateNum + allDay - 1);
362
+ date.setDate(dateNum - sign);
359
363
  }
360
364
  }
361
365
 
@@ -60,9 +60,10 @@ var _default = {
60
60
  /**
61
61
  * @param {string} mapName
62
62
  * @param {Object} mapRecord {specialAreas, geoJSON}
63
+ * @param {string} nameProperty
63
64
  * @return {Object} {regions, boundingRect}
64
65
  */
65
- load: function (mapName, mapRecord) {
66
+ load: function (mapName, mapRecord, nameProperty) {
66
67
  var parsed = inner(mapRecord).parsed;
67
68
 
68
69
  if (parsed) {
@@ -74,7 +75,7 @@ var _default = {
74
75
  var regions; // https://jsperf.com/try-catch-performance-overhead
75
76
 
76
77
  try {
77
- regions = geoJSON ? parseGeoJson(geoJSON) : [];
78
+ regions = geoJSON ? parseGeoJson(geoJSON, nameProperty) : [];
78
79
  } catch (e) {
79
80
  throw new Error('Invalid geoJson format\n' + e.message);
80
81
  }
@@ -61,16 +61,17 @@ var _default = {
61
61
  /**
62
62
  * @param {string} mapName
63
63
  * @param {Object} nameMap
64
+ * @param {string} nameProperty
64
65
  * @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
65
66
  */
66
- load: function (mapName, nameMap) {
67
+ load: function (mapName, nameMap, nameProperty) {
67
68
  var regions = [];
68
69
  var regionsMap = createHashMap();
69
70
  var nameCoordMap = createHashMap();
70
71
  var boundingRect;
71
72
  var mapRecords = retrieveMap(mapName);
72
73
  each(mapRecords, function (record) {
73
- var singleSource = loaders[record.type].load(mapName, record);
74
+ var singleSource = loaders[record.type].load(mapName, record, nameProperty);
74
75
  each(singleSource.regions, function (region) {
75
76
  var regionName = region.name; // Try use the alias in geoNameMap
76
77
 
@@ -108,11 +108,12 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
108
108
  /**
109
109
  * @alias module:echarts/coord/geo/parseGeoJson
110
110
  * @param {Object} geoJson
111
+ * @param {string} nameProperty
111
112
  * @return {module:zrender/container/Group}
112
113
  */
113
114
 
114
115
 
115
- function _default(geoJson) {
116
+ function _default(geoJson, nameProperty) {
116
117
  decode(geoJson);
117
118
  return zrUtil.map(zrUtil.filter(geoJson.features, function (featureObj) {
118
119
  // Output of mapshaper may have geometry null
@@ -145,7 +146,7 @@ function _default(geoJson) {
145
146
  });
146
147
  }
147
148
 
148
- var region = new Region(properties.name, geometries, properties.cp);
149
+ var region = new Region(properties[nameProperty || 'name'], geometries, properties.cp);
149
150
  region.properties = properties;
150
151
  return region;
151
152
  });
@@ -210,7 +210,7 @@ Radar.prototype.update = function (ecModel, api) {
210
210
 
211
211
 
212
212
  zrUtil.each(indicatorAxes, function (indicatorAxis, idx) {
213
- var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
213
+ var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
214
214
  niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
215
215
  var axisModel = indicatorAxis.model;
216
216
  var scale = indicatorAxis.scale;
@@ -247,12 +247,12 @@ Radar.prototype.update = function (ecModel, api) {
247
247
 
248
248
  if (nicedSplitNumber > splitNumber) {
249
249
  interval = increaseInterval(interval);
250
- } // PENDING
250
+ } // TODO
251
251
 
252
252
 
253
- var center = Math.round((rawExtent[0] + rawExtent[1]) / 2 / interval) * interval;
254
- var halfSplitNumber = Math.round(splitNumber / 2);
255
- scale.setExtent(numberUtil.round(center - halfSplitNumber * interval), numberUtil.round(center + (splitNumber - halfSplitNumber) * interval));
253
+ var max = Math.ceil(rawExtent[1] / interval) * interval;
254
+ var min = numberUtil.round(max - interval * splitNumber);
255
+ scale.setExtent(min, max);
256
256
  scale.setInterval(interval);
257
257
  }
258
258
  });