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
package/src/util/model.js CHANGED
@@ -29,9 +29,7 @@ define(function(require) {
29
29
  * normal: {
30
30
  * show: false,
31
31
  * position: 'outside',
32
- * textStyle: {
33
- * fontSize: 18
34
- * }
32
+ * fontSize: 18
35
33
  * },
36
34
  * emphasis: {
37
35
  * show: true
@@ -46,16 +44,32 @@ define(function(require) {
46
44
  var normalOpt = opt.normal = opt.normal || {};
47
45
 
48
46
  // Default emphasis option from normal
49
- each(subOpts, function (subOptName) {
50
- var val = zrUtil.retrieve(emphasisOpt[subOptName], normalOpt[subOptName]);
51
- if (val != null) {
52
- emphasisOpt[subOptName] = val;
47
+ for (var i = 0, len = subOpts.length; i < len; i++) {
48
+ var subOptName = subOpts[i];
49
+ if (!emphasisOpt.hasOwnProperty(subOptName)
50
+ && normalOpt.hasOwnProperty(subOptName)
51
+ ) {
52
+ emphasisOpt[subOptName] = normalOpt[subOptName];
53
53
  }
54
- });
54
+ }
55
55
  }
56
56
  };
57
57
 
58
- modelUtil.LABEL_OPTIONS = ['position', 'offset', 'show', 'textStyle', 'distance', 'formatter'];
58
+ modelUtil.TEXT_STYLE_OPTIONS = [
59
+ 'fontStyle', 'fontWeight', 'fontSize', 'fontFamily',
60
+ 'rich', 'tag', 'color', 'textBorderColor', 'textBorderWidth',
61
+ 'width', 'height', 'lineHeight', 'align', 'verticalAlign', 'baseline',
62
+ 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY',
63
+ 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY',
64
+ 'backgroundColor', 'borderColor', 'borderWidth', 'borderRadius', 'padding'
65
+ ];
66
+
67
+ // modelUtil.LABEL_OPTIONS = modelUtil.TEXT_STYLE_OPTIONS.concat([
68
+ // 'position', 'offset', 'rotate', 'origin', 'show', 'distance', 'formatter',
69
+ // 'fontStyle', 'fontWeight', 'fontSize', 'fontFamily',
70
+ // // FIXME: deprecated, check and remove it.
71
+ // 'textStyle'
72
+ // ]);
59
73
 
60
74
  /**
61
75
  * data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]
@@ -173,9 +187,10 @@ define(function(require) {
173
187
  * @param {string} [status='normal'] 'normal' or 'emphasis'
174
188
  * @param {string} [dataType]
175
189
  * @param {number} [dimIndex]
190
+ * @param {string} [labelProp='label']
176
191
  * @return {string}
177
192
  */
178
- getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {
193
+ getFormattedLabel: function (dataIndex, status, dataType, dimIndex, labelProp) {
179
194
  status = status || 'normal';
180
195
  var data = this.getData(dataType);
181
196
  var itemModel = data.getItemModel(dataIndex);
@@ -185,7 +200,7 @@ define(function(require) {
185
200
  params.value = params.value[dimIndex];
186
201
  }
187
202
 
188
- var formatter = itemModel.get(['label', status, 'formatter']);
203
+ var formatter = itemModel.get([labelProp || 'label', status, 'formatter']);
189
204
 
190
205
  if (typeof formatter === 'function') {
191
206
  params.status = status;
@@ -5,6 +5,8 @@
5
5
 
6
6
  define(function (require) {
7
7
 
8
+ var zrUtil = require('zrender/core/util');
9
+
8
10
  var number = {};
9
11
 
10
12
  var RADIAN_EPSILON = 1e-4;
@@ -185,6 +187,68 @@ define(function (require) {
185
187
  return !isFinite(precision) ? 20 : precision;
186
188
  };
187
189
 
190
+ /**
191
+ * Get a data of given precision, assuring the sum of percentages
192
+ * in valueList is 1.
193
+ * The largest remainer method is used.
194
+ * https://en.wikipedia.org/wiki/Largest_remainder_method
195
+ *
196
+ * @param {Array.<number>} valueList a list of all data
197
+ * @param {number} idx index of the data to be processed in valueList
198
+ * @param {number} precision integer number showing digits of precision
199
+ * @return {number} percent ranging from 0 to 100
200
+ */
201
+ number.getPercentWithPrecision = function (valueList, idx, precision) {
202
+ if (!valueList[idx]) {
203
+ return 0;
204
+ }
205
+
206
+ var sum = zrUtil.reduce(valueList, function (acc, val) {
207
+ return acc + (isNaN(val) ? 0 : val);
208
+ }, 0);
209
+ if (sum === 0) {
210
+ return 0;
211
+ }
212
+
213
+ var digits = Math.pow(10, precision);
214
+ var votesPerQuota = zrUtil.map(valueList, function (val) {
215
+ return (isNaN(val) ? 0 : val) / sum * digits * 100;
216
+ });
217
+ var targetSeats = digits * 100;
218
+
219
+ var seats = zrUtil.map(votesPerQuota, function (votes) {
220
+ // Assign automatic seats.
221
+ return Math.floor(votes);
222
+ });
223
+ var currentSum = zrUtil.reduce(seats, function (acc, val) {
224
+ return acc + val;
225
+ }, 0);
226
+
227
+ var remainder = zrUtil.map(votesPerQuota, function (votes, idx) {
228
+ return votes - seats[idx];
229
+ });
230
+
231
+ // Has remainding votes.
232
+ while (currentSum < targetSeats) {
233
+ // Find next largest remainder.
234
+ var max = Number.NEGATIVE_INFINITY;
235
+ var maxId = null;
236
+ for (var i = 0, len = remainder.length; i < len; ++i) {
237
+ if (remainder[i] > max) {
238
+ max = remainder[i];
239
+ maxId = i;
240
+ }
241
+ }
242
+
243
+ // Add a vote to max remainder.
244
+ ++seats[maxId];
245
+ remainder[maxId] = 0;
246
+ ++currentSum;
247
+ }
248
+
249
+ return seats[idx] / digits;
250
+ };
251
+
188
252
  // Number.MAX_SAFE_INTEGER, ie do not support.
189
253
  number.MAX_SAFE_INTEGER = 9007199254740991;
190
254
 
@@ -209,11 +273,14 @@ define(function (require) {
209
273
  var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; // jshint ignore:line
210
274
 
211
275
  /**
276
+ * Consider DST, it is incorrect to provide a method `getTimezoneOffset`
277
+ * without time specified. So this method is removed.
278
+ *
212
279
  * @return {number} in minutes
213
280
  */
214
- number.getTimezoneOffset = function () {
215
- return (new Date()).getTimezoneOffset();
216
- };
281
+ // number.getTimezoneOffset = function () {
282
+ // return (new Date()).getTimezoneOffset();
283
+ // };
217
284
 
218
285
  /**
219
286
  * @param {string|Date|number} value These values can be accepted:
@@ -247,24 +314,42 @@ define(function (require) {
247
314
  return new Date(NaN);
248
315
  }
249
316
 
250
- var timezoneOffset = number.getTimezoneOffset();
251
- var timeOffset = !match[8]
252
- ? 0
253
- : match[8].toUpperCase() === 'Z'
254
- ? timezoneOffset
255
- : +match[8].slice(0, 3) * 60 + timezoneOffset;
256
-
257
- // match[n] can only be string or undefined.
258
- // But take care of '12' + 1 => '121'.
259
- return new Date(
260
- +match[1],
261
- +(match[2] || 1) - 1,
262
- +match[3] || 1,
263
- +match[4] || 0,
264
- +(match[5] || 0) - timeOffset,
265
- +match[6] || 0,
266
- +match[7] || 0
267
- );
317
+ // Use local time when no timezone offset specifed.
318
+ if (!match[8]) {
319
+ // match[n] can only be string or undefined.
320
+ // But take care of '12' + 1 => '121'.
321
+ return new Date(
322
+ +match[1],
323
+ +(match[2] || 1) - 1,
324
+ +match[3] || 1,
325
+ +match[4] || 0,
326
+ +(match[5] || 0),
327
+ +match[6] || 0,
328
+ +match[7] || 0
329
+ );
330
+ }
331
+ // Timezoneoffset of Javascript Date has considered DST (Daylight Saving Time,
332
+ // https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment).
333
+ // For example, system timezone is set as "Time Zone: America/Toronto",
334
+ // then these code will get different result:
335
+ // `new Date(1478411999999).getTimezoneOffset(); // get 240`
336
+ // `new Date(1478412000000).getTimezoneOffset(); // get 300`
337
+ // So we should not use `new Date`, but use `Date.UTC`.
338
+ else {
339
+ var hour = +match[4] || 0;
340
+ if (match[8].toUpperCase() !== 'Z') {
341
+ hour -= match[8].slice(0, 3);
342
+ }
343
+ return new Date(Date.UTC(
344
+ +match[1],
345
+ +(match[2] || 1) - 1,
346
+ +match[3] || 1,
347
+ hour,
348
+ +(match[5] || 0),
349
+ +match[6] || 0,
350
+ +match[7] || 0
351
+ ));
352
+ }
268
353
  }
269
354
  else if (value == null) {
270
355
  return new Date(NaN);
@@ -142,7 +142,7 @@ define(function (require) {
142
142
  // which will be much faster and useful in pixel manipulation
143
143
  var returnRGBArray = !!out;
144
144
  !isNormalized && (value = this._normalizeData(value));
145
- out = zrColor.fastMapToColor(value, thisOption.parsedVisual, out);
145
+ out = zrColor.fastLerp(value, thisOption.parsedVisual, out);
146
146
  return returnRGBArray ? out : zrColor.stringify(out, 'rgba');
147
147
  },
148
148
  this
@@ -152,7 +152,7 @@ define(function (require) {
152
152
  _doMap: {
153
153
  linear: function (normalized) {
154
154
  return zrColor.stringify(
155
- zrColor.fastMapToColor(normalized, this.option.parsedVisual),
155
+ zrColor.fastLerp(normalized, this.option.parsedVisual),
156
156
  'rgba'
157
157
  );
158
158
  },
@@ -161,7 +161,7 @@ define(function (require) {
161
161
  var result = getSpecifiedVisual.call(this, value);
162
162
  if (result == null) {
163
163
  result = zrColor.stringify(
164
- zrColor.fastMapToColor(normalized, this.option.parsedVisual),
164
+ zrColor.fastLerp(normalized, this.option.parsedVisual),
165
165
  'rgba'
166
166
  );
167
167
  }
@@ -471,7 +471,7 @@ define(function (require) {
471
471
  /**
472
472
  * @public
473
473
  * @param {Object} obj
474
- * @return {Oject} new object containers visual values.
474
+ * @return {Object} new object containers visual values.
475
475
  * If no visuals, return null.
476
476
  */
477
477
  VisualMapping.retrieveVisuals = function (obj) {
package/webpack.config.js CHANGED
@@ -1,13 +1,25 @@
1
1
  var PROD = process.argv.indexOf('-p') >= 0;
2
2
  var webpack = require('webpack');
3
3
 
4
+ var IS_EN = process.argv.indexOf('--lang-en') >= 0;
5
+
6
+ var plugins = [
7
+ new webpack.DefinePlugin({
8
+ 'typeof __DEV__': JSON.stringify('boolean'),
9
+ __DEV__: PROD ? false : true
10
+ })
11
+ ];
12
+ var outputSuffix = '';
13
+
14
+ if (IS_EN) {
15
+ plugins.unshift(
16
+ new webpack.NormalModuleReplacementPlugin(/\/lang[.]js/, './langEN.js')
17
+ );
18
+ outputSuffix = '-en';
19
+ }
20
+
4
21
  module.exports = {
5
- plugins: [
6
- new webpack.DefinePlugin({
7
- 'typeof __DEV__': JSON.stringify('boolean'),
8
- __DEV__: PROD ? false : true
9
- })
10
- ],
22
+ plugins: plugins,
11
23
  entry: {
12
24
  'echarts': __dirname + '/index.js',
13
25
  'echarts.simple': __dirname + '/index.simple.js',
@@ -17,6 +29,8 @@ module.exports = {
17
29
  libraryTarget: 'umd',
18
30
  library: 'echarts',
19
31
  path: __dirname + '/dist',
20
- filename: PROD ? '[name].min.js' : '[name].js'
32
+ filename: PROD
33
+ ? '[name]' + outputSuffix + '.min.js'
34
+ : '[name]' + outputSuffix + '.js'
21
35
  }
22
36
  };
package/.npmignore DELETED
@@ -1,10 +0,0 @@
1
- /build
2
- /test
3
- /map/tool
4
- /map/raw
5
- /theme/tool
6
- /theme/thumb
7
- todo
8
- npm-debug.log
9
- /benchmark
10
- echarts.d.ts