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
@@ -1,6 +1,10 @@
1
1
  define(function (require) {
2
2
 
3
3
  var zrUtil = require('zrender/core/util');
4
+ var modelUtil = require('../../util/model');
5
+
6
+ var each = zrUtil.each;
7
+ var isObject = zrUtil.isObject;
4
8
 
5
9
  var POSSIBLE_STYLES = [
6
10
  'areaStyle', 'lineStyle', 'nodeStyle', 'linkStyle',
@@ -9,68 +13,176 @@ define(function (require) {
9
13
 
10
14
  function compatItemStyle(opt) {
11
15
  var itemStyleOpt = opt && opt.itemStyle;
12
- if (itemStyleOpt) {
13
- zrUtil.each(POSSIBLE_STYLES, function (styleName) {
14
- var normalItemStyleOpt = itemStyleOpt.normal;
15
- var emphasisItemStyleOpt = itemStyleOpt.emphasis;
16
- if (normalItemStyleOpt && normalItemStyleOpt[styleName]) {
17
- opt[styleName] = opt[styleName] || {};
18
- if (!opt[styleName].normal) {
19
- opt[styleName].normal = normalItemStyleOpt[styleName];
20
- }
21
- else {
22
- zrUtil.merge(opt[styleName].normal, normalItemStyleOpt[styleName]);
23
- }
24
- normalItemStyleOpt[styleName] = null;
16
+ if (!itemStyleOpt) {
17
+ return;
18
+ }
19
+ for (var i = 0, len = POSSIBLE_STYLES.length; i < len; i++) {
20
+ var styleName = POSSIBLE_STYLES[i];
21
+ var normalItemStyleOpt = itemStyleOpt.normal;
22
+ var emphasisItemStyleOpt = itemStyleOpt.emphasis;
23
+ if (normalItemStyleOpt && normalItemStyleOpt[styleName]) {
24
+ opt[styleName] = opt[styleName] || {};
25
+ if (!opt[styleName].normal) {
26
+ opt[styleName].normal = normalItemStyleOpt[styleName];
25
27
  }
26
- if (emphasisItemStyleOpt && emphasisItemStyleOpt[styleName]) {
27
- opt[styleName] = opt[styleName] || {};
28
- if (!opt[styleName].emphasis) {
29
- opt[styleName].emphasis = emphasisItemStyleOpt[styleName];
30
- }
31
- else {
32
- zrUtil.merge(opt[styleName].emphasis, emphasisItemStyleOpt[styleName]);
33
- }
34
- emphasisItemStyleOpt[styleName] = null;
28
+ else {
29
+ zrUtil.merge(opt[styleName].normal, normalItemStyleOpt[styleName]);
30
+ }
31
+ normalItemStyleOpt[styleName] = null;
32
+ }
33
+ if (emphasisItemStyleOpt && emphasisItemStyleOpt[styleName]) {
34
+ opt[styleName] = opt[styleName] || {};
35
+ if (!opt[styleName].emphasis) {
36
+ opt[styleName].emphasis = emphasisItemStyleOpt[styleName];
37
+ }
38
+ else {
39
+ zrUtil.merge(opt[styleName].emphasis, emphasisItemStyleOpt[styleName]);
40
+ }
41
+ emphasisItemStyleOpt[styleName] = null;
42
+ }
43
+ }
44
+ }
45
+
46
+ function compatTextStyle(opt, propName) {
47
+ var labelOptSingle = isObject(opt) && opt[propName];
48
+ var textStyle = isObject(labelOptSingle) && labelOptSingle.textStyle;
49
+ if (textStyle) {
50
+ for (var i = 0, len = modelUtil.TEXT_STYLE_OPTIONS.length; i < len; i++) {
51
+ var propName = modelUtil.TEXT_STYLE_OPTIONS[i];
52
+ if (textStyle.hasOwnProperty(propName)) {
53
+ labelOptSingle[propName] = textStyle[propName];
35
54
  }
36
- });
55
+ }
56
+ }
57
+ }
58
+
59
+ function compatLabelTextStyle(labelOpt) {
60
+ if (isObject(labelOpt)) {
61
+ compatTextStyle(labelOpt, 'normal');
62
+ compatTextStyle(labelOpt, 'emphasis');
37
63
  }
38
64
  }
39
65
 
40
- return function (seriesOpt) {
41
- if (!seriesOpt) {
66
+ function processSeries(seriesOpt) {
67
+ if (!isObject(seriesOpt)) {
42
68
  return;
43
69
  }
70
+
44
71
  compatItemStyle(seriesOpt);
45
- compatItemStyle(seriesOpt.markPoint);
72
+ compatLabelTextStyle(seriesOpt.label);
73
+ // treemap
74
+ compatLabelTextStyle(seriesOpt.upperLabel);
75
+ // graph
76
+ compatLabelTextStyle(seriesOpt.edgeLabel);
77
+
78
+ var markPoint = seriesOpt.markPoint;
79
+ compatItemStyle(markPoint);
80
+ compatLabelTextStyle(markPoint && markPoint.label);
81
+
82
+ var markLine = seriesOpt.markLine;
46
83
  compatItemStyle(seriesOpt.markLine);
84
+ compatLabelTextStyle(markLine && markLine.label);
85
+
86
+ var markArea = seriesOpt.markArea;
87
+ compatLabelTextStyle(markArea && markArea.label);
88
+
89
+ // For gauge
90
+ compatTextStyle(seriesOpt, 'axisLabel');
91
+ compatTextStyle(seriesOpt, 'title');
92
+ compatTextStyle(seriesOpt, 'detail');
93
+
47
94
  var data = seriesOpt.data;
48
95
  if (data) {
49
96
  for (var i = 0; i < data.length; i++) {
50
97
  compatItemStyle(data[i]);
98
+ compatLabelTextStyle(data[i] && data[i].label);
51
99
  }
52
- // mark point data
53
- var markPoint = seriesOpt.markPoint;
54
- if (markPoint && markPoint.data) {
55
- var mpData = markPoint.data;
56
- for (var i = 0; i < mpData.length; i++) {
57
- compatItemStyle(mpData[i]);
58
- }
100
+ }
101
+
102
+ // mark point data
103
+ var markPoint = seriesOpt.markPoint;
104
+ if (markPoint && markPoint.data) {
105
+ var mpData = markPoint.data;
106
+ for (var i = 0; i < mpData.length; i++) {
107
+ compatItemStyle(mpData[i]);
108
+ compatLabelTextStyle(mpData[i] && mpData[i].label);
59
109
  }
60
- // mark line data
61
- var markLine = seriesOpt.markLine;
62
- if (markLine && markLine.data) {
63
- var mlData = markLine.data;
64
- for (var i = 0; i < mlData.length; i++) {
65
- if (zrUtil.isArray(mlData[i])) {
66
- compatItemStyle(mlData[i][0]);
67
- compatItemStyle(mlData[i][1]);
68
- }
69
- else {
70
- compatItemStyle(mlData[i]);
71
- }
110
+ }
111
+ // mark line data
112
+ var markLine = seriesOpt.markLine;
113
+ if (markLine && markLine.data) {
114
+ var mlData = markLine.data;
115
+ for (var i = 0; i < mlData.length; i++) {
116
+ if (zrUtil.isArray(mlData[i])) {
117
+ compatItemStyle(mlData[i][0]);
118
+ compatLabelTextStyle(mlData[i][0] && mlData[i][0].label);
119
+ compatItemStyle(mlData[i][1]);
120
+ compatLabelTextStyle(mlData[i][1] && mlData[i][1].label);
121
+ }
122
+ else {
123
+ compatItemStyle(mlData[i]);
124
+ compatLabelTextStyle(mlData[i] && mlData[i].label);
72
125
  }
73
126
  }
74
127
  }
128
+ }
129
+
130
+ function toArr(o) {
131
+ return zrUtil.isArray(o) ? o : o ? [o] : [];
132
+ }
133
+
134
+ function toObj(o) {
135
+ return (zrUtil.isArray(o) ? o[0] : o) || {};
136
+ }
137
+
138
+ return function (option, isTheme) {
139
+ each(toArr(option.series), function (seriesOpt) {
140
+ isObject(seriesOpt) && processSeries(seriesOpt);
141
+ });
142
+
143
+ var axes = ['xAxis', 'yAxis', 'radiusAxis', 'angleAxis', 'singleAxis', 'parallelAxis', 'radar'];
144
+ isTheme && axes.push('valueAxis', 'categoryAxis', 'logAxis', 'timeAxis');
145
+
146
+ each(
147
+ axes,
148
+ function (axisName) {
149
+ each(toArr(option[axisName]), function (axisOpt) {
150
+ if (axisOpt) {
151
+ compatTextStyle(axisOpt, 'axisLabel');
152
+ compatTextStyle(axisOpt.axisPointer, 'label');
153
+ }
154
+ });
155
+ }
156
+ );
157
+
158
+ each(toArr(option.parallel), function (parallelOpt) {
159
+ var parallelAxisDefault = parallelOpt && parallelOpt.parallelAxisDefault;
160
+ compatTextStyle(parallelAxisDefault, 'axisLabel');
161
+ compatTextStyle(parallelAxisDefault && parallelAxisDefault.axisPointer, 'label');
162
+ });
163
+
164
+ each(toArr(option.calendar), function (calendarOpt) {
165
+ compatTextStyle(calendarOpt, 'dayLabel');
166
+ compatTextStyle(calendarOpt, 'monthLabel');
167
+ compatTextStyle(calendarOpt, 'yearLabel');
168
+ });
169
+
170
+ // radar.name.textStyle
171
+ each(toArr(option.radar), function (radarOpt) {
172
+ compatTextStyle(radarOpt, 'name');
173
+ });
174
+
175
+ each(toArr(option.geo), function (geoOpt) {
176
+ if (isObject(geoOpt)) {
177
+ compatLabelTextStyle(geoOpt.label);
178
+ each(toArr(geoOpt.regions), function (regionObj) {
179
+ compatLabelTextStyle(regionObj.label);
180
+ });
181
+ }
182
+ });
183
+
184
+ compatLabelTextStyle(toObj(option.timeline).label);
185
+ compatTextStyle(toObj(option.axisPointer), 'label');
186
+ compatTextStyle(toObj(option.tooltip).axisPointer, 'label');
75
187
  };
76
188
  });
@@ -58,6 +58,8 @@ define(function (require) {
58
58
  // Dropped auto calculated niceExtent and use user setted extent
59
59
  // We assume user wan't to set both interval, min, max to get a better result
60
60
  this._niceExtent = this._extent.slice();
61
+
62
+ this._intervalPrecision = helper.getIntervalPrecision(interval);
61
63
  },
62
64
 
63
65
  /**
@@ -115,8 +117,9 @@ define(function (require) {
115
117
  *
116
118
  * @param {number} [splitNumber = 5] Desired number of ticks
117
119
  * @param {number} [minInterval]
120
+ * @param {number} [maxInterval]
118
121
  */
119
- niceTicks: function (splitNumber, minInterval) {
122
+ niceTicks: function (splitNumber, minInterval, maxInterval) {
120
123
  splitNumber = splitNumber || 5;
121
124
  var extent = this._extent;
122
125
  var span = extent[1] - extent[0];
@@ -130,7 +133,9 @@ define(function (require) {
130
133
  extent.reverse();
131
134
  }
132
135
 
133
- var result = helper.intervalScaleNiceTicks(extent, splitNumber, minInterval);
136
+ var result = helper.intervalScaleNiceTicks(
137
+ extent, splitNumber, minInterval, maxInterval
138
+ );
134
139
 
135
140
  this._intervalPrecision = result.intervalPrecision;
136
141
  this._interval = result.interval;
@@ -143,7 +148,8 @@ define(function (require) {
143
148
  * @param {number} [opt.splitNumber = 5] Given approx tick number
144
149
  * @param {boolean} [opt.fixMin=false]
145
150
  * @param {boolean} [opt.fixMax=false]
146
- * @param {boolean} [opt.minInterval=false]
151
+ * @param {boolean} [opt.minInterval]
152
+ * @param {boolean} [opt.maxInterval]
147
153
  */
148
154
  niceExtent: function (opt) {
149
155
  var extent = this._extent;
@@ -176,7 +182,7 @@ define(function (require) {
176
182
  extent[1] = 1;
177
183
  }
178
184
 
179
- this.niceTicks(opt.splitNumber, opt.minInterval);
185
+ this.niceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
180
186
 
181
187
  // var extent = this._extent;
182
188
  var interval = this._interval;
package/src/scale/Time.js CHANGED
@@ -77,11 +77,11 @@ define(function (require) {
77
77
  // If there are no data and extent are [Infinity, -Infinity]
78
78
  if (extent[1] === -Infinity && extent[0] === Infinity) {
79
79
  var d = new Date();
80
- extent[1] = new Date(d.getFullYear(), d.getMonth(), d.getDate());
80
+ extent[1] = +new Date(d.getFullYear(), d.getMonth(), d.getDate());
81
81
  extent[0] = extent[1] - ONE_DAY;
82
82
  }
83
83
 
84
- this.niceTicks(opt.splitNumber);
84
+ this.niceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
85
85
 
86
86
  // var extent = this._extent;
87
87
  var interval = this._interval;
@@ -97,14 +97,20 @@ define(function (require) {
97
97
  /**
98
98
  * @override
99
99
  */
100
- niceTicks: function (approxTickNum) {
101
- var timezoneOffset = this.getSetting('useUTC')
102
- ? 0 : numberUtil.getTimezoneOffset() * 60 * 1000;
100
+ niceTicks: function (approxTickNum, minInterval, maxInterval) {
103
101
  approxTickNum = approxTickNum || 10;
104
102
 
105
103
  var extent = this._extent;
106
104
  var span = extent[1] - extent[0];
107
105
  var approxInterval = span / approxTickNum;
106
+
107
+ if (minInterval != null && approxInterval < minInterval) {
108
+ approxInterval = minInterval;
109
+ }
110
+ if (maxInterval != null && approxInterval > maxInterval) {
111
+ approxInterval = maxInterval;
112
+ }
113
+
108
114
  var scaleLevelsLen = scaleLevels.length;
109
115
  var idx = bisect(scaleLevels, approxInterval, 0, scaleLevelsLen);
110
116
 
@@ -121,9 +127,11 @@ define(function (require) {
121
127
  interval *= yearStep;
122
128
  }
123
129
 
130
+ var timezoneOffset = this.getSetting('useUTC')
131
+ ? 0 : (new Date(+extent[0] || +extent[1])).getTimezoneOffset() * 60 * 1000;
124
132
  var niceExtent = [
125
133
  Math.round(mathCeil((extent[0] - timezoneOffset) / interval) * interval + timezoneOffset),
126
- Math.round(mathFloor((extent[1] - timezoneOffset)/ interval) * interval + timezoneOffset)
134
+ Math.round(mathFloor((extent[1] - timezoneOffset) / interval) * interval + timezoneOffset)
127
135
  ];
128
136
 
129
137
  scaleHelper.fixExtent(niceExtent, extent);
@@ -14,9 +14,10 @@ define(function (require) {
14
14
  * Should be extent[0] < extent[1].
15
15
  * @param {number} splitNumber splitNumber should be >= 1.
16
16
  * @param {number} [minInterval]
17
+ * @param {number} [maxInterval]
17
18
  * @return {Object} {interval, intervalPrecision, niceTickExtent}
18
19
  */
19
- helper.intervalScaleNiceTicks = function (extent, splitNumber, minInterval) {
20
+ helper.intervalScaleNiceTicks = function (extent, splitNumber, minInterval, maxInterval) {
20
21
  var result = {};
21
22
  var span = extent[1] - extent[0];
22
23
 
@@ -24,8 +25,11 @@ define(function (require) {
24
25
  if (minInterval != null && interval < minInterval) {
25
26
  interval = result.interval = minInterval;
26
27
  }
28
+ if (maxInterval != null && interval > maxInterval) {
29
+ interval = result.interval = maxInterval;
30
+ }
27
31
  // Tow more digital for tick.
28
- var precision = result.intervalPrecision = numberUtil.getPrecisionSafe(interval) + 2;
32
+ var precision = result.intervalPrecision = helper.getIntervalPrecision(interval);
29
33
  // Niced extent inside original extent
30
34
  var niceTickExtent = result.niceTickExtent = [
31
35
  roundNumber(Math.ceil(extent[0] / interval) * interval, precision),
@@ -37,6 +41,15 @@ define(function (require) {
37
41
  return result;
38
42
  };
39
43
 
44
+ /**
45
+ * @param {number} interval
46
+ * @return {number} interval precision
47
+ */
48
+ helper.getIntervalPrecision = function (interval) {
49
+ // Tow more digital for tick.
50
+ return numberUtil.getPrecisionSafe(interval) + 2;
51
+ };
52
+
40
53
  function clamp(niceTickExtent, idx, extent) {
41
54
  niceTickExtent[idx] = Math.max(Math.min(niceTickExtent[idx], extent[1]), extent[0]);
42
55
  }
@@ -37,29 +37,7 @@ define(function (require) {
37
37
  return str;
38
38
  };
39
39
 
40
- /**
41
- * Normalize css liked array configuration
42
- * e.g.
43
- * 3 => [3, 3, 3, 3]
44
- * [4, 2] => [4, 2, 4, 2]
45
- * [4, 3, 2] => [4, 3, 2, 3]
46
- * @param {number|Array.<number>} val
47
- */
48
- formatUtil.normalizeCssArray = function (val) {
49
- var len = val.length;
50
- if (typeof (val) === 'number') {
51
- return [val, val, val, val];
52
- }
53
- else if (len === 2) {
54
- // vertical | horizontal
55
- return [val[0], val[1], val[0], val[1]];
56
- }
57
- else if (len === 3) {
58
- // top | horizontal | bottom
59
- return [val[0], val[1], val[2], val[1]];
60
- }
61
- return val;
62
- };
40
+ formatUtil.normalizeCssArray = zrUtil.normalizeCssArray;
63
41
 
64
42
  var encodeHTML = formatUtil.encodeHTML = function (source) {
65
43
  return String(source)
@@ -180,7 +158,7 @@ define(function (require) {
180
158
  var s = date['get' + utc + 'Seconds']();
181
159
 
182
160
  tpl = tpl.replace('MM', s2d(M))
183
- .toLowerCase()
161
+ .replace('M', M)
184
162
  .replace('yyyy', y)
185
163
  .replace('yy', y % 100)
186
164
  .replace('dd', s2d(d))
@@ -206,5 +184,7 @@ define(function (require) {
206
184
 
207
185
  formatUtil.truncateText = textContain.truncateText;
208
186
 
187
+ formatUtil.getTextRect = textContain.getBoundingRect;
188
+
209
189
  return formatUtil;
210
190
  });