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
@@ -20,6 +20,15 @@
20
20
  import * as zrUtil from 'zrender/src/core/util';
21
21
  // import Group from 'zrender/src/container/Group';
22
22
  import Text from 'zrender/src/graphic/Text';
23
+ import * as graphicUtil from '../../util/graphic';
24
+
25
+
26
+ function makeStyleCoord(out, zr, zrX, zrY) {
27
+ out[0] = zrX;
28
+ out[1] = zrY;
29
+ out[2] = out[0] / zr.getWidth(); // The ratio of left to width
30
+ out[3] = out[1] / zr.getHeight(); // The ratio of top to height
31
+ }
23
32
 
24
33
  /**
25
34
  * @alias module:echarts/component/tooltip/TooltipRichContent
@@ -27,7 +36,11 @@ import Text from 'zrender/src/graphic/Text';
27
36
  */
28
37
  function TooltipRichContent(api) {
29
38
 
30
- this._zr = api.getZr();
39
+ var zr = this._zr = api.getZr();
40
+
41
+ this._styleCoord = [0, 0, 0, 0]; // [left, top, left/width, top/height]
42
+
43
+ makeStyleCoord(this._styleCoord, zr, api.getWidth() / 2, api.getHeight() / 2);
31
44
 
32
45
  this._show = false;
33
46
 
@@ -50,8 +63,21 @@ TooltipRichContent.prototype = {
50
63
  /**
51
64
  * Update when tooltip is rendered
52
65
  */
53
- update: function () {
54
- // noop
66
+ update: function (tooltipModel) {
67
+ var alwaysShowContent = tooltipModel.get('alwaysShowContent');
68
+ alwaysShowContent && this._moveTooltipIfResized();
69
+ },
70
+
71
+ /**
72
+ * when `alwaysShowContent` is true,
73
+ * we should move the tooltip after chart resized
74
+ */
75
+ _moveTooltipIfResized: function () {
76
+ var ratioX = this._styleCoord[2]; // The ratio of left to width
77
+ var ratioY = this._styleCoord[3]; // The ratio of top to height
78
+ var realX = ratioX * this._zr.getWidth();
79
+ var realY = ratioY * this._zr.getHeight();
80
+ this.moveTo(realX, realY);
55
81
  },
56
82
 
57
83
  show: function (tooltipModel) {
@@ -106,16 +132,23 @@ TooltipRichContent.prototype = {
106
132
  startId = text.indexOf('{marker');
107
133
  }
108
134
 
135
+ var textStyleModel = tooltipModel.getModel('textStyle');
136
+ var fontSize = textStyleModel.get('fontSize');
137
+ var lineHeight = tooltipModel.get('textLineHeight');
138
+ if (lineHeight == null) {
139
+ lineHeight = Math.round(fontSize * 3 / 2);
140
+ }
141
+
109
142
  this.el = new Text({
110
- style: {
143
+ style: graphicUtil.setTextStyle({}, textStyleModel, {
111
144
  rich: markers,
112
145
  text: content,
113
- textLineHeight: 20,
114
146
  textBackgroundColor: tooltipModel.get('backgroundColor'),
115
147
  textBorderRadius: tooltipModel.get('borderRadius'),
116
148
  textFill: tooltipModel.get('textStyle.color'),
117
- textPadding: tooltipModel.get('padding')
118
- },
149
+ textPadding: tooltipModel.get('padding'),
150
+ textLineHeight: lineHeight
151
+ }),
119
152
  z: tooltipModel.get('z')
120
153
  });
121
154
  this._zr.add(this.el);
@@ -150,7 +183,9 @@ TooltipRichContent.prototype = {
150
183
 
151
184
  moveTo: function (x, y) {
152
185
  if (this.el) {
153
- this.el.attr('position', [x, y]);
186
+ var styleCoord = this._styleCoord;
187
+ makeStyleCoord(styleCoord, this._zr, x, y);
188
+ this.el.attr('position', [styleCoord[0], styleCoord[1]]);
154
189
  }
155
190
  },
156
191
 
@@ -165,7 +200,7 @@ TooltipRichContent.prototype = {
165
200
  if (this._show && !(this._inContent && this._enterable)) {
166
201
  if (time) {
167
202
  this._hideDelay = time;
168
- // Set show false to avoid invoke hideLater mutiple times
203
+ // Set show false to avoid invoke hideLater multiple times
169
204
  this._show = false;
170
205
  this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);
171
206
  }
@@ -179,6 +214,14 @@ TooltipRichContent.prototype = {
179
214
  return this._show;
180
215
  },
181
216
 
217
+ dispose: function () {
218
+ clearTimeout(this._hideTimeout);
219
+
220
+ if (this.el) {
221
+ this._zr.remove(this.el);
222
+ }
223
+ },
224
+
182
225
  getOuterSize: function () {
183
226
  var size = this.getSize();
184
227
  return {
@@ -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 {
@@ -107,7 +109,7 @@ export default echarts.extendComponentView({
107
109
  this._alwaysShowContent = tooltipModel.get('alwaysShowContent');
108
110
 
109
111
  var tooltipContent = this._tooltipContent;
110
- tooltipContent.update();
112
+ tooltipContent.update(tooltipModel);
111
113
  tooltipContent.setEnterable(tooltipModel.get('enterable'));
112
114
 
113
115
  this._initGlobalListener();
@@ -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
  },
@@ -340,7 +339,7 @@ export default echarts.extendComponentView({
340
339
  _showOrMove: function (tooltipModel, cb) {
341
340
  // showDelay is used in this case: tooltip.enterable is set
342
341
  // as true. User intent to move mouse into tooltip and click
343
- // something. `showDelay` makes it easyer to enter the content
342
+ // something. `showDelay` makes it easier to enter the content
344
343
  // but tooltip do not move immediately.
345
344
  var delay = tooltipModel.get('showDelay');
346
345
  cb = zrUtil.bind(cb, this);
@@ -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([
@@ -423,7 +424,7 @@ export default echarts.extendComponentView({
423
424
 
424
425
  // Default tooltip content
425
426
  // FIXME
426
- // (1) shold be the first data which has name?
427
+ // (1) should be the first data which has name?
427
428
  // (2) themeRiver, firstDataIndex is array, and first line is unnecessary.
428
429
  var firstLine = valueLabel;
429
430
  if (renderMode !== 'html') {
@@ -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),
@@ -539,7 +540,7 @@ export default echarts.extendComponentView({
539
540
  var asyncTicket = Math.random();
540
541
 
541
542
  // Do not check whether `trigger` is 'none' here, because `trigger`
542
- // only works on cooridinate system. In fact, we have not found case
543
+ // only works on coordinate system. In fact, we have not found case
543
544
  // that requires setting `trigger` nothing on component yet.
544
545
 
545
546
  this._showOrMove(subTooltipModel, function () {
@@ -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
  },
@@ -395,7 +395,7 @@ var VisualMapModel = echarts.extendComponentModel({
395
395
  // Originally we use visualMap.color as the default color, but setOption at
396
396
  // the second time the default color will be erased. So we change to use
397
397
  // constant DEFAULT_COLOR.
398
- // If user do not want the defualt color, set inRange: {color: null}.
398
+ // If user do not want the default color, set inRange: {color: null}.
399
399
  base.inRange = base.inRange || {color: ecModel.get('gradientColor')};
400
400
 
401
401
  // If using shortcut like: {inRange: 'symbol'}, complete default value.
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
  */
@@ -30,7 +30,7 @@ var defaultOption = {
30
30
  name: '',
31
31
  // 'start' | 'middle' | 'end'
32
32
  nameLocation: 'end',
33
- // By degree. By defualt auto rotate by nameLocation.
33
+ // By degree. By default auto rotate by nameLocation.
34
34
  nameRotate: null,
35
35
  nameTruncate: {
36
36
  maxWidth: null,
@@ -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')
@@ -380,8 +387,10 @@ function rotateTextRect(textRect, rotate) {
380
387
  var boundingBox = textRect.plain();
381
388
  var beforeWidth = boundingBox.width;
382
389
  var beforeHeight = boundingBox.height;
383
- var afterWidth = beforeWidth * Math.cos(rotateRadians) + beforeHeight * Math.sin(rotateRadians);
384
- var afterHeight = beforeWidth * Math.sin(rotateRadians) + beforeHeight * Math.cos(rotateRadians);
390
+ var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians))
391
+ + Math.abs(beforeHeight * Math.sin(rotateRadians));
392
+ var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians))
393
+ + Math.abs(beforeHeight * Math.cos(rotateRadians));
385
394
  var rotatedRect = new BoundingRect(boundingBox.x, boundingBox.y, afterWidth, afterHeight);
386
395
 
387
396
  return rotatedRect;
@@ -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;
@@ -147,12 +147,9 @@ var GeoModel = ComponentModel.extend({
147
147
  * @return {string}
148
148
  */
149
149
  getFormattedLabel: function (name, status) {
150
+ status = status || 'normal';
150
151
  var regionModel = this.getRegionModel(name);
151
- var formatter = regionModel.get(
152
- 'label'
153
- + (status === 'normal' ? '.' : status + '.')
154
- + 'formatter'
155
- );
152
+ var formatter = regionModel.get((status === 'normal' ? '' : status + '.') + 'label.formatter');
156
153
  var params = {
157
154
  name: name
158
155
  };
@@ -176,4 +173,4 @@ var GeoModel = ComponentModel.extend({
176
173
 
177
174
  zrUtil.mixin(GeoModel, selectableMixin);
178
175
 
179
- export default GeoModel;
176
+ export default GeoModel;
@@ -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
  );
@@ -186,7 +186,7 @@ Radar.prototype.update = function (ecModel, api) {
186
186
  }
187
187
  // Force all the axis fixing the maxSplitNumber.
188
188
  zrUtil.each(indicatorAxes, function (indicatorAxis, idx) {
189
- var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
189
+ var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
190
190
  niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
191
191
 
192
192
  var axisModel = indicatorAxis.model;
@@ -195,6 +195,7 @@ Radar.prototype.update = function (ecModel, api) {
195
195
  var fixedMax = axisModel.getMax();
196
196
  var interval = scale.getInterval();
197
197
 
198
+
198
199
  if (fixedMin != null && fixedMax != null) {
199
200
  // User set min, max, divide to get new interval
200
201
  scale.setExtent(+fixedMin, +fixedMax);
@@ -230,13 +231,10 @@ Radar.prototype.update = function (ecModel, api) {
230
231
  if (nicedSplitNumber > splitNumber) {
231
232
  interval = increaseInterval(interval);
232
233
  }
233
- // PENDING
234
- var center = Math.round((rawExtent[0] + rawExtent[1]) / 2 / interval) * interval;
235
- var halfSplitNumber = Math.round(splitNumber / 2);
236
- scale.setExtent(
237
- numberUtil.round(center - halfSplitNumber * interval),
238
- numberUtil.round(center + (splitNumber - halfSplitNumber) * interval)
239
- );
234
+ // TODO
235
+ var max = Math.ceil(rawExtent[1] / interval) * interval;
236
+ var min = numberUtil.round(max - interval * splitNumber);
237
+ scale.setExtent(min, max);
240
238
  scale.setInterval(interval);
241
239
  }
242
240
  });