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
@@ -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)
@@ -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
 
@@ -121,24 +122,63 @@ function assembleCssText(tooltipModel) {
121
122
  return cssText.join(';') + ';';
122
123
  }
123
124
 
125
+ // If not able to make, do not modify the input `out`.
126
+ function makeStyleCoord(out, zr, appendToBody, zrX, zrY) {
127
+ var zrPainter = zr && zr.painter;
128
+
129
+ if (appendToBody) {
130
+ var zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
131
+ if (zrViewportRoot) {
132
+ // Some APPs might use scale on body, so we support CSS transform here.
133
+ domUtil.transformLocalCoord(out, zrViewportRoot, document.body, zrX, zrY);
134
+ }
135
+ }
136
+ else {
137
+ out[0] = zrX;
138
+ out[1] = zrY;
139
+ // xy should be based on canvas root. But tooltipContent is
140
+ // the sibling of canvas root. So padding of ec container
141
+ // should be considered here.
142
+ var viewportRootOffset = zrPainter && zrPainter.getViewportRootOffset();
143
+ if (viewportRootOffset) {
144
+ out[0] += viewportRootOffset.offsetLeft;
145
+ out[1] += viewportRootOffset.offsetTop;
146
+ }
147
+ }
148
+ }
149
+
124
150
  /**
125
151
  * @alias module:echarts/component/tooltip/TooltipContent
152
+ * @param {HTMLElement} container
153
+ * @param {ExtensionAPI} api
154
+ * @param {Object} [opt]
155
+ * @param {boolean} [opt.appendToBody]
156
+ * `false`: the DOM element will be inside the container. Default value.
157
+ * `true`: the DOM element will be appended to HTML body, which avoid
158
+ * some overflow clip but intrude outside of the container.
126
159
  * @constructor
127
160
  */
128
- function TooltipContent(container, api) {
161
+ function TooltipContent(container, api, opt) {
129
162
  if (env.wxa) {
130
163
  return null;
131
164
  }
132
165
 
133
166
  var el = document.createElement('div');
167
+ el.domBelongToZr = true;
168
+ this.el = el;
134
169
  var zr = this._zr = api.getZr();
170
+ var appendToBody = this._appendToBody = opt && opt.appendToBody;
135
171
 
136
- this.el = el;
172
+ this._styleCoord = [0, 0];
137
173
 
138
- this._x = api.getWidth() / 2;
139
- this._y = api.getHeight() / 2;
174
+ makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
140
175
 
141
- container.appendChild(el);
176
+ if (appendToBody) {
177
+ document.body.appendChild(el);
178
+ }
179
+ else {
180
+ container.appendChild(el);
181
+ }
142
182
 
143
183
  this._container = container;
144
184
 
@@ -172,7 +212,8 @@ function TooltipContent(container, api) {
172
212
  // Try trigger zrender event to avoid mouse
173
213
  // in and out shape too frequently
174
214
  var handler = zr.handler;
175
- eventUtil.normalizeEvent(container, e, true);
215
+ var zrViewportRoot = zr.painter.getViewportRoot();
216
+ eventUtil.normalizeEvent(zrViewportRoot, e, true);
176
217
  handler.dispatch('mousemove', e);
177
218
  }
178
219
  };
@@ -217,12 +258,13 @@ TooltipContent.prototype = {
217
258
  show: function (tooltipModel) {
218
259
  clearTimeout(this._hideTimeout);
219
260
  var el = this.el;
261
+ var styleCoord = this._styleCoord;
220
262
 
221
263
  el.style.cssText = gCssText + assembleCssText(tooltipModel)
222
264
  // Because of the reason described in:
223
265
  // http://stackoverflow.com/questions/21125587/css3-transition-not-working-in-chrome-anymore
224
266
  // we should set initial value to `left` and `top`.
225
- + ';left:' + this._x + 'px;top:' + this._y + 'px;'
267
+ + ';left:' + styleCoord[0] + 'px;top:' + styleCoord[1] + 'px;'
226
268
  + (tooltipModel.get('extraCssText') || '');
227
269
 
228
270
  el.style.display = el.innerHTML ? 'block' : 'none';
@@ -250,23 +292,13 @@ TooltipContent.prototype = {
250
292
  return [el.clientWidth, el.clientHeight];
251
293
  },
252
294
 
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
- }
295
+ moveTo: function (zrX, zrY) {
296
+ var styleCoord = this._styleCoord;
297
+ makeStyleCoord(styleCoord, this._zr, this._appendToBody, zrX, zrY);
263
298
 
264
299
  var style = this.el.style;
265
- style.left = x + 'px';
266
- style.top = y + 'px';
267
-
268
- this._x = x;
269
- this._y = y;
300
+ style.left = styleCoord[0] + 'px';
301
+ style.top = styleCoord[1] + 'px';
270
302
  },
271
303
 
272
304
  hide: function () {
@@ -292,6 +324,10 @@ TooltipContent.prototype = {
292
324
  return this._show;
293
325
  },
294
326
 
327
+ dispose: function () {
328
+ this.el.parentNode.removeChild(this.el);
329
+ },
330
+
295
331
  getOuterSize: function () {
296
332
  var width = this.el.clientWidth;
297
333
  var height = this.el.clientHeight;
@@ -308,6 +344,7 @@ TooltipContent.prototype = {
308
344
 
309
345
  return {width: width, height: height};
310
346
  }
347
+
311
348
  };
312
349
 
313
350
  export default TooltipContent;
@@ -56,7 +56,9 @@ export default echarts.extendComponentView({
56
56
 
57
57
  var tooltipContent;
58
58
  if (this._renderMode === 'html') {
59
- tooltipContent = new TooltipContent(api.getDom(), api);
59
+ tooltipContent = new TooltipContent(api.getDom(), api, {
60
+ appendToBody: tooltipModel.get('appendToBody', true)
61
+ });
60
62
  this._newLine = '<br/>';
61
63
  }
62
64
  else {
@@ -209,7 +211,6 @@ export default echarts.extendComponentView({
209
211
  offsetX: payload.x,
210
212
  offsetY: payload.y,
211
213
  position: payload.position,
212
- event: {},
213
214
  dataByCoordSys: payload.dataByCoordSys,
214
215
  tooltipOption: payload.tooltipOption
215
216
  }, dispatchAction);
@@ -228,8 +229,7 @@ export default echarts.extendComponentView({
228
229
  offsetX: cx,
229
230
  offsetY: cy,
230
231
  position: payload.position,
231
- target: pointInfo.el,
232
- event: {}
232
+ target: pointInfo.el
233
233
  }, dispatchAction);
234
234
  }
235
235
  }
@@ -246,8 +246,7 @@ export default echarts.extendComponentView({
246
246
  offsetX: payload.x,
247
247
  offsetY: payload.y,
248
248
  position: payload.position,
249
- target: api.getZr().findHover(payload.x, payload.y).target,
250
- event: {}
249
+ target: api.getZr().findHover(payload.x, payload.y).target
251
250
  }, dispatchAction);
252
251
  }
253
252
  },
@@ -353,7 +352,9 @@ export default echarts.extendComponentView({
353
352
  _showAxisTooltip: function (dataByCoordSys, e) {
354
353
  var ecModel = this._ecModel;
355
354
  var globalTooltipModel = this._tooltipModel;
355
+
356
356
  var point = [e.offsetX, e.offsetY];
357
+
357
358
  var singleDefaultHTML = [];
358
359
  var singleParamsList = [];
359
360
  var singleTooltipModel = buildTooltipModel([
@@ -477,7 +478,7 @@ export default echarts.extendComponentView({
477
478
  var dataModel = el.dataModel || seriesModel;
478
479
  var dataIndex = el.dataIndex;
479
480
  var dataType = el.dataType;
480
- var data = dataModel.getData();
481
+ var data = dataModel.getData(dataType);
481
482
 
482
483
  var tooltipModel = buildTooltipModel([
483
484
  data.getItemModel(dataIndex),
@@ -609,6 +610,7 @@ export default echarts.extendComponentView({
609
610
  _updatePosition: function (tooltipModel, positionExpr, x, y, content, params, el) {
610
611
  var viewWidth = this._api.getWidth();
611
612
  var viewHeight = this._api.getHeight();
613
+
612
614
  positionExpr = positionExpr || tooltipModel.get('position');
613
615
 
614
616
  var contentSize = content.getSize();
@@ -727,7 +729,7 @@ export default echarts.extendComponentView({
727
729
  if (env.node) {
728
730
  return;
729
731
  }
730
- this._tooltipContent.hide();
732
+ this._tooltipContent.dispose();
731
733
  globalListener.unregister('itemTooltip', api);
732
734
  }
733
735
  });
@@ -398,25 +398,21 @@ var resetMethods = {
398
398
  thisOption.precision = precision;
399
399
  splitStep = +splitStep.toFixed(precision);
400
400
 
401
- var index = 0;
402
-
403
401
  if (thisOption.minOpen) {
404
402
  pieceList.push({
405
- index: index++,
406
403
  interval: [-Infinity, dataExtent[0]],
407
404
  close: [0, 0]
408
405
  });
409
406
  }
410
407
 
411
408
  for (
412
- var curr = dataExtent[0], len = index + splitNumber;
413
- index < len;
414
- curr += splitStep
409
+ var index = 0, curr = dataExtent[0];
410
+ index < splitNumber;
411
+ curr += splitStep, index++
415
412
  ) {
416
413
  var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
417
414
 
418
415
  pieceList.push({
419
- index: index++,
420
416
  interval: [curr, max],
421
417
  close: [1, 1]
422
418
  });
@@ -424,7 +420,6 @@ var resetMethods = {
424
420
 
425
421
  if (thisOption.maxOpen) {
426
422
  pieceList.push({
427
- index: index++,
428
423
  interval: [dataExtent[1], Infinity],
429
424
  close: [0, 0]
430
425
  });
@@ -432,7 +427,8 @@ var resetMethods = {
432
427
 
433
428
  reformIntervals(pieceList);
434
429
 
435
- zrUtil.each(pieceList, function (piece) {
430
+ zrUtil.each(pieceList, function (piece, index) {
431
+ piece.index = index;
436
432
  piece.text = this.formatValueText(piece.interval);
437
433
  }, this);
438
434
  },
package/src/coord/Axis.js CHANGED
@@ -85,7 +85,7 @@ Axis.prototype = {
85
85
  * @return {boolean}
86
86
  */
87
87
  containData: function (data) {
88
- return this.contain(this.dataToCoord(data));
88
+ return this.scale.contain(data);
89
89
  },
90
90
 
91
91
  /**
@@ -173,7 +173,7 @@ Axis.prototype = {
173
173
  * `axis.getTicksCoords` considers `onBand`, which is used by
174
174
  * `boundaryGap:true` of category axis and splitLine and splitArea.
175
175
  * @param {Object} [opt]
176
- * @param {number} [opt.tickModel=axis.model.getModel('axisTick')]
176
+ * @param {Model} [opt.tickModel=axis.model.getModel('axisTick')]
177
177
  * @param {boolean} [opt.clamp] If `true`, the first and the last
178
178
  * tick must be at the axis end points. Otherwise, clip ticks
179
179
  * that outside the axis extent.
@@ -205,6 +205,33 @@ Axis.prototype = {
205
205
  return ticksCoords;
206
206
  },
207
207
 
208
+ /**
209
+ * @return {Array.<Array.<Object>>} [{ coord: ..., tickValue: ...}]
210
+ */
211
+ getMinorTicksCoords: function () {
212
+ if (this.scale.type === 'ordinal') {
213
+ // Category axis doesn't support minor ticks
214
+ return [];
215
+ }
216
+
217
+ var minorTickModel = this.model.getModel('minorTick');
218
+ var splitNumber = minorTickModel.get('splitNumber');
219
+ // Protection.
220
+ if (!(splitNumber > 0 && splitNumber < 100)) {
221
+ splitNumber = 5;
222
+ }
223
+ var minorTicks = this.scale.getMinorTicks(splitNumber);
224
+ var minorTicksCoords = map(minorTicks, function (minorTicksGroup) {
225
+ return map(minorTicksGroup, function (minorTick) {
226
+ return {
227
+ coord: this.dataToCoord(minorTick),
228
+ tickValue: minorTick
229
+ };
230
+ }, this);
231
+ }, this);
232
+ return minorTicksCoords;
233
+ },
234
+
208
235
  /**
209
236
  * @return {Array.<Object>} [{
210
237
  * formattedLabel: string,
package/src/coord/View.js CHANGED
@@ -185,7 +185,6 @@ View.prototype = {
185
185
  /**
186
186
  * Remove roam
187
187
  */
188
-
189
188
  _updateCenterAndZoom: function () {
190
189
  // Must update after view transform updated
191
190
  var rawTransformMatrix = this._rawTransformable.getLocalTransform();
@@ -229,6 +228,16 @@ View.prototype = {
229
228
  this.decomposeTransform();
230
229
  },
231
230
 
231
+ getTransformInfo: function () {
232
+ var roamTransform = this._roamTransformable.transform;
233
+ var rawTransformable = this._rawTransformable;
234
+ return {
235
+ roamTransform: roamTransform ? zrUtil.slice(roamTransform) : matrix.create(),
236
+ rawScale: zrUtil.slice(rawTransformable.scale),
237
+ rawPosition: zrUtil.slice(rawTransformable.position)
238
+ };
239
+ },
240
+
232
241
  /**
233
242
  * @return {module:zrender/core/BoundingRect}
234
243
  */
@@ -166,7 +166,7 @@ axisDefault.valueAxis = zrUtil.merge({
166
166
  // scale: false,
167
167
 
168
168
  // AxisTick and axisLabel and splitLine are caculated based on splitNumber.
169
- splitNumber: 5
169
+ splitNumber: 5,
170
170
 
171
171
  // Interval specifies the span of the ticks is mandatorily.
172
172
  // interval: null
@@ -177,6 +177,30 @@ axisDefault.valueAxis = zrUtil.merge({
177
177
  // Specify max interval when auto calculate tick interval.
178
178
  // maxInterval: null
179
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
+
188
+ // Same inside with axisTick
189
+
190
+ // Line style
191
+ lineStyle: {
192
+ // Default to be same with axisTick
193
+ }
194
+ },
195
+
196
+ minorSplitLine: {
197
+ show: false,
198
+
199
+ lineStyle: {
200
+ color: '#eee',
201
+ width: 1
202
+ }
203
+ }
180
204
  }, defaultOption);
181
205
 
182
206
  axisDefault.timeAxis = zrUtil.defaults({
@@ -42,8 +42,6 @@ export function getScaleExtent(scale, model) {
42
42
 
43
43
  var min = model.getMin();
44
44
  var max = model.getMax();
45
- var fixMin = min != null;
46
- var fixMax = max != null;
47
45
  var originalExtent = scale.getExtent();
48
46
 
49
47
  var axisDataLen;
@@ -87,17 +85,6 @@ export function getScaleExtent(scale, model) {
87
85
  // (2) When `needCrossZero` and all data is positive/negative, should it be ensured
88
86
  // that the results processed by boundaryGap are positive/negative?
89
87
 
90
- if (min == null) {
91
- min = scaleType === 'ordinal'
92
- ? (axisDataLen ? 0 : NaN)
93
- : originalExtent[0] - boundaryGap[0] * span;
94
- }
95
- if (max == null) {
96
- max = scaleType === 'ordinal'
97
- ? (axisDataLen ? axisDataLen - 1 : NaN)
98
- : originalExtent[1] + boundaryGap[1] * span;
99
- }
100
-
101
88
  if (min === 'dataMin') {
102
89
  min = originalExtent[0];
103
90
  }
@@ -118,6 +105,20 @@ export function getScaleExtent(scale, model) {
118
105
  });
119
106
  }
120
107
 
108
+ var fixMin = min != null;
109
+ var fixMax = max != null;
110
+
111
+ if (min == null) {
112
+ min = scaleType === 'ordinal'
113
+ ? (axisDataLen ? 0 : NaN)
114
+ : originalExtent[0] - boundaryGap[0] * span;
115
+ }
116
+ if (max == null) {
117
+ max = scaleType === 'ordinal'
118
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
119
+ : originalExtent[1] + boundaryGap[1] * span;
120
+ }
121
+
121
122
  (min == null || !isFinite(min)) && (min = NaN);
122
123
  (max == null || !isFinite(max)) && (max = NaN);
123
124
 
@@ -168,7 +169,13 @@ export function getScaleExtent(scale, model) {
168
169
  }
169
170
  }
170
171
 
171
- return [min, max];
172
+ return {
173
+ extent: [min, max],
174
+ // "fix" means "fixed", the value should not be
175
+ // changed in the subsequent steps.
176
+ fixMin: fixMin,
177
+ fixMax: fixMax
178
+ };
172
179
  }
173
180
 
174
181
  function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -207,9 +214,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
207
214
  }
208
215
 
209
216
  export function niceScaleExtent(scale, model) {
210
- var extent = getScaleExtent(scale, model);
211
- var fixMin = model.getMin() != null;
212
- var fixMax = model.getMax() != null;
217
+ var extentInfo = getScaleExtent(scale, model);
218
+ var extent = extentInfo.extent;
219
+
213
220
  var splitNumber = model.get('splitNumber');
214
221
 
215
222
  if (scale.type === 'log') {
@@ -220,8 +227,8 @@ export function niceScaleExtent(scale, model) {
220
227
  scale.setExtent(extent[0], extent[1]);
221
228
  scale.niceExtent({
222
229
  splitNumber: splitNumber,
223
- fixMin: fixMin,
224
- fixMax: fixMax,
230
+ fixMin: extentInfo.fixMin,
231
+ fixMax: extentInfo.fixMax,
225
232
  minInterval: (scaleType === 'interval' || scaleType === 'time')
226
233
  ? model.get('minInterval') : null,
227
234
  maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -375,7 +375,10 @@ Calendar.prototype = {
375
375
  var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY)
376
376
  - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1;
377
377
 
378
- // Consider case:
378
+ // Consider case1 (#11677 #10430):
379
+ // Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
380
+
381
+ // Consider case2:
379
382
  // Firstly set system timezone as "Time Zone: America/Toronto",
380
383
  // ```
381
384
  // var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
@@ -388,11 +391,15 @@ Calendar.prototype = {
388
391
  var endDateNum = range[1].date.getDate();
389
392
  date.setDate(startDateNum + allDay - 1);
390
393
  // The bias can not over a month, so just compare date.
391
- if (date.getDate() !== endDateNum) {
394
+ var dateNum = date.getDate();
395
+ if (dateNum !== endDateNum) {
392
396
  var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
393
- while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
397
+ while (
398
+ (dateNum = date.getDate()) !== endDateNum
399
+ && (date.getTime() - range[1].time) * sign > 0
400
+ ) {
394
401
  allDay -= sign;
395
- date.setDate(startDateNum + allDay - 1);
402
+ date.setDate(dateNum - sign);
396
403
  }
397
404
  }
398
405
 
@@ -478,4 +485,4 @@ function doConvert(methodName, ecModel, finder, value) {
478
485
 
479
486
  CoordinateSystem.register('calendar', Calendar);
480
487
 
481
- export default Calendar;
488
+ export default Calendar;
@@ -34,9 +34,10 @@ export default {
34
34
  /**
35
35
  * @param {string} mapName
36
36
  * @param {Object} mapRecord {specialAreas, geoJSON}
37
+ * @param {string} nameProperty
37
38
  * @return {Object} {regions, boundingRect}
38
39
  */
39
- load: function (mapName, mapRecord) {
40
+ load: function (mapName, mapRecord, nameProperty) {
40
41
 
41
42
  var parsed = inner(mapRecord).parsed;
42
43
 
@@ -50,7 +51,7 @@ export default {
50
51
 
51
52
  // https://jsperf.com/try-catch-performance-overhead
52
53
  try {
53
- regions = geoJSON ? parseGeoJson(geoJSON) : [];
54
+ regions = geoJSON ? parseGeoJson(geoJSON, nameProperty) : [];
54
55
  }
55
56
  catch (e) {
56
57
  throw new Error('Invalid geoJson format\n' + e.message);
@@ -34,9 +34,10 @@ export default {
34
34
  /**
35
35
  * @param {string} mapName
36
36
  * @param {Object} nameMap
37
+ * @param {string} nameProperty
37
38
  * @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
38
39
  */
39
- load: function (mapName, nameMap) {
40
+ load: function (mapName, nameMap, nameProperty) {
40
41
  var regions = [];
41
42
  var regionsMap = createHashMap();
42
43
  var nameCoordMap = createHashMap();
@@ -44,7 +45,7 @@ export default {
44
45
  var mapRecords = retrieveMap(mapName);
45
46
 
46
47
  each(mapRecords, function (record) {
47
- var singleSource = loaders[record.type].load(mapName, record);
48
+ var singleSource = loaders[record.type].load(mapName, record, nameProperty);
48
49
 
49
50
  each(singleSource.regions, function (region) {
50
51
  var regionName = region.name;
@@ -96,9 +96,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
96
96
  /**
97
97
  * @alias module:echarts/coord/geo/parseGeoJson
98
98
  * @param {Object} geoJson
99
+ * @param {string} nameProperty
99
100
  * @return {module:zrender/container/Group}
100
101
  */
101
- export default function (geoJson) {
102
+ export default function (geoJson, nameProperty) {
102
103
 
103
104
  decode(geoJson);
104
105
 
@@ -136,7 +137,7 @@ export default function (geoJson) {
136
137
  }
137
138
 
138
139
  var region = new Region(
139
- properties.name,
140
+ properties[nameProperty || 'name'],
140
141
  geometries,
141
142
  properties.cp
142
143
  );