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 @@ define(function (require) {
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 @@ define(function (require) {
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 @@ define(function (require) {
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 @@ define(function (require) {
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;
@@ -7,7 +7,7 @@ define(function (require) {
7
7
  var zrUtil = require('zrender/core/util');
8
8
 
9
9
  // (24*60*60*1000)
10
- var ONE_DAY = 86400000;
10
+ var PROXIMATE_ONE_DAY = 86400000;
11
11
 
12
12
  /**
13
13
  * Calendar
@@ -76,7 +76,16 @@ define(function (require) {
76
76
  * get date info
77
77
  *
78
78
  * @param {string|number} date date
79
- * @return {Object} info
79
+ * @return {Object}
80
+ * {
81
+ * y: string, local full year, eg., '1940',
82
+ * m: string, local month, from '01' ot '12',
83
+ * d: string, local date, from '01' to '31' (if exists),
84
+ * day: It is not date.getDay(). It is the location of the cell in a week, from 0 to 6,
85
+ * time: timestamp,
86
+ * formatedDate: string, yyyy-MM-dd,
87
+ * date: original date object.
88
+ * }
80
89
  */
81
90
  getDateInfo: function (date) {
82
91
 
@@ -111,9 +120,10 @@ define(function (require) {
111
120
  return this.getDateInfo(date);
112
121
  }
113
122
 
114
- var time = this.getDateInfo(date).time;
123
+ date = new Date(this.getDateInfo(date).time);
124
+ date.setDate(date.getDate() + n);
115
125
 
116
- return this.getDateInfo(time + ONE_DAY * n);
126
+ return this.getDateInfo(date);
117
127
  },
118
128
 
119
129
  update: function (ecModel, api) {
@@ -179,18 +189,18 @@ define(function (require) {
179
189
  }
180
190
 
181
191
  var week = dayInfo.day;
182
- var nthWeek = this._getRangeInfo([range.start.time, date]).weeks;
192
+ var nthWeek = this._getRangeInfo([range.start.time, date]).nthWeek;
183
193
 
184
194
  if (this._orient === 'vertical') {
185
195
  return [
186
196
  this._rect.x + week * this._sw + this._sw / 2,
187
- this._rect.y + (nthWeek - 1) * this._sh + this._sh / 2
197
+ this._rect.y + nthWeek * this._sh + this._sh / 2
188
198
  ];
189
199
 
190
200
  }
191
201
 
192
202
  return [
193
- this._rect.x + (nthWeek - 1) * this._sw + this._sw / 2,
203
+ this._rect.x + nthWeek * this._sw + this._sw / 2,
194
204
  this._rect.y + week * this._sh + this._sh / 2
195
205
  ];
196
206
 
@@ -256,7 +266,7 @@ define(function (require) {
256
266
  /**
257
267
  * Convert a (x, y) point to time date
258
268
  *
259
- * @param {string} point point
269
+ * @param {Array} point point
260
270
  * @return {Object} date
261
271
  */
262
272
  pointToDate: function (point) {
@@ -328,25 +338,60 @@ define(function (require) {
328
338
  *
329
339
  * @private
330
340
  * @param {Array} range range ['2017-01-01', '2017-07-08']
341
+ * If range[0] > range[1], they will not be reversed.
331
342
  * @return {Object} obj
332
343
  */
333
344
  _getRangeInfo: function (range) {
345
+ range = [
346
+ this.getDateInfo(range[0]),
347
+ this.getDateInfo(range[1])
348
+ ];
349
+
350
+ var reversed;
351
+ if (range[0].time > range[1].time) {
352
+ reversed = true;
353
+ range.reverse();
354
+ }
334
355
 
335
- var start = this.getDateInfo(range[0]);
336
- var end = this.getDateInfo(range[1]);
356
+ var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY)
357
+ - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1;
358
+
359
+ // Consider case:
360
+ // Firstly set system timezone as "Time Zone: America/Toronto",
361
+ // ```
362
+ // var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
363
+ // var second = new Date(1478412000000);
364
+ // var allDays = Math.floor(second / ONE_DAY) - Math.floor(first / ONE_DAY) + 1;
365
+ // ```
366
+ // will get wrong result because of DST. So we should fix it.
367
+ var date = new Date(range[0].time);
368
+ var startDateNum = date.getDate();
369
+ var endDateNum = range[1].date.getDate();
370
+ date.setDate(startDateNum + allDay - 1);
371
+ // The bias can not over a month, so just compare date.
372
+ if (date.getDate() !== endDateNum) {
373
+ var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
374
+ while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
375
+ allDay -= sign;
376
+ date.setDate(startDateNum + allDay - 1);
377
+ }
378
+ }
337
379
 
338
- var allDay = Math.floor(end.time / ONE_DAY) - Math.floor(start.time / ONE_DAY) + 1;
380
+ var weeks = Math.floor((allDay + range[0].day + 6) / 7);
381
+ var nthWeek = reversed ? -weeks + 1: weeks - 1;
339
382
 
340
- var weeks = Math.floor((allDay + start.day + 6) / 7);
383
+ reversed && range.reverse();
341
384
 
342
385
  return {
343
- range: [start.formatedDate, end.formatedDate],
344
- start: start,
345
- end: end,
386
+ range: [range[0].formatedDate, range[1].formatedDate],
387
+ start: range[0],
388
+ end: range[1],
346
389
  allDay: allDay,
347
390
  weeks: weeks,
348
- fweek: start.day,
349
- lweek: end.day
391
+ // From 0.
392
+ nthWeek: nthWeek,
393
+ fweek: range[0].day,
394
+ lweek: range[1].day
350
395
  };
351
396
  },
352
397
 
@@ -370,11 +415,10 @@ define(function (require) {
370
415
  }
371
416
 
372
417
  var nthDay = (nthWeek - 1) * 7 - rangeInfo.fweek + day;
418
+ var date = new Date(rangeInfo.start.time);
419
+ date.setDate(rangeInfo.start.d + nthDay);
373
420
 
374
- var time = rangeInfo.start.time + nthDay * ONE_DAY;
375
-
376
- return this.getDateInfo(time);
377
-
421
+ return this.getDateInfo(date);
378
422
  }
379
423
  };
380
424
 
@@ -56,9 +56,7 @@ define(function (require) {
56
56
  position: 'start',
57
57
  margin: '50%', // 50% of cellSize
58
58
  nameMap: 'en',
59
- textStyle: {
60
- color: '#000'
61
- }
59
+ color: '#000'
62
60
  },
63
61
 
64
62
  // month text style
@@ -75,9 +73,7 @@ define(function (require) {
75
73
  // cn en []
76
74
  nameMap: 'en',
77
75
  formatter: null,
78
- textStyle: {
79
- color: '#000'
80
- }
76
+ color: '#000'
81
77
  },
82
78
 
83
79
  // year text style
@@ -88,12 +84,10 @@ define(function (require) {
88
84
  position: null,
89
85
  margin: 30,
90
86
  formatter: null,
91
- textStyle: {
92
- color: '#ccc',
93
- fontFamily: 'sans-serif',
94
- fontWeight: 'bolder',
95
- fontSize: 20
96
- }
87
+ color: '#ccc',
88
+ fontFamily: 'sans-serif',
89
+ fontWeight: 'bolder',
90
+ fontSize: 20
97
91
  }
98
92
  },
99
93
 
@@ -55,20 +55,6 @@ define(function(require) {
55
55
  && this.getAxis('y').containData(data[1]);
56
56
  },
57
57
 
58
- /**
59
- * Convert series data to an array of points
60
- * @param {module:echarts/data/List} data
61
- * @param {boolean} stack
62
- * @return {Array}
63
- * Return array of points. For example:
64
- * `[[10, 10], [20, 20], [30, 30]]`
65
- */
66
- dataToPoints: function (data, stack) {
67
- return data.mapArray(['x', 'y'], function (x, y) {
68
- return this.dataToPoint([x, y]);
69
- }, stack, this);
70
- },
71
-
72
58
  /**
73
59
  * @param {Array.<number>} data
74
60
  * @param {boolean} [clamp=false]
@@ -31,7 +31,7 @@ define(function(require, factory) {
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 @@ define(function(require, factory) {
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 @@ define(function(require, factory) {
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 @@ define(function(require, factory) {
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 @@ define(function(require, factory) {
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 @@ define(function(require, factory) {
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 @@ define(function (require) {
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 @@ define(function (require) {
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>}
@@ -24,17 +24,15 @@ define(function (require) {
24
24
  init: function (option) {
25
25
  ComponentModel.prototype.init.apply(this, arguments);
26
26
 
27
- // Default label emphasis `position` and `show`
28
- modelUtil.defaultEmphasis(
29
- option.label, ['position', 'show', 'textStyle', 'distance', 'formatter']
30
- );
27
+ // Default label emphasis `show`
28
+ modelUtil.defaultEmphasis(option.label, ['show']);
31
29
  },
32
30
 
33
31
  optionUpdated: function () {
34
32
  var option = this.option;
35
33
  var self = this;
36
34
 
37
- option.regions = geoCreator.getFilledRegions(option.regions, option.map);
35
+ option.regions = geoCreator.getFilledRegions(option.regions, option.map, option.nameMap);
38
36
 
39
37
  this._optionModelMap = zrUtil.reduce(option.regions || [], function (optionModelMap, regionOpt) {
40
38
  if (regionOpt.name) {
@@ -96,15 +94,11 @@ define(function (require) {
96
94
  label: {
97
95
  normal: {
98
96
  show: false,
99
- textStyle: {
100
- color: '#000'
101
- }
97
+ color: '#000'
102
98
  },
103
99
  emphasis: {
104
100
  show: true,
105
- textStyle: {
106
- color: 'rgb(100,0,0)'
107
- }
101
+ color: 'rgb(100,0,0)'
108
102
  }
109
103
  },
110
104
 
@@ -149,8 +143,7 @@ define(function (require) {
149
143
  return formatter(params);
150
144
  }
151
145
  else if (typeof formatter === 'string') {
152
- var serName = params.seriesName;
153
- return formatter.replace('{a}', serName != null ? serName : '');
146
+ return formatter.replace('{a}', name != null ? name : '');
154
147
  }
155
148
  },
156
149
 
@@ -0,0 +1,30 @@
1
+ // Fix for 钓鱼岛
2
+ define(function (require) {
3
+
4
+ // var Region = require('../Region');
5
+ // var zrUtil = require('zrender/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
+ return 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 @@ define(function (require) {
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 @@ define(function (require) {
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
  });
@@ -164,19 +164,6 @@ define(function(require) {
164
164
  };
165
165
  },
166
166
 
167
- /**
168
- * Convert series data to a list of (x, y) points
169
- * @param {module:echarts/data/List} data
170
- * @return {Array}
171
- * Return list of coordinates. For example:
172
- * `[[10, 10], [20, 20], [30, 30]]`
173
- */
174
- dataToPoints: function (data) {
175
- return data.mapArray(this.dimensions, function (radius, angle) {
176
- return this.dataToPoint([radius, angle]);
177
- }, true, this);
178
- },
179
-
180
167
  /**
181
168
  * Convert a single data item to (x, y) point.
182
169
  * Parameter data is an array which the first element is radius and the second is angle
@@ -162,7 +162,7 @@ define(function (require) {
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 @@ define(function (require) {
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 @@ define(function (require) {
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 @@ define(function (require) {
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 @@ define(function(require) {
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 @@ define(function(require) {
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 @@ define(function(require) {
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 @@ define(function(require) {
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/src/data/Graph.js CHANGED
@@ -88,6 +88,9 @@ define(function(require) {
88
88
  var nodesMap = this._nodesMap;
89
89
 
90
90
  if (nodesMap[generateNodeKey(id)]) {
91
+ if (__DEV__) {
92
+ console.error('Graph nodes have duplicate name or id');
93
+ }
91
94
  return;
92
95
  }
93
96