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
@@ -48,7 +48,7 @@ var defaultOption = {
48
48
  name: '',
49
49
  // 'start' | 'middle' | 'end'
50
50
  nameLocation: 'end',
51
- // By degree. By defualt auto rotate by nameLocation.
51
+ // By degree. By default auto rotate by nameLocation.
52
52
  nameRotate: null,
53
53
  nameTruncate: {
54
54
  maxWidth: null,
@@ -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
@@ -391,8 +397,8 @@ function rotateTextRect(textRect, rotate) {
391
397
  var boundingBox = textRect.plain();
392
398
  var beforeWidth = boundingBox.width;
393
399
  var beforeHeight = boundingBox.height;
394
- var afterWidth = beforeWidth * Math.cos(rotateRadians) + beforeHeight * Math.sin(rotateRadians);
395
- var afterHeight = beforeWidth * Math.sin(rotateRadians) + beforeHeight * Math.cos(rotateRadians);
400
+ var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians)) + Math.abs(beforeHeight * Math.sin(rotateRadians));
401
+ var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians)) + Math.abs(beforeHeight * Math.cos(rotateRadians));
396
402
  var rotatedRect = new BoundingRect(boundingBox.x, boundingBox.y, afterWidth, afterHeight);
397
403
  return rotatedRect;
398
404
  }
@@ -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
 
@@ -143,8 +143,9 @@ var GeoModel = ComponentModel.extend({
143
143
  * @return {string}
144
144
  */
145
145
  getFormattedLabel: function (name, status) {
146
+ status = status || 'normal';
146
147
  var regionModel = this.getRegionModel(name);
147
- var formatter = regionModel.get('label' + (status === 'normal' ? '.' : status + '.') + 'formatter');
148
+ var formatter = regionModel.get((status === 'normal' ? '' : status + '.') + 'label.formatter');
148
149
  var params = {
149
150
  name: name
150
151
  };
@@ -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
  });
@@ -0,0 +1,157 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+ var zrUtil = require("zrender/lib/core/util");
22
+
23
+ /*
24
+ * Licensed to the Apache Software Foundation (ASF) under one
25
+ * or more contributor license agreements. See the NOTICE file
26
+ * distributed with this work for additional information
27
+ * regarding copyright ownership. The ASF licenses this file
28
+ * to you under the Apache License, Version 2.0 (the
29
+ * "License"); you may not use this file except in compliance
30
+ * with the License. You may obtain a copy of the License at
31
+ *
32
+ * http://www.apache.org/licenses/LICENSE-2.0
33
+ *
34
+ * Unless required by applicable law or agreed to in writing,
35
+ * software distributed under the License is distributed on an
36
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
37
+ * KIND, either express or implied. See the License for the
38
+ * specific language governing permissions and limitations
39
+ * under the License.
40
+ */
41
+
42
+ /**
43
+ * @class
44
+ * @param {Object|DataDimensionInfo} [opt] All of the fields will be shallow copied.
45
+ */
46
+ function DataDimensionInfo(opt) {
47
+ if (opt != null) {
48
+ zrUtil.extend(this, opt);
49
+ }
50
+ /**
51
+ * Dimension name.
52
+ * Mandatory.
53
+ * @type {string}
54
+ */
55
+ // this.name;
56
+
57
+ /**
58
+ * The origin name in dimsDef, see source helper.
59
+ * If displayName given, the tooltip will displayed vertically.
60
+ * Optional.
61
+ * @type {string}
62
+ */
63
+ // this.displayName;
64
+
65
+ /**
66
+ * Which coordSys dimension this dimension mapped to.
67
+ * A `coordDim` can be a "coordSysDim" that the coordSys required
68
+ * (for example, an item in `coordSysDims` of `model/referHelper#CoordSysInfo`),
69
+ * or an generated "extra coord name" if does not mapped to any "coordSysDim"
70
+ * (That is determined by whether `isExtraCoord` is `true`).
71
+ * Mandatory.
72
+ * @type {string}
73
+ */
74
+ // this.coordDim;
75
+
76
+ /**
77
+ * The index of this dimension in `series.encode[coordDim]`.
78
+ * Mandatory.
79
+ * @type {number}
80
+ */
81
+ // this.coordDimIndex;
82
+
83
+ /**
84
+ * Dimension type. The enumerable values are the key of
85
+ * `dataCtors` of `data/List`.
86
+ * Optional.
87
+ * @type {string}
88
+ */
89
+ // this.type;
90
+
91
+ /**
92
+ * This index of this dimension info in `data/List#_dimensionInfos`.
93
+ * Mandatory after added to `data/List`.
94
+ * @type {number}
95
+ */
96
+ // this.index;
97
+
98
+ /**
99
+ * The format of `otherDims` is:
100
+ * ```js
101
+ * {
102
+ * tooltip: number optional,
103
+ * label: number optional,
104
+ * itemName: number optional,
105
+ * seriesName: number optional,
106
+ * }
107
+ * ```
108
+ *
109
+ * A `series.encode` can specified these fields:
110
+ * ```js
111
+ * encode: {
112
+ * // "3, 1, 5" is the index of data dimension.
113
+ * tooltip: [3, 1, 5],
114
+ * label: [0, 3],
115
+ * ...
116
+ * }
117
+ * ```
118
+ * `otherDims` is the parse result of the `series.encode` above, like:
119
+ * ```js
120
+ * // Suppose the index of this data dimension is `3`.
121
+ * this.otherDims = {
122
+ * // `3` is at the index `0` of the `encode.tooltip`
123
+ * tooltip: 0,
124
+ * // `3` is at the index `1` of the `encode.tooltip`
125
+ * label: 1
126
+ * };
127
+ * ```
128
+ *
129
+ * This prop should never be `null`/`undefined` after initialized.
130
+ * @type {Object}
131
+ */
132
+
133
+
134
+ this.otherDims = {};
135
+ /**
136
+ * Be `true` if this dimension is not mapped to any "coordSysDim" that the
137
+ * "coordSys" required.
138
+ * Mandatory.
139
+ * @type {boolean}
140
+ */
141
+ // this.isExtraCoord;
142
+
143
+ /**
144
+ * @type {module:data/OrdinalMeta}
145
+ */
146
+ // this.ordinalMeta;
147
+
148
+ /**
149
+ * Whether to create inverted indices.
150
+ * @type {boolean}
151
+ */
152
+ // this.createInvertedIndices;
153
+ }
154
+
155
+ ;
156
+ var _default = DataDimensionInfo;
157
+ module.exports = _default;
package/lib/data/Graph.js CHANGED
@@ -191,12 +191,7 @@ graphProto.addEdge = function (n1, n2, dataIndex) {
191
191
  return;
192
192
  }
193
193
 
194
- var key = n1.id + '-' + n2.id; // PENDING
195
-
196
- if (edgesMap[key]) {
197
- return;
198
- }
199
-
194
+ var key = n1.id + '-' + n2.id;
200
195
  var edge = new Edge(n1, n2, dataIndex);
201
196
  edge.hostGraph = this;
202
197
 
package/lib/data/List.js CHANGED
@@ -39,6 +39,8 @@ var _dimensionHelper = require("./helper/dimensionHelper");
39
39
 
40
40
  var summarizeDimensions = _dimensionHelper.summarizeDimensions;
41
41
 
42
+ var DataDimensionInfo = require("./DataDimensionInfo");
43
+
42
44
  /*
43
45
  * Licensed to the Apache Software Foundation (ASF) under one
44
46
  * or more contributor license agreements. See the NOTICE file
@@ -114,13 +116,9 @@ function transferProperties(target, source) {
114
116
  * @constructor
115
117
  * @alias module:echarts/data/List
116
118
  *
117
- * @param {Array.<string|Object>} dimensions
119
+ * @param {Array.<string|Object|module:data/DataDimensionInfo>} dimensions
118
120
  * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].
119
121
  * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
120
- * Spetial fields: {
121
- * ordinalMeta: <module:echarts/data/OrdinalMeta>
122
- * createInvertedIndices: <boolean>
123
- * }
124
122
  * @param {module:echarts/model/Model} hostModel
125
123
  */
126
124
 
@@ -136,9 +134,11 @@ var List = function (dimensions, hostModel) {
136
134
  var dimensionInfo = dimensions[i];
137
135
 
138
136
  if (zrUtil.isString(dimensionInfo)) {
139
- dimensionInfo = {
137
+ dimensionInfo = new DataDimensionInfo({
140
138
  name: dimensionInfo
141
- };
139
+ });
140
+ } else if (!(dimensionInfo instanceof DataDimensionInfo)) {
141
+ dimensionInfo = new DataDimensionInfo(dimensionInfo);
142
142
  }
143
143
 
144
144
  var dimensionName = dimensionInfo.name;
@@ -419,7 +419,7 @@ listProto.mapDimension = function (coordDim, idx) {
419
419
  * Initialize from data
420
420
  * @param {Array.<Object|number|Array>} data source or data or data provider.
421
421
  * @param {Array.<string>} [nameLIst] The name of a datum is used on data diff and
422
- * defualt label/tooltip.
422
+ * default label/tooltip.
423
423
  * A name can be specified in encode.itemName,
424
424
  * or dataItem.name (only for series option data),
425
425
  * or provided in nameList from outside.
@@ -1182,7 +1182,8 @@ listProto.indexOfRawIndex = function (rawIndex) {
1182
1182
  * @param {string} dim
1183
1183
  * @param {number} value
1184
1184
  * @param {number} [maxDistance=Infinity]
1185
- * @return {Array.<number>} Considere multiple points has the same value.
1185
+ * @return {Array.<number>} If and only if multiple indices has
1186
+ * the same value, they are put to the result.
1186
1187
  */
1187
1188
 
1188
1189
 
@@ -1199,29 +1200,34 @@ listProto.indicesOfNearest = function (dim, value, maxDistance) {
1199
1200
  maxDistance = Infinity;
1200
1201
  }
1201
1202
 
1202
- var minDist = Number.MAX_VALUE;
1203
+ var minDist = Infinity;
1203
1204
  var minDiff = -1;
1205
+ var nearestIndicesLen = 0; // Check the test case of `test/ut/spec/data/List.js`.
1204
1206
 
1205
1207
  for (var i = 0, len = this.count(); i < len; i++) {
1206
- var diff = value - this.get(dim, i
1207
- /*, stack */
1208
- );
1208
+ var diff = value - this.get(dim, i);
1209
1209
  var dist = Math.abs(diff);
1210
1210
 
1211
- if (diff <= maxDistance && dist <= minDist) {
1212
- // For the case of two data are same on xAxis, which has sequence data.
1213
- // Show the nearest index
1214
- // https://github.com/ecomfe/echarts/issues/2869
1215
- if (dist < minDist || diff >= 0 && minDiff < 0) {
1211
+ if (dist <= maxDistance) {
1212
+ // When the `value` is at the middle of `this.get(dim, i)` and `this.get(dim, i+1)`,
1213
+ // we'd better not push both of them to `nearestIndices`, otherwise it is easy to
1214
+ // get more than one item in `nearestIndices` (more specifically, in `tooltip`).
1215
+ // So we chose the one that `diff >= 0` in this csae.
1216
+ // But if `this.get(dim, i)` and `this.get(dim, j)` get the same value, both of them
1217
+ // should be push to `nearestIndices`.
1218
+ if (dist < minDist || dist === minDist && diff >= 0 && minDiff < 0) {
1216
1219
  minDist = dist;
1217
1220
  minDiff = diff;
1218
- nearestIndices.length = 0;
1221
+ nearestIndicesLen = 0;
1219
1222
  }
1220
1223
 
1221
- nearestIndices.push(i);
1224
+ if (diff === minDiff) {
1225
+ nearestIndices[nearestIndicesLen++] = i;
1226
+ }
1222
1227
  }
1223
1228
  }
1224
1229
 
1230
+ nearestIndices.length = nearestIndicesLen;
1225
1231
  return nearestIndices;
1226
1232
  };
1227
1233
  /**
package/lib/data/Tree.js CHANGED
@@ -20,8 +20,6 @@
20
20
 
21
21
  var zrUtil = require("zrender/lib/core/util");
22
22
 
23
- var Model = require("../model/Model");
24
-
25
23
  var linkList = require("./helper/linkList");
26
24
 
27
25
  var List = require("./List");
@@ -281,28 +279,7 @@ TreeNode.prototype = {
281
279
 
282
280
  var hostTree = this.hostTree;
283
281
  var itemModel = hostTree.data.getItemModel(this.dataIndex);
284
- var levelModel = this.getLevelModel();
285
- var leavesModel;
286
-
287
- if (!levelModel && (this.children.length === 0 || this.children.length !== 0 && this.isExpand === false)) {
288
- leavesModel = this.getLeavesModel();
289
- }
290
-
291
- return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
292
- },
293
-
294
- /**
295
- * @return {module:echarts/model/Model}
296
- */
297
- getLevelModel: function () {
298
- return (this.hostTree.levelModels || [])[this.depth];
299
- },
300
-
301
- /**
302
- * @return {module:echarts/model/Model}
303
- */
304
- getLeavesModel: function () {
305
- return this.hostTree.leavesModel;
282
+ return itemModel.getModel(path);
306
283
  },
307
284
 
308
285
  /**
@@ -375,11 +352,9 @@ TreeNode.prototype = {
375
352
  * @constructor
376
353
  * @alias module:echarts/data/Tree
377
354
  * @param {module:echarts/model/Model} hostModel
378
- * @param {Array.<Object>} levelOptions
379
- * @param {Object} leavesOption
380
355
  */
381
356
 
382
- function Tree(hostModel, levelOptions, leavesOption) {
357
+ function Tree(hostModel) {
383
358
  /**
384
359
  * @type {module:echarts/data/Tree~TreeNode}
385
360
  * @readOnly
@@ -405,16 +380,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
405
380
  */
406
381
 
407
382
  this.hostModel = hostModel;
408
- /**
409
- * @private
410
- * @readOnly
411
- * @type {Array.<module:echarts/model/Model}
412
- */
413
-
414
- this.levelModels = zrUtil.map(levelOptions || [], function (levelDefine) {
415
- return new Model(levelDefine, hostModel, hostModel.ecModel);
416
- });
417
- this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
418
383
  }
419
384
 
420
385
  Tree.prototype = {
@@ -501,14 +466,11 @@ Tree.prototype = {
501
466
  * @static
502
467
  * @param {Object} dataRoot Root node.
503
468
  * @param {module:echarts/model/Model} hostModel
504
- * @param {Object} treeOptions
505
- * @param {Array.<Object>} treeOptions.levels
506
- * @param {Array.<Object>} treeOptions.leaves
507
469
  * @return module:echarts/data/Tree
508
470
  */
509
471
 
510
- Tree.createTree = function (dataRoot, hostModel, treeOptions) {
511
- var tree = new Tree(hostModel, treeOptions.levels, treeOptions.leaves);
472
+ Tree.createTree = function (dataRoot, hostModel, beforeLink) {
473
+ var tree = new Tree(hostModel);
512
474
  var listData = [];
513
475
  var dimMax = 1;
514
476
  buildHierarchy(dataRoot);
@@ -538,6 +500,7 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions) {
538
500
  });
539
501
  var list = new List(dimensionsInfo, hostModel);
540
502
  list.initData(listData);
503
+ beforeLink && beforeLink(list);
541
504
  linkList({
542
505
  mainData: list,
543
506
  struct: tree,