echarts 3.6.1 → 3.7.2

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 (321) hide show
  1. package/README.md +1 -0
  2. package/dist/echarts-en.js +77756 -0
  3. package/dist/echarts-en.min.js +38 -0
  4. package/dist/echarts.common-en.js +50169 -0
  5. package/dist/echarts.common-en.min.js +30 -0
  6. package/dist/echarts.common.js +5799 -3093
  7. package/dist/echarts.common.min.js +14 -13
  8. package/dist/echarts.js +7628 -4679
  9. package/dist/echarts.min.js +22 -22
  10. package/dist/echarts.simple-en.js +34988 -0
  11. package/dist/echarts.simple-en.min.js +27 -0
  12. package/dist/echarts.simple.js +4472 -2493
  13. package/dist/echarts.simple.min.js +11 -9
  14. package/dist/extension/bmap.js +50 -11
  15. package/dist/extension/bmap.min.js +1 -1
  16. package/dist/extension/dataTool.js +10 -10
  17. package/extension/bmap/BMapCoordSys.js +40 -1
  18. package/index.blank.js +4 -0
  19. package/index.common.js +1 -1
  20. package/index.js +1 -1
  21. package/lib/action/createDataSelectAction.js +6 -2
  22. package/lib/chart/bar/BarView.js +6 -3
  23. package/lib/chart/bar/BaseBarSeries.js +4 -3
  24. package/lib/chart/bar/PictorialBarSeries.js +1 -1
  25. package/lib/chart/bar/PictorialBarView.js +29 -7
  26. package/lib/chart/bar/helper.js +14 -31
  27. package/lib/chart/candlestick/candlestickLayout.js +49 -6
  28. package/lib/chart/chord/chordCircularLayout.js +2 -2
  29. package/lib/chart/custom.js +135 -21
  30. package/lib/chart/funnel/FunnelSeries.js +0 -1
  31. package/lib/chart/funnel/FunnelView.js +15 -22
  32. package/lib/chart/funnel/funnelLayout.js +1 -1
  33. package/lib/chart/gauge/GaugeSeries.js +7 -12
  34. package/lib/chart/gauge/GaugeView.js +32 -53
  35. package/lib/chart/graph/GraphSeries.js +2 -1
  36. package/lib/chart/graph/GraphView.js +39 -45
  37. package/lib/chart/graph/forceHelper.js +5 -0
  38. package/lib/chart/graph/forceLayout.js +1 -1
  39. package/lib/chart/heatmap/HeatmapLayer.js +7 -0
  40. package/lib/chart/heatmap/HeatmapView.js +10 -9
  41. package/lib/chart/helper/EffectSymbol.js +3 -3
  42. package/lib/chart/helper/LargeSymbolDraw.js +6 -1
  43. package/lib/chart/helper/Line.js +40 -22
  44. package/lib/chart/helper/Symbol.js +20 -7
  45. package/lib/chart/helper/SymbolDraw.js +2 -1
  46. package/lib/chart/helper/labelHelper.js +0 -17
  47. package/lib/chart/helper/whiskerBoxCommon.js +11 -3
  48. package/lib/chart/line/LineSeries.js +1 -0
  49. package/lib/chart/line/LineView.js +14 -2
  50. package/lib/chart/line/poly.js +5 -0
  51. package/lib/chart/lines/LinesView.js +22 -7
  52. package/lib/chart/map/MapSeries.js +3 -7
  53. package/lib/chart/map/MapView.js +29 -18
  54. package/lib/chart/pie/PieSeries.js +20 -6
  55. package/lib/chart/pie/PieView.js +20 -23
  56. package/lib/chart/pie/labelLayout.js +3 -3
  57. package/lib/chart/radar/RadarView.js +16 -20
  58. package/lib/chart/sankey/SankeySeries.js +2 -4
  59. package/lib/chart/sankey/SankeyView.js +13 -29
  60. package/lib/chart/sankey/sankeyLayout.js +1 -1
  61. package/lib/chart/scatter/ScatterSeries.js +2 -1
  62. package/lib/chart/themeRiver/ThemeRiverSeries.js +2 -4
  63. package/lib/chart/themeRiver/ThemeRiverView.js +2 -5
  64. package/lib/chart/themeRiver/themeRiverLayout.js +1 -1
  65. package/lib/chart/treemap/Breadcrumb.js +1 -1
  66. package/lib/chart/treemap/TreemapSeries.js +28 -8
  67. package/lib/chart/treemap/TreemapView.js +88 -77
  68. package/lib/chart/treemap/treemapLayout.js +29 -13
  69. package/lib/component/axis/AngleAxisView.js +13 -19
  70. package/lib/component/axis/AxisBuilder.js +260 -186
  71. package/lib/component/axis/CartesianAxisView.js +15 -3
  72. package/lib/component/axis/ParallelAxisView.js +1 -1
  73. package/lib/component/axis/RadiusAxisView.js +1 -1
  74. package/lib/component/axis/SingleAxisView.js +8 -2
  75. package/lib/component/axis/cartesianAxisHelper.js +11 -15
  76. package/lib/component/axisPointer/AxisPointerModel.js +1 -3
  77. package/lib/component/axisPointer/BaseAxisPointer.js +15 -38
  78. package/lib/component/axisPointer/axisTrigger.js +36 -20
  79. package/lib/component/axisPointer/modelHelper.js +3 -4
  80. package/lib/component/axisPointer/viewHelper.js +4 -6
  81. package/lib/component/axisPointer.js +1 -14
  82. package/lib/component/calendar/CalendarView.js +22 -39
  83. package/lib/component/dataZoom/AxisProxy.js +3 -2
  84. package/lib/component/dataZoom/DataZoomModel.js +16 -4
  85. package/lib/component/dataZoom/InsideZoomView.js +5 -3
  86. package/lib/component/dataZoom/SliderZoomView.js +21 -32
  87. package/lib/component/dataZoom/roams.js +33 -9
  88. package/lib/component/dataZoom/typeDefaulter.js +1 -1
  89. package/lib/component/graphic.js +17 -5
  90. package/lib/component/helper/BrushTargetManager.js +1 -1
  91. package/lib/component/helper/MapDraw.js +26 -22
  92. package/lib/component/helper/RoamController.js +12 -11
  93. package/lib/component/helper/listComponent.js +27 -24
  94. package/lib/component/helper/selectableMixin.js +40 -15
  95. package/lib/component/legend/LegendModel.js +11 -3
  96. package/lib/component/legend/LegendView.js +151 -70
  97. package/lib/component/legend/ScrollableLegendModel.js +75 -0
  98. package/lib/component/legend/ScrollableLegendView.js +367 -0
  99. package/lib/component/legend/legendAction.js +1 -0
  100. package/lib/component/legend/scrollableLegendAction.js +24 -0
  101. package/lib/component/legend.js +8 -3
  102. package/lib/component/legendScroll.js +11 -0
  103. package/lib/component/marker/MarkAreaView.js +12 -26
  104. package/lib/component/marker/MarkLineView.js +5 -5
  105. package/lib/component/marker/MarkPointView.js +4 -4
  106. package/lib/component/marker/MarkerModel.js +1 -4
  107. package/lib/component/marker/markerHelper.js +1 -0
  108. package/lib/component/radar/RadarView.js +6 -3
  109. package/lib/component/timeline/SliderTimelineModel.js +4 -6
  110. package/lib/component/timeline/SliderTimelineView.js +14 -16
  111. package/lib/component/timeline/TimelineAxis.js +1 -1
  112. package/lib/component/timeline/TimelineModel.js +1 -3
  113. package/lib/component/title.js +9 -10
  114. package/lib/component/toolbox/ToolboxModel.js +2 -0
  115. package/lib/component/toolbox/ToolboxView.js +15 -27
  116. package/lib/component/toolbox/feature/Brush.js +3 -8
  117. package/lib/component/toolbox/feature/DataView.js +5 -5
  118. package/lib/component/toolbox/feature/DataZoom.js +3 -4
  119. package/lib/component/toolbox/feature/MagicType.js +3 -6
  120. package/lib/component/toolbox/feature/Restore.js +2 -1
  121. package/lib/component/toolbox/feature/SaveAsImage.js +23 -9
  122. package/lib/component/tooltip/TooltipContent.js +4 -4
  123. package/lib/component/tooltip/TooltipView.js +29 -6
  124. package/lib/component/visualMap/ContinuousModel.js +2 -2
  125. package/lib/component/visualMap/ContinuousView.js +12 -8
  126. package/lib/component/visualMap/PiecewiseModel.js +1 -2
  127. package/lib/component/visualMap/PiecewiseView.js +2 -2
  128. package/lib/component/visualMap/VisualMapModel.js +18 -12
  129. package/lib/coord/Axis.js +1 -1
  130. package/lib/coord/axisDefault.js +3 -3
  131. package/lib/coord/axisHelper.js +18 -1
  132. package/lib/coord/axisModelCommonMixin.js +12 -2
  133. package/lib/coord/calendar/Calendar.js +65 -21
  134. package/lib/coord/calendar/CalendarModel.js +6 -12
  135. package/lib/coord/cartesian/Cartesian2D.js +0 -14
  136. package/lib/coord/cartesian/Grid.js +47 -28
  137. package/lib/coord/geo/Geo.js +2 -18
  138. package/lib/coord/geo/GeoModel.js +6 -13
  139. package/lib/coord/geo/fix/diaoyuIsland.js +30 -0
  140. package/lib/coord/geo/geoCreator.js +6 -1
  141. package/lib/coord/polar/Polar.js +0 -13
  142. package/lib/coord/radar/Radar.js +1 -1
  143. package/lib/coord/radar/RadarModel.js +6 -2
  144. package/lib/data/DataDiffer.js +14 -7
  145. package/lib/data/Graph.js +3 -0
  146. package/lib/data/List.js +1 -1
  147. package/lib/data/Tree.js +2 -2
  148. package/lib/data/helper/completeDimensions.js +2 -11
  149. package/lib/echarts.js +33 -10
  150. package/lib/lang/cn.js +4 -0
  151. package/lib/lang/default.js +42 -0
  152. package/lib/lang/en.js +42 -0
  153. package/lib/lang.js +42 -0
  154. package/lib/langEN.js +42 -0
  155. package/lib/layout/barGrid.js +11 -3
  156. package/lib/layout/barPolar.js +9 -2
  157. package/lib/model/Model.js +2 -1
  158. package/lib/model/Series.js +14 -6
  159. package/lib/model/mixin/textStyle.js +11 -9
  160. package/lib/preprocessor/backwardCompat.js +5 -4
  161. package/lib/preprocessor/helper/compatStyle.js +157 -45
  162. package/lib/scale/Interval.js +10 -4
  163. package/lib/scale/Time.js +14 -6
  164. package/lib/scale/helper.js +15 -2
  165. package/lib/util/format.js +4 -24
  166. package/lib/util/graphic.js +412 -21
  167. package/lib/util/layout.js +28 -16
  168. package/lib/util/model.js +26 -11
  169. package/lib/util/number.js +106 -21
  170. package/lib/visual/VisualMapping.js +4 -4
  171. package/package.json +3 -3
  172. package/rollup.config.js +49 -0
  173. package/src/action/createDataSelectAction.js +6 -2
  174. package/src/chart/bar/BarView.js +6 -3
  175. package/src/chart/bar/BaseBarSeries.js +4 -3
  176. package/src/chart/bar/PictorialBarSeries.js +1 -1
  177. package/src/chart/bar/PictorialBarView.js +29 -7
  178. package/src/chart/bar/helper.js +13 -30
  179. package/src/chart/candlestick/candlestickLayout.js +49 -6
  180. package/src/chart/chord/chordCircularLayout.js +2 -2
  181. package/src/chart/custom.js +135 -21
  182. package/src/chart/funnel/FunnelSeries.js +0 -1
  183. package/src/chart/funnel/FunnelView.js +15 -22
  184. package/src/chart/funnel/funnelLayout.js +1 -1
  185. package/src/chart/gauge/GaugeSeries.js +7 -12
  186. package/src/chart/gauge/GaugeView.js +32 -53
  187. package/src/chart/graph/GraphSeries.js +2 -1
  188. package/src/chart/graph/GraphView.js +39 -45
  189. package/src/chart/graph/forceHelper.js +5 -0
  190. package/src/chart/graph/forceLayout.js +1 -1
  191. package/src/chart/heatmap/HeatmapLayer.js +7 -0
  192. package/src/chart/heatmap/HeatmapView.js +10 -9
  193. package/src/chart/helper/EffectSymbol.js +3 -3
  194. package/src/chart/helper/LargeSymbolDraw.js +6 -1
  195. package/src/chart/helper/Line.js +40 -22
  196. package/src/chart/helper/Symbol.js +20 -7
  197. package/src/chart/helper/SymbolDraw.js +2 -1
  198. package/src/chart/helper/labelHelper.js +0 -17
  199. package/src/chart/helper/whiskerBoxCommon.js +11 -4
  200. package/src/chart/line/LineSeries.js +1 -0
  201. package/src/chart/line/LineView.js +14 -2
  202. package/src/chart/line/poly.js +5 -0
  203. package/src/chart/lines/LinesView.js +22 -7
  204. package/src/chart/map/MapSeries.js +3 -7
  205. package/src/chart/map/MapView.js +29 -18
  206. package/src/chart/pie/PieSeries.js +20 -6
  207. package/src/chart/pie/PieView.js +20 -23
  208. package/src/chart/pie/labelLayout.js +3 -3
  209. package/src/chart/radar/RadarView.js +16 -20
  210. package/src/chart/sankey/SankeySeries.js +2 -4
  211. package/src/chart/sankey/SankeyView.js +13 -29
  212. package/src/chart/sankey/sankeyLayout.js +1 -1
  213. package/src/chart/scatter/ScatterSeries.js +2 -1
  214. package/src/chart/themeRiver/ThemeRiverSeries.js +2 -4
  215. package/src/chart/themeRiver/ThemeRiverView.js +2 -5
  216. package/src/chart/themeRiver/themeRiverLayout.js +1 -1
  217. package/src/chart/treemap/Breadcrumb.js +1 -1
  218. package/src/chart/treemap/TreemapSeries.js +28 -8
  219. package/src/chart/treemap/TreemapView.js +88 -77
  220. package/src/chart/treemap/treemapLayout.js +29 -13
  221. package/src/component/axis/AngleAxisView.js +13 -19
  222. package/src/component/axis/AxisBuilder.js +260 -186
  223. package/src/component/axis/CartesianAxisView.js +15 -3
  224. package/src/component/axis/ParallelAxisView.js +1 -1
  225. package/src/component/axis/RadiusAxisView.js +1 -1
  226. package/src/component/axis/SingleAxisView.js +8 -2
  227. package/src/component/axis/cartesianAxisHelper.js +11 -15
  228. package/src/component/axisPointer/AxisPointerModel.js +1 -3
  229. package/src/component/axisPointer/BaseAxisPointer.js +15 -38
  230. package/src/component/axisPointer/axisTrigger.js +36 -20
  231. package/src/component/axisPointer/modelHelper.js +3 -4
  232. package/src/component/axisPointer/viewHelper.js +4 -6
  233. package/src/component/axisPointer.js +1 -14
  234. package/src/component/calendar/CalendarView.js +22 -39
  235. package/src/component/dataZoom/AxisProxy.js +3 -2
  236. package/src/component/dataZoom/DataZoomModel.js +16 -4
  237. package/src/component/dataZoom/InsideZoomView.js +5 -3
  238. package/src/component/dataZoom/SliderZoomView.js +21 -32
  239. package/src/component/dataZoom/roams.js +33 -9
  240. package/src/component/dataZoom/typeDefaulter.js +1 -1
  241. package/src/component/graphic.js +17 -5
  242. package/src/component/helper/BrushTargetManager.js +1 -1
  243. package/src/component/helper/MapDraw.js +26 -22
  244. package/src/component/helper/RoamController.js +12 -11
  245. package/src/component/helper/listComponent.js +27 -24
  246. package/src/component/helper/selectableMixin.js +40 -15
  247. package/src/component/legend/LegendModel.js +11 -3
  248. package/src/component/legend/LegendView.js +151 -70
  249. package/src/component/legend/ScrollableLegendModel.js +76 -0
  250. package/src/component/legend/ScrollableLegendView.js +368 -0
  251. package/src/component/legend/legendAction.js +1 -0
  252. package/src/component/legend/scrollableLegendAction.js +25 -0
  253. package/src/component/legend.js +8 -3
  254. package/src/component/legendScroll.js +12 -0
  255. package/src/component/marker/MarkAreaView.js +12 -26
  256. package/src/component/marker/MarkLineView.js +5 -5
  257. package/src/component/marker/MarkPointView.js +4 -4
  258. package/src/component/marker/MarkerModel.js +1 -4
  259. package/src/component/marker/markerHelper.js +1 -0
  260. package/src/component/radar/RadarView.js +6 -3
  261. package/src/component/timeline/SliderTimelineModel.js +4 -6
  262. package/src/component/timeline/SliderTimelineView.js +14 -16
  263. package/src/component/timeline/TimelineAxis.js +1 -1
  264. package/src/component/timeline/TimelineModel.js +1 -3
  265. package/src/component/title.js +9 -10
  266. package/src/component/toolbox/ToolboxModel.js +2 -0
  267. package/src/component/toolbox/ToolboxView.js +15 -27
  268. package/src/component/toolbox/feature/Brush.js +3 -8
  269. package/src/component/toolbox/feature/DataView.js +5 -5
  270. package/src/component/toolbox/feature/DataZoom.js +3 -4
  271. package/src/component/toolbox/feature/MagicType.js +3 -6
  272. package/src/component/toolbox/feature/Restore.js +2 -1
  273. package/src/component/toolbox/feature/SaveAsImage.js +23 -10
  274. package/src/component/tooltip/TooltipContent.js +4 -4
  275. package/src/component/tooltip/TooltipView.js +29 -7
  276. package/src/component/visualMap/ContinuousModel.js +2 -2
  277. package/src/component/visualMap/ContinuousView.js +12 -8
  278. package/src/component/visualMap/PiecewiseModel.js +1 -2
  279. package/src/component/visualMap/PiecewiseView.js +2 -2
  280. package/src/component/visualMap/VisualMapModel.js +18 -12
  281. package/src/coord/Axis.js +1 -1
  282. package/src/coord/axisDefault.js +3 -3
  283. package/src/coord/axisHelper.js +18 -1
  284. package/src/coord/axisModelCommonMixin.js +12 -2
  285. package/src/coord/calendar/Calendar.js +65 -21
  286. package/src/coord/calendar/CalendarModel.js +6 -12
  287. package/src/coord/cartesian/Cartesian2D.js +0 -14
  288. package/src/coord/cartesian/Grid.js +47 -28
  289. package/src/coord/geo/Geo.js +2 -18
  290. package/src/coord/geo/GeoModel.js +6 -13
  291. package/src/coord/geo/fix/diaoyuIsland.js +30 -0
  292. package/src/coord/geo/geoCreator.js +6 -1
  293. package/src/coord/polar/Polar.js +0 -13
  294. package/src/coord/radar/Radar.js +1 -1
  295. package/src/coord/radar/RadarModel.js +6 -2
  296. package/src/data/DataDiffer.js +14 -7
  297. package/src/data/Graph.js +3 -0
  298. package/src/data/List.js +1 -1
  299. package/src/data/Tree.js +2 -2
  300. package/src/data/helper/completeDimensions.js +2 -11
  301. package/src/echarts.js +33 -10
  302. package/src/lang.js +43 -0
  303. package/src/langEN.js +43 -0
  304. package/src/layout/barGrid.js +11 -3
  305. package/src/layout/barPolar.js +9 -2
  306. package/src/model/Model.js +2 -1
  307. package/src/model/Series.js +14 -6
  308. package/src/model/mixin/textStyle.js +11 -9
  309. package/src/preprocessor/backwardCompat.js +5 -4
  310. package/src/preprocessor/helper/compatStyle.js +157 -45
  311. package/src/scale/Interval.js +10 -4
  312. package/src/scale/Time.js +14 -6
  313. package/src/scale/helper.js +15 -2
  314. package/src/util/format.js +4 -24
  315. package/src/util/graphic.js +412 -21
  316. package/src/util/layout.js +28 -16
  317. package/src/util/model.js +26 -11
  318. package/src/util/number.js +106 -21
  319. package/src/visual/VisualMapping.js +4 -4
  320. package/webpack.config.js +21 -7
  321. package/.npmignore +0 -10
@@ -79,9 +79,22 @@
79
79
  if (min === 'dataMin') {
80
80
  min = originalExtent[0];
81
81
  }
82
+ else if (typeof min === 'function') {
83
+ min = min({
84
+ min: originalExtent[0],
85
+ max: originalExtent[1]
86
+ });
87
+ }
88
+
82
89
  if (max === 'dataMax') {
83
90
  max = originalExtent[1];
84
91
  }
92
+ else if (typeof max === 'function') {
93
+ max = max({
94
+ min: originalExtent[0],
95
+ max: originalExtent[1]
96
+ });
97
+ }
85
98
 
86
99
  (min == null || !isFinite(min)) && (min = NaN);
87
100
  (max == null || !isFinite(max)) && (max = NaN);
@@ -113,12 +126,16 @@
113
126
  scale.base = model.get('logBase');
114
127
  }
115
128
 
129
+ var scaleType = scale.type;
116
130
  scale.setExtent(extent[0], extent[1]);
117
131
  scale.niceExtent({
118
132
  splitNumber: splitNumber,
119
133
  fixMin: fixMin,
120
134
  fixMax: fixMax,
121
- minInterval: scale.type === 'interval' ? model.get('minInterval') : null
135
+ minInterval: (scaleType === 'interval' || scaleType === 'time')
136
+ ? model.get('minInterval') : null,
137
+ maxInterval: (scaleType === 'interval' || scaleType === 'time')
138
+ ? model.get('maxInterval') : null
122
139
  });
123
140
 
124
141
  // If some one specified the min, max. And the default calculated interval
@@ -42,7 +42,12 @@
42
42
  var min = (!origin && option.rangeStart != null)
43
43
  ? option.rangeStart : option.min;
44
44
 
45
- if (this.axis && min != null && min !== 'dataMin' && !zrUtil.eqNaN(min)) {
45
+ if (this.axis
46
+ && min != null
47
+ && min !== 'dataMin'
48
+ && typeof min !== 'function'
49
+ && !zrUtil.eqNaN(min)
50
+ ) {
46
51
  min = this.axis.scale.parse(min);
47
52
  }
48
53
  return min;
@@ -57,7 +62,12 @@
57
62
  var max = (!origin && option.rangeEnd != null)
58
63
  ? option.rangeEnd : option.max;
59
64
 
60
- if (this.axis && max != null && max !== 'dataMax' && !zrUtil.eqNaN(max)) {
65
+ if (this.axis
66
+ && max != null
67
+ && max !== 'dataMax'
68
+ && typeof max !== 'function'
69
+ && !zrUtil.eqNaN(max)
70
+ ) {
61
71
  max = this.axis.scale.parse(max);
62
72
  }
63
73
  return max;
@@ -6,7 +6,7 @@
6
6
  var zrUtil = require('zrender/lib/core/util');
7
7
 
8
8
  // (24*60*60*1000)
9
- var ONE_DAY = 86400000;
9
+ var PROXIMATE_ONE_DAY = 86400000;
10
10
 
11
11
  /**
12
12
  * Calendar
@@ -75,7 +75,16 @@
75
75
  * get date info
76
76
  *
77
77
  * @param {string|number} date date
78
- * @return {Object} info
78
+ * @return {Object}
79
+ * {
80
+ * y: string, local full year, eg., '1940',
81
+ * m: string, local month, from '01' ot '12',
82
+ * d: string, local date, from '01' to '31' (if exists),
83
+ * day: It is not date.getDay(). It is the location of the cell in a week, from 0 to 6,
84
+ * time: timestamp,
85
+ * formatedDate: string, yyyy-MM-dd,
86
+ * date: original date object.
87
+ * }
79
88
  */
80
89
  getDateInfo: function (date) {
81
90
 
@@ -110,9 +119,10 @@
110
119
  return this.getDateInfo(date);
111
120
  }
112
121
 
113
- var time = this.getDateInfo(date).time;
122
+ date = new Date(this.getDateInfo(date).time);
123
+ date.setDate(date.getDate() + n);
114
124
 
115
- return this.getDateInfo(time + ONE_DAY * n);
125
+ return this.getDateInfo(date);
116
126
  },
117
127
 
118
128
  update: function (ecModel, api) {
@@ -178,18 +188,18 @@
178
188
  }
179
189
 
180
190
  var week = dayInfo.day;
181
- var nthWeek = this._getRangeInfo([range.start.time, date]).weeks;
191
+ var nthWeek = this._getRangeInfo([range.start.time, date]).nthWeek;
182
192
 
183
193
  if (this._orient === 'vertical') {
184
194
  return [
185
195
  this._rect.x + week * this._sw + this._sw / 2,
186
- this._rect.y + (nthWeek - 1) * this._sh + this._sh / 2
196
+ this._rect.y + nthWeek * this._sh + this._sh / 2
187
197
  ];
188
198
 
189
199
  }
190
200
 
191
201
  return [
192
- this._rect.x + (nthWeek - 1) * this._sw + this._sw / 2,
202
+ this._rect.x + nthWeek * this._sw + this._sw / 2,
193
203
  this._rect.y + week * this._sh + this._sh / 2
194
204
  ];
195
205
 
@@ -255,7 +265,7 @@
255
265
  /**
256
266
  * Convert a (x, y) point to time date
257
267
  *
258
- * @param {string} point point
268
+ * @param {Array} point point
259
269
  * @return {Object} date
260
270
  */
261
271
  pointToDate: function (point) {
@@ -327,25 +337,60 @@
327
337
  *
328
338
  * @private
329
339
  * @param {Array} range range ['2017-01-01', '2017-07-08']
340
+ * If range[0] > range[1], they will not be reversed.
330
341
  * @return {Object} obj
331
342
  */
332
343
  _getRangeInfo: function (range) {
344
+ range = [
345
+ this.getDateInfo(range[0]),
346
+ this.getDateInfo(range[1])
347
+ ];
348
+
349
+ var reversed;
350
+ if (range[0].time > range[1].time) {
351
+ reversed = true;
352
+ range.reverse();
353
+ }
333
354
 
334
- var start = this.getDateInfo(range[0]);
335
- var end = this.getDateInfo(range[1]);
355
+ var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY)
356
+ - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1;
357
+
358
+ // Consider case:
359
+ // Firstly set system timezone as "Time Zone: America/Toronto",
360
+ // ```
361
+ // var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
362
+ // var second = new Date(1478412000000);
363
+ // var allDays = Math.floor(second / ONE_DAY) - Math.floor(first / ONE_DAY) + 1;
364
+ // ```
365
+ // will get wrong result because of DST. So we should fix it.
366
+ var date = new Date(range[0].time);
367
+ var startDateNum = date.getDate();
368
+ var endDateNum = range[1].date.getDate();
369
+ date.setDate(startDateNum + allDay - 1);
370
+ // The bias can not over a month, so just compare date.
371
+ if (date.getDate() !== endDateNum) {
372
+ var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
373
+ while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
374
+ allDay -= sign;
375
+ date.setDate(startDateNum + allDay - 1);
376
+ }
377
+ }
336
378
 
337
- var allDay = Math.floor(end.time / ONE_DAY) - Math.floor(start.time / ONE_DAY) + 1;
379
+ var weeks = Math.floor((allDay + range[0].day + 6) / 7);
380
+ var nthWeek = reversed ? -weeks + 1: weeks - 1;
338
381
 
339
- var weeks = Math.floor((allDay + start.day + 6) / 7);
382
+ reversed && range.reverse();
340
383
 
341
384
  return {
342
- range: [start.formatedDate, end.formatedDate],
343
- start: start,
344
- end: end,
385
+ range: [range[0].formatedDate, range[1].formatedDate],
386
+ start: range[0],
387
+ end: range[1],
345
388
  allDay: allDay,
346
389
  weeks: weeks,
347
- fweek: start.day,
348
- lweek: end.day
390
+ // From 0.
391
+ nthWeek: nthWeek,
392
+ fweek: range[0].day,
393
+ lweek: range[1].day
349
394
  };
350
395
  },
351
396
 
@@ -369,11 +414,10 @@
369
414
  }
370
415
 
371
416
  var nthDay = (nthWeek - 1) * 7 - rangeInfo.fweek + day;
417
+ var date = new Date(rangeInfo.start.time);
418
+ date.setDate(rangeInfo.start.d + nthDay);
372
419
 
373
- var time = rangeInfo.start.time + nthDay * ONE_DAY;
374
-
375
- return this.getDateInfo(time);
376
-
420
+ return this.getDateInfo(date);
377
421
  }
378
422
  };
379
423
 
@@ -55,9 +55,7 @@
55
55
  position: 'start',
56
56
  margin: '50%', // 50% of cellSize
57
57
  nameMap: 'en',
58
- textStyle: {
59
- color: '#000'
60
- }
58
+ color: '#000'
61
59
  },
62
60
 
63
61
  // month text style
@@ -74,9 +72,7 @@
74
72
  // cn en []
75
73
  nameMap: 'en',
76
74
  formatter: null,
77
- textStyle: {
78
- color: '#000'
79
- }
75
+ color: '#000'
80
76
  },
81
77
 
82
78
  // year text style
@@ -87,12 +83,10 @@
87
83
  position: null,
88
84
  margin: 30,
89
85
  formatter: null,
90
- textStyle: {
91
- color: '#ccc',
92
- fontFamily: 'sans-serif',
93
- fontWeight: 'bolder',
94
- fontSize: 20
95
- }
86
+ color: '#ccc',
87
+ fontFamily: 'sans-serif',
88
+ fontWeight: 'bolder',
89
+ fontSize: 20
96
90
  }
97
91
  },
98
92
 
@@ -54,20 +54,6 @@
54
54
  && this.getAxis('y').containData(data[1]);
55
55
  },
56
56
 
57
- /**
58
- * Convert series data to an array of points
59
- * @param {module:echarts/data/List} data
60
- * @param {boolean} stack
61
- * @return {Array}
62
- * Return array of points. For example:
63
- * `[[10, 10], [20, 20], [30, 30]]`
64
- */
65
- dataToPoints: function (data, stack) {
66
- return data.mapArray(['x', 'y'], function (x, y) {
67
- return this.dataToPoint([x, y]);
68
- }, stack, this);
69
- },
70
-
71
57
  /**
72
58
  * @param {Array.<number>} data
73
59
  * @param {boolean} [clamp=false]
@@ -31,7 +31,7 @@ var factory = exports;
31
31
  function getLabelUnionRect(axis) {
32
32
  var axisModel = axis.model;
33
33
  var labels = axisModel.getFormattedLabels();
34
- var textStyleModel = axisModel.getModel('axisLabel.textStyle');
34
+ var axisLabelModel = axisModel.getModel('axisLabel');
35
35
  var rect;
36
36
  var step = 1;
37
37
  var labelCount = labels.length;
@@ -41,7 +41,7 @@ var factory = exports;
41
41
  }
42
42
  for (var i = 0; i < labelCount; i += step) {
43
43
  if (!axis.isLabelIgnored(i)) {
44
- var singleRect = textStyleModel.getTextRect(labels[i]);
44
+ var singleRect = axisLabelModel.getTextRect(labels[i]);
45
45
  // FIXME consider label rotate
46
46
  rect ? rect.union(singleRect) : (rect = singleRect);
47
47
  }
@@ -95,40 +95,17 @@ var factory = exports;
95
95
 
96
96
  this._updateScale(ecModel, this.model);
97
97
 
98
- function ifAxisCanNotOnZero(otherAxisDim) {
99
- var axes = axesMap[otherAxisDim];
100
- for (var idx in axes) {
101
- if (axes.hasOwnProperty(idx)) {
102
- var axis = axes[idx];
103
- if (axis && (
104
- axis.type === 'category' || axis.type === 'time' || !ifAxisCrossZero(axis)
105
- )) {
106
- return true;
107
- }
108
- }
109
- }
110
- return false;
111
- }
112
-
113
98
  each(axesMap.x, function (xAxis) {
114
99
  niceScaleExtent(xAxis.scale, xAxis.model);
115
100
  });
116
101
  each(axesMap.y, function (yAxis) {
117
102
  niceScaleExtent(yAxis.scale, yAxis.model);
118
103
  });
119
- // Fix configuration
120
104
  each(axesMap.x, function (xAxis) {
121
- // onZero can not be enabled in these two situations
122
- // 1. When any other axis is a category axis
123
- // 2. When any other axis not across 0 point
124
- if (ifAxisCanNotOnZero('y')) {
125
- xAxis.onZero = false;
126
- }
105
+ fixAxisOnZero(axesMap, 'y', xAxis);
127
106
  });
128
107
  each(axesMap.y, function (yAxis) {
129
- if (ifAxisCanNotOnZero('x')) {
130
- yAxis.onZero = false;
131
- }
108
+ fixAxisOnZero(axesMap, 'x', yAxis);
132
109
  });
133
110
 
134
111
  // Resize again if containLabel is enabled
@@ -136,6 +113,47 @@ var factory = exports;
136
113
  this.resize(this.model, api);
137
114
  };
138
115
 
116
+ function fixAxisOnZero(axesMap, otherAxisDim, axis) {
117
+ // onZero can not be enabled in these two situations:
118
+ // 1. When any other axis is a category axis.
119
+ // 2. When no axis is cross 0 point.
120
+ var axes = axesMap[otherAxisDim];
121
+
122
+ if (!axis.onZero) {
123
+ return;
124
+ }
125
+
126
+ var onZeroAxisIndex = axis.onZeroAxisIndex;
127
+
128
+ // If target axis is specified.
129
+ if (onZeroAxisIndex != null) {
130
+ var otherAxis = axes[onZeroAxisIndex];
131
+ if (otherAxis && canNotOnZeroToAxis(otherAxis)) {
132
+ axis.onZero = false;
133
+ }
134
+ return;
135
+ }
136
+
137
+ for (var idx in axes) {
138
+ if (axes.hasOwnProperty(idx)) {
139
+ var otherAxis = axes[idx];
140
+ if (otherAxis && !canNotOnZeroToAxis(otherAxis)) {
141
+ onZeroAxisIndex = +idx;
142
+ break;
143
+ }
144
+ }
145
+ }
146
+
147
+ if (onZeroAxisIndex == null) {
148
+ axis.onZero = false;
149
+ }
150
+ axis.onZeroAxisIndex = onZeroAxisIndex;
151
+ }
152
+
153
+ function canNotOnZeroToAxis(axis) {
154
+ return axis.type === 'category' || axis.type === 'time' || !ifAxisCrossZero(axis);
155
+ }
156
+
139
157
  /**
140
158
  * Resize the grid
141
159
  * @param {module:echarts/coord/cartesian/GridModel} gridModel
@@ -190,7 +208,7 @@ var factory = exports;
190
208
 
191
209
  /**
192
210
  * @param {string} axisType
193
- * @param {ndumber} [axisIndex]
211
+ * @param {number} [axisIndex]
194
212
  */
195
213
  gridProto.getAxis = function (axisType, axisIndex) {
196
214
  var axesMapOnDim = this._axesMap[axisType];
@@ -417,6 +435,7 @@ var factory = exports;
417
435
  axis.inverse = axisModel.get('inverse');
418
436
 
419
437
  axis.onZero = axisModel.get('axisLine.onZero');
438
+ axis.onZeroAxisIndex = axisModel.get('axisLine.onZeroAxisIndex');
420
439
 
421
440
  // Inject axis into axisModel
422
441
  axisModel.axis = axis;
@@ -13,7 +13,8 @@
13
13
  var geoFixFuncs = [
14
14
  require('./fix/nanhai'),
15
15
  require('./fix/textCoord'),
16
- require('./fix/geoCoord')
16
+ require('./fix/geoCoord'),
17
+ require('./fix/diaoyuIsland')
17
18
  ];
18
19
 
19
20
  /**
@@ -191,23 +192,6 @@
191
192
  return (this._rect = rect || new BoundingRect(0, 0, 0, 0));
192
193
  },
193
194
 
194
- /**
195
- * Convert series data to a list of points
196
- * @param {module:echarts/data/List} data
197
- * @param {boolean} stack
198
- * @return {Array}
199
- * Return list of points. For example:
200
- * `[[10, 10], [20, 20], [30, 30]]`
201
- */
202
- dataToPoints: function (data) {
203
- var item = [];
204
- return data.mapArray(['lng', 'lat'], function (lon, lat) {
205
- item[0] = lon;
206
- item[1] = lat;
207
- return this.dataToPoint(item);
208
- }, this);
209
- },
210
-
211
195
  /**
212
196
  * @param {string|Array.<number>} data
213
197
  * @return {Array.<number>}
@@ -23,17 +23,15 @@
23
23
  init: function (option) {
24
24
  ComponentModel.prototype.init.apply(this, arguments);
25
25
 
26
- // Default label emphasis `position` and `show`
27
- modelUtil.defaultEmphasis(
28
- option.label, ['position', 'show', 'textStyle', 'distance', 'formatter']
29
- );
26
+ // Default label emphasis `show`
27
+ modelUtil.defaultEmphasis(option.label, ['show']);
30
28
  },
31
29
 
32
30
  optionUpdated: function () {
33
31
  var option = this.option;
34
32
  var self = this;
35
33
 
36
- option.regions = geoCreator.getFilledRegions(option.regions, option.map);
34
+ option.regions = geoCreator.getFilledRegions(option.regions, option.map, option.nameMap);
37
35
 
38
36
  this._optionModelMap = zrUtil.reduce(option.regions || [], function (optionModelMap, regionOpt) {
39
37
  if (regionOpt.name) {
@@ -95,15 +93,11 @@
95
93
  label: {
96
94
  normal: {
97
95
  show: false,
98
- textStyle: {
99
- color: '#000'
100
- }
96
+ color: '#000'
101
97
  },
102
98
  emphasis: {
103
99
  show: true,
104
- textStyle: {
105
- color: 'rgb(100,0,0)'
106
- }
100
+ color: 'rgb(100,0,0)'
107
101
  }
108
102
  },
109
103
 
@@ -148,8 +142,7 @@
148
142
  return formatter(params);
149
143
  }
150
144
  else if (typeof formatter === 'string') {
151
- var serName = params.seriesName;
152
- return formatter.replace('{a}', serName != null ? serName : '');
145
+ return formatter.replace('{a}', name != null ? name : '');
153
146
  }
154
147
  },
155
148
 
@@ -0,0 +1,30 @@
1
+ // Fix for 钓鱼岛
2
+
3
+
4
+ // var Region = require('../Region');
5
+ // var zrUtil = require('zrender/lib/core/util');
6
+
7
+ // var geoCoord = [126, 25];
8
+
9
+ var points = [
10
+ [
11
+ [123.45165252685547, 25.73527164402261],
12
+ [123.49731445312499, 25.73527164402261],
13
+ [123.49731445312499, 25.750734064600884],
14
+ [123.45165252685547, 25.750734064600884],
15
+ [123.45165252685547, 25.73527164402261]
16
+ ]
17
+ ];
18
+ module.exports = function (geo) {
19
+ if (geo.map === 'china') {
20
+ for (var i = 0, len = geo.regions.length; i < len; ++i) {
21
+ if (geo.regions[i].name === '台湾') {
22
+ geo.regions[i].geometries.push({
23
+ type: 'polygon',
24
+ exterior: points[0]
25
+ });
26
+ }
27
+ }
28
+ }
29
+ };
30
+
@@ -245,11 +245,13 @@
245
245
  * Fill given regions array
246
246
  * @param {Array.<Object>} originRegionArr
247
247
  * @param {string} mapName
248
+ * @param {Object} [nameMap]
248
249
  * @return {Array}
249
250
  */
250
- getFilledRegions: function (originRegionArr, mapName) {
251
+ getFilledRegions: function (originRegionArr, mapName, nameMap) {
251
252
  // Not use the original
252
253
  var regionsArr = (originRegionArr || []).slice();
254
+ nameMap = nameMap || {};
253
255
 
254
256
  var map = geoCreator.getMap(mapName);
255
257
  var geoJson = map && map.geoJson;
@@ -269,6 +271,9 @@
269
271
  for (var i = 0; i < features.length; i++) {
270
272
  var name = features[i].properties.name;
271
273
  if (!dataNameMap.get(name)) {
274
+ if (nameMap.hasOwnProperty(name)) {
275
+ name = nameMap[name];
276
+ }
272
277
  regionsArr.push({
273
278
  name: name
274
279
  });
@@ -163,19 +163,6 @@
163
163
  };
164
164
  },
165
165
 
166
- /**
167
- * Convert series data to a list of (x, y) points
168
- * @param {module:echarts/data/List} data
169
- * @return {Array}
170
- * Return list of coordinates. For example:
171
- * `[[10, 10], [20, 20], [30, 30]]`
172
- */
173
- dataToPoints: function (data) {
174
- return data.mapArray(this.dimensions, function (radius, angle) {
175
- return this.dataToPoint([radius, angle]);
176
- }, true, this);
177
- },
178
-
179
166
  /**
180
167
  * Convert a single data item to (x, y) point.
181
168
  * Parameter data is an array which the first element is radius and the second is angle
@@ -162,7 +162,7 @@
162
162
 
163
163
  if (fixedMin != null && fixedMax != null) {
164
164
  // User set min, max, divide to get new interval
165
- // FIXME precision
165
+ scale.setExtent(+fixedMin, +fixedMax);
166
166
  scale.setInterval(
167
167
  (fixedMax - fixedMin) / splitNumber
168
168
  );
@@ -25,7 +25,7 @@
25
25
  var axisLine = this.get('axisLine');
26
26
  var axisTick = this.get('axisTick');
27
27
  var axisLabel = this.get('axisLabel');
28
- var nameTextStyle = this.get('name.textStyle');
28
+ var nameTextStyle = this.get('name');
29
29
  var showName = this.get('name.show');
30
30
  var nameFormatter = this.get('name.formatter');
31
31
  var nameGap = this.get('nameGap');
@@ -39,6 +39,10 @@
39
39
  else if (indicatorOpt.min != null && indicatorOpt.min < 0 && !indicatorOpt.max) {
40
40
  indicatorOpt.max = 0;
41
41
  }
42
+ var iNameTextStyle = nameTextStyle;
43
+ if(indicatorOpt.color != null) {
44
+ iNameTextStyle = zrUtil.defaults({color: indicatorOpt.color}, nameTextStyle);
45
+ }
42
46
  // Use same configuration
43
47
  indicatorOpt = zrUtil.merge(zrUtil.clone(indicatorOpt), {
44
48
  boundaryGap: boundaryGap,
@@ -52,7 +56,7 @@
52
56
  nameLocation: 'end',
53
57
  nameGap: nameGap,
54
58
  // min: 0,
55
- nameTextStyle: nameTextStyle,
59
+ nameTextStyle: iNameTextStyle,
56
60
  triggerEvent: triggerEvent
57
61
  }, false);
58
62
  if (!showName) {
@@ -5,12 +5,21 @@
5
5
  return item;
6
6
  }
7
7
 
8
- function DataDiffer(oldArr, newArr, oldKeyGetter, newKeyGetter) {
8
+ /**
9
+ * @param {Array} oldArr
10
+ * @param {Array} newArr
11
+ * @param {Function} oldKeyGetter
12
+ * @param {Function} newKeyGetter
13
+ * @param {Object} [context] Can be visited by this.context in callback.
14
+ */
15
+ function DataDiffer(oldArr, newArr, oldKeyGetter, newKeyGetter, context) {
9
16
  this._old = oldArr;
10
17
  this._new = newArr;
11
18
 
12
19
  this._oldKeyGetter = oldKeyGetter || defaultKeyGetter;
13
20
  this._newKeyGetter = newKeyGetter || defaultKeyGetter;
21
+
22
+ this.context = context;
14
23
  }
15
24
 
16
25
  DataDiffer.prototype = {
@@ -44,8 +53,6 @@
44
53
  execute: function () {
45
54
  var oldArr = this._old;
46
55
  var newArr = this._new;
47
- var oldKeyGetter = this._oldKeyGetter;
48
- var newKeyGetter = this._newKeyGetter;
49
56
 
50
57
  var oldDataIndexMap = {};
51
58
  var newDataIndexMap = {};
@@ -53,8 +60,8 @@
53
60
  var newDataKeyArr = [];
54
61
  var i;
55
62
 
56
- initIndexMap(oldArr, oldDataIndexMap, oldDataKeyArr, oldKeyGetter);
57
- initIndexMap(newArr, newDataIndexMap, newDataKeyArr, newKeyGetter);
63
+ initIndexMap(oldArr, oldDataIndexMap, oldDataKeyArr, '_oldKeyGetter', this);
64
+ initIndexMap(newArr, newDataIndexMap, newDataKeyArr, '_newKeyGetter', this);
58
65
 
59
66
  // Travel by inverted order to make sure order consistency
60
67
  // when duplicate keys exists (consider newDataIndex.pop() below).
@@ -103,10 +110,10 @@
103
110
  }
104
111
  };
105
112
 
106
- function initIndexMap(arr, map, keyArr, keyGetter) {
113
+ function initIndexMap(arr, map, keyArr, keyGetterName, dataDiffer) {
107
114
  for (var i = 0; i < arr.length; i++) {
108
115
  // Add prefix to avoid conflict with Object.prototype.
109
- var key = '_ec_' + keyGetter(arr[i], i);
116
+ var key = '_ec_' + dataDiffer[keyGetterName](arr[i], i);
110
117
  var existence = map[key];
111
118
  if (existence == null) {
112
119
  keyArr.push(key);
package/lib/data/Graph.js CHANGED
@@ -87,6 +87,9 @@
87
87
  var nodesMap = this._nodesMap;
88
88
 
89
89
  if (nodesMap[generateNodeKey(id)]) {
90
+ if (__DEV__) {
91
+ console.error('Graph nodes have duplicate name or id');
92
+ }
90
93
  return;
91
94
  }
92
95