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/lib/util/model.js CHANGED
@@ -29,9 +29,7 @@
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 @@
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 @@
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 @@
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
 
7
7
 
8
+ var zrUtil = require('zrender/lib/core/util');
9
+
8
10
  var number = {};
9
11
 
10
12
  var RADIAN_EPSILON = 1e-4;
@@ -185,6 +187,68 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echarts",
3
- "version": "3.6.1",
3
+ "version": "3.7.2",
4
4
  "description": "A powerful charting and visualization library for browser",
5
5
  "keywords": [
6
6
  "visualization",
@@ -35,7 +35,7 @@
35
35
  "prepublish": "node build/amd2common.js"
36
36
  },
37
37
  "dependencies": {
38
- "zrender": "^3.5.1"
38
+ "zrender": "^3.6.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "coordtransform": "^2.0.2",
@@ -45,6 +45,6 @@
45
45
  "fs-extra": "^0.26.5",
46
46
  "glob": "^7.0.0",
47
47
  "webpack": "^1.12.13",
48
- "zrender": "^3.5.1"
48
+ "zrender": "^3.6.2"
49
49
  }
50
50
  }
@@ -0,0 +1,49 @@
1
+ import resolve from 'rollup-plugin-node-resolve';
2
+ import commonjs from 'rollup-plugin-commonjs';
3
+ import uglify from 'rollup-plugin-uglify';
4
+
5
+ function plugins(production) {
6
+ let plugins = [
7
+ resolve(),
8
+ commonjs()
9
+ ];
10
+ if (production) {
11
+ plugins.push(uglify({
12
+ compress: {
13
+ global_defs: {
14
+ __DEV__: true
15
+ }
16
+ }
17
+ }));
18
+ }
19
+ return plugins;
20
+ }
21
+
22
+ function createBuild(type, production) {
23
+ if (type) {
24
+ type = '.' + type;
25
+ }
26
+ var postfix = '';
27
+ if (production) {
28
+ postfix = '.min';
29
+ }
30
+ return {
31
+ entry: `./index${type}.js`,
32
+ format: 'umd',
33
+ moduleName: 'echarts',
34
+ plugins: plugins(production),
35
+ dest: `dist/echarts${type}${postfix}.js`
36
+ };
37
+ }
38
+
39
+ export default [
40
+ createBuild('blank', false),
41
+ createBuild('simple', false),
42
+ createBuild('common', false),
43
+ createBuild('', false),
44
+
45
+ createBuild('blank', true),
46
+ createBuild('simple', true),
47
+ createBuild('common', true),
48
+ createBuild('', true)
49
+ ];
@@ -15,13 +15,17 @@ define(function (require) {
15
15
  {mainType: 'series', subType: seriesType, query: payload},
16
16
  function (seriesModel) {
17
17
  if (seriesModel[actionInfo.method]) {
18
- seriesModel[actionInfo.method](payload.name);
18
+ seriesModel[actionInfo.method](
19
+ payload.name,
20
+ payload.dataIndex
21
+ );
19
22
  }
20
23
  var data = seriesModel.getData();
21
24
  // Create selected map
22
25
  data.each(function (idx) {
23
26
  var name = data.getName(idx);
24
- selected[name] = seriesModel.isSelected(name) || false;
27
+ selected[name] = seriesModel.isSelected(name)
28
+ || false;
25
29
  });
26
30
  }
27
31
  );
@@ -181,7 +181,7 @@ define(function (require) {
181
181
 
182
182
  function removeRect(dataIndex, animationModel, el) {
183
183
  // Not show text when animating
184
- el.style.text = '';
184
+ el.style.text = null;
185
185
  graphic.updateProps(el, {
186
186
  shape: {
187
187
  width: 0
@@ -193,7 +193,7 @@ define(function (require) {
193
193
 
194
194
  function removeSector(dataIndex, animationModel, el) {
195
195
  // Not show text when animating
196
- el.style.text = '';
196
+ el.style.text = null;
197
197
  graphic.updateProps(el, {
198
198
  shape: {
199
199
  r: el.shape.r0
@@ -240,7 +240,7 @@ define(function (require) {
240
240
  var itemStyleModel = itemModel.getModel('itemStyle.normal');
241
241
  var hoverStyle = itemModel.getModel('itemStyle.emphasis').getBarItemStyle();
242
242
 
243
- if (!isPolar && isHorizontal) {
243
+ if (!isPolar) {
244
244
  el.setShape('r', itemStyleModel.get('barBorderRadius') || 0);
245
245
  }
246
246
 
@@ -252,6 +252,9 @@ define(function (require) {
252
252
  itemStyleModel.getBarItemStyle()
253
253
  ));
254
254
 
255
+ var cursorStyle = itemModel.getShallow('cursor');
256
+ cursorStyle && el.attr('cursor', cursorStyle);
257
+
255
258
  var labelPositionOutside = isHorizontal
256
259
  ? (layout.height > 0 ? 'bottom' : 'top')
257
260
  : (layout.width > 0 ? 'left' : 'right');
@@ -43,6 +43,7 @@ define(function(require) {
43
43
  barMinHeight: 0,
44
44
  // 最小角度为0,仅对极坐标系下的柱状图有效
45
45
  barMinAngle: 0,
46
+ // cursor: null,
46
47
 
47
48
  // barMaxWidth: null,
48
49
  // 默认自适应
@@ -57,10 +58,10 @@ define(function(require) {
57
58
  // }
58
59
  // },
59
60
  itemStyle: {
60
- normal: {
61
+ // normal: {
61
62
  // color: '各异'
62
- },
63
- emphasis: {}
63
+ // },
64
+ // emphasis: {}
64
65
  }
65
66
  }
66
67
  });
@@ -22,7 +22,7 @@ define(function(require) {
22
22
  symbolRepeatDirection: 'end', // 'end' means from 'start' to 'end'.
23
23
 
24
24
  symbolClip: false,
25
- symbolBoundingData: null,
25
+ symbolBoundingData: null, // Can be 60 or -40 or [-40, 60]
26
26
  symbolPatternSize: 400, // 400 * 400 px
27
27
 
28
28
  barGap: '-100%', // In most case, overlap is needed.
@@ -183,12 +183,28 @@ define(function (require) {
183
183
  var symbolBoundingData = itemModel.get('symbolBoundingData');
184
184
  var valueAxis = opt.coordSys.getOtherAxis(opt.coordSys.getBaseAxis());
185
185
  var zeroPx = valueAxis.toGlobalCoord(valueAxis.dataToCoord(0));
186
+ var pxSignIdx = 1 - +(layout[valueDim.wh] <= 0);
187
+ var boundingLength;
186
188
 
187
- var boundingLength = output.boundingLength = symbolBoundingData != null
188
- ? valueAxis.toGlobalCoord(valueAxis.dataToCoord(valueAxis.scale.parse(symbolBoundingData))) - zeroPx
189
- : symbolRepeat
190
- ? opt.coordSysExtent[valueDim.index][1 - +(layout[valueDim.wh] <= 0)] - zeroPx
191
- : layout[valueDim.wh];
189
+ if (zrUtil.isArray(symbolBoundingData)) {
190
+ var symbolBoundingExtent = [
191
+ convertToCoordOnAxis(valueAxis, symbolBoundingData[0]) - zeroPx,
192
+ convertToCoordOnAxis(valueAxis, symbolBoundingData[1]) - zeroPx
193
+ ];
194
+ symbolBoundingExtent[1] < symbolBoundingExtent[0] && (symbolBoundingExtent.reverse());
195
+ boundingLength = symbolBoundingExtent[pxSignIdx];
196
+ }
197
+ else if (symbolBoundingData != null) {
198
+ boundingLength = convertToCoordOnAxis(valueAxis, symbolBoundingData) - zeroPx;
199
+ }
200
+ else if (symbolRepeat) {
201
+ boundingLength = opt.coordSysExtent[valueDim.index][pxSignIdx] - zeroPx;
202
+ }
203
+ else {
204
+ boundingLength = layout[valueDim.wh];
205
+ }
206
+
207
+ output.boundingLength = boundingLength;
192
208
 
193
209
  if (symbolRepeat) {
194
210
  output.repeatCutLength = layout[valueDim.wh];
@@ -197,6 +213,10 @@ define(function (require) {
197
213
  output.pxSign = boundingLength > 0 ? 1 : boundingLength < 0 ? -1 : 0;
198
214
  }
199
215
 
216
+ function convertToCoordOnAxis(axis, value) {
217
+ return axis.toGlobalCoord(axis.dataToCoord(axis.scale.parse(value)));
218
+ }
219
+
200
220
  // Support ['100%', '100%']
201
221
  function prepareSymbolSize(
202
222
  data, dataIndex, layout, symbolRepeat, symbolClip, boundingLength,
@@ -405,7 +425,7 @@ define(function (require) {
405
425
  path.__pictorialRepeatTimes = repeatTimes;
406
426
  bundle.add(path);
407
427
 
408
- var target = makeTarget(index, true);
428
+ var target = makeTarget(index);
409
429
 
410
430
  updateAttr(
411
431
  path,
@@ -654,7 +674,7 @@ define(function (require) {
654
674
  function removeBar(data, dataIndex, animationModel, bar) {
655
675
  // Not show text when animating
656
676
  var labelRect = bar.__pictorialBarRect;
657
- labelRect && (labelRect.style.text = '');
677
+ labelRect && (labelRect.style.text = null);
658
678
 
659
679
  var pathes = [];
660
680
  eachPath(bar, function (path) {
@@ -713,6 +733,7 @@ define(function (require) {
713
733
  // Because symbol provide setColor individually to set fill and stroke
714
734
  var normalStyle = itemModel.getModel('itemStyle.normal').getItemStyle(['color']);
715
735
  var hoverStyle = itemModel.getModel('itemStyle.emphasis').getItemStyle();
736
+ var cursorStyle = itemModel.getShallow('cursor');
716
737
 
717
738
  eachPath(bar, function (path) {
718
739
  // PENDING setColor should be before setStyle!!!
@@ -726,6 +747,7 @@ define(function (require) {
726
747
  ));
727
748
  graphic.setHoverStyle(path, hoverStyle);
728
749
 
750
+ cursorStyle && (path.cursor = cursorStyle);
729
751
  path.z2 = symbolMeta.z2;
730
752
  });
731
753
 
@@ -1,6 +1,5 @@
1
1
  define(function (require) {
2
2
 
3
- var zrUtil = require('zrender/core/util');
4
3
  var graphic = require('../../util/graphic');
5
4
 
6
5
  var helper = {};
@@ -11,38 +10,22 @@ define(function (require) {
11
10
  var labelModel = itemModel.getModel('label.normal');
12
11
  var hoverLabelModel = itemModel.getModel('label.emphasis');
13
12
 
14
- if (labelModel.get('show')) {
15
- setLabel(
16
- normalStyle, labelModel, color,
17
- zrUtil.retrieve(
18
- seriesModel.getFormattedLabel(dataIndex, 'normal'),
19
- seriesModel.getRawValue(dataIndex)
20
- ),
21
- labelPositionOutside
22
- );
23
- }
24
- else {
25
- normalStyle.text = '';
26
- }
13
+ graphic.setLabelStyle(
14
+ normalStyle, hoverStyle, labelModel, hoverLabelModel,
15
+ {
16
+ labelFetcher: seriesModel,
17
+ labelDataIndex: dataIndex,
18
+ defaultText: seriesModel.getRawValue(dataIndex),
19
+ isRectText: true,
20
+ autoColor: color
21
+ }
22
+ );
27
23
 
28
- if (hoverLabelModel.get('show')) {
29
- setLabel(
30
- hoverStyle, hoverLabelModel, color,
31
- zrUtil.retrieve(
32
- seriesModel.getFormattedLabel(dataIndex, 'emphasis'),
33
- seriesModel.getRawValue(dataIndex)
34
- ),
35
- labelPositionOutside
36
- );
37
- }
38
- else {
39
- hoverStyle.text = '';
40
- }
24
+ fixPosition(normalStyle);
25
+ fixPosition(hoverStyle);
41
26
  };
42
27
 
43
- function setLabel(style, model, color, labelText, labelPositionOutside) {
44
- graphic.setText(style, model, color);
45
- style.text = labelText;
28
+ function fixPosition(style, labelPositionOutside) {
46
29
  if (style.textPosition === 'outside') {
47
30
  style.textPosition = labelPositionOutside;
48
31
  }
@@ -3,6 +3,7 @@ define(function (require) {
3
3
  var zrUtil = require('zrender/core/util');
4
4
  var retrieve = require('zrender/core/util').retrieve;
5
5
  var parsePercent = require('../../util/number').parsePercent;
6
+ var graphic = require('../../util/graphic');
6
7
 
7
8
  return function (ecModel) {
8
9
 
@@ -33,6 +34,8 @@ define(function (require) {
33
34
  return;
34
35
  }
35
36
 
37
+ var dataIndex = 0;
38
+
36
39
  data.each([cDim].concat(vDims), function () {
37
40
  var args = arguments;
38
41
  var axisDimVal = args[0];
@@ -52,17 +55,44 @@ define(function (require) {
52
55
  var highestPoint = getPoint(highestVal);
53
56
 
54
57
  var whiskerEnds = [
55
- [highestPoint, ocHighPoint],
56
- [lowestPoint, ocLowPoint]
58
+ [
59
+ subPixelOptimizePoint(highestPoint),
60
+ subPixelOptimizePoint(ocHighPoint)
61
+ ],
62
+ [
63
+ subPixelOptimizePoint(lowestPoint),
64
+ subPixelOptimizePoint(ocLowPoint)
65
+ ]
57
66
  ];
58
67
 
59
68
  var bodyEnds = [];
60
69
  addBodyEnd(ocHighPoint, 0);
61
70
  addBodyEnd(ocLowPoint, 1);
62
71
 
72
+ var sign;
73
+ if (openVal > closeVal) {
74
+ sign = -1;
75
+ }
76
+ else if (openVal < closeVal) {
77
+ sign = 1;
78
+ }
79
+ else {
80
+ // If close === open, compare with close of last record
81
+ if (dataIndex > 0) {
82
+ sign = data.getItemModel(dataIndex - 1).get()[2]
83
+ <= closeVal
84
+ ? 1
85
+ : -1;
86
+ }
87
+ else {
88
+ // No record of previous, set to be positive
89
+ sign = 1;
90
+ }
91
+ }
92
+
63
93
  data.setItemLayout(idx, {
64
94
  chartLayout: chartLayout,
65
- sign: openVal > closeVal ? -1 : openVal < closeVal ? 1 : 0,
95
+ sign: sign,
66
96
  initBaseline: openVal > closeVal
67
97
  ? ocHighPoint[constDim] : ocLowPoint[constDim], // open point.
68
98
  bodyEnds: bodyEnds,
@@ -70,6 +100,8 @@ define(function (require) {
70
100
  brushRect: makeBrushRect()
71
101
  });
72
102
 
103
+ ++dataIndex;
104
+
73
105
  function getPoint(val) {
74
106
  var p = [];
75
107
  p[variableDim] = axisDimVal;
@@ -82,8 +114,14 @@ define(function (require) {
82
114
  function addBodyEnd(point, start) {
83
115
  var point1 = point.slice();
84
116
  var point2 = point.slice();
85
- point1[variableDim] += candleWidth / 2;
86
- point2[variableDim] -= candleWidth / 2;
117
+
118
+ point1[variableDim] = graphic.subPixelOptimize(
119
+ point1[variableDim] + candleWidth / 2, 1, false
120
+ );
121
+ point2[variableDim] = graphic.subPixelOptimize(
122
+ point2[variableDim] - candleWidth / 2, 1, true
123
+ );
124
+
87
125
  start
88
126
  ? bodyEnds.push(point1, point2)
89
127
  : bodyEnds.push(point2, point1);
@@ -104,6 +142,11 @@ define(function (require) {
104
142
  };
105
143
  }
106
144
 
145
+ function subPixelOptimizePoint(point) {
146
+ point[variableDim] = graphic.subPixelOptimize(point[variableDim], 1);
147
+ return point;
148
+ }
149
+
107
150
  }, true);
108
151
  });
109
152
  };
@@ -132,6 +175,6 @@ define(function (require) {
132
175
  ? parsePercent(barWidth, bandWidth)
133
176
  // Put max outer to ensure bar visible in spite of overlap.
134
177
  : Math.max(Math.min(bandWidth / 2, barMaxWidth), barMinWidth);
135
- }
178
+ }
136
179
 
137
180
  });