echarts 3.5.1 → 3.6.0

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 (261) hide show
  1. package/LICENSE +21 -18
  2. package/README.md +10 -0
  3. package/dist/echarts.common.js +11010 -9830
  4. package/dist/echarts.common.min.js +13 -13
  5. package/dist/echarts.js +13291 -10852
  6. package/dist/echarts.min.js +22 -21
  7. package/dist/echarts.simple.js +9904 -8990
  8. package/dist/echarts.simple.min.js +9 -10
  9. package/index.js +1 -0
  10. package/lib/ExtensionAPI.js +2 -4
  11. package/lib/chart/bar/BarView.js +141 -49
  12. package/lib/chart/bar/BaseBarSeries.js +2 -6
  13. package/lib/chart/bar.js +1 -0
  14. package/lib/chart/boxplot/BoxplotSeries.js +1 -1
  15. package/lib/chart/boxplot/boxplotLayout.js +23 -7
  16. package/lib/chart/candlestick/CandlestickSeries.js +3 -22
  17. package/lib/chart/candlestick/candlestickLayout.js +23 -7
  18. package/lib/chart/custom.js +442 -0
  19. package/lib/chart/funnel/funnelLayout.js +10 -3
  20. package/lib/chart/gauge/GaugeView.js +1 -1
  21. package/lib/chart/graph/GraphView.js +15 -9
  22. package/lib/chart/graph/categoryVisual.js +3 -2
  23. package/lib/chart/heatmap/HeatmapLayer.js +1 -1
  24. package/lib/chart/heatmap/HeatmapView.js +75 -73
  25. package/lib/chart/helper/Symbol.js +8 -31
  26. package/lib/chart/helper/createListFromArray.js +15 -10
  27. package/lib/chart/helper/labelHelper.js +48 -0
  28. package/lib/chart/helper/whiskerBoxCommon.js +25 -44
  29. package/lib/chart/map/mapDataStatistic.js +9 -8
  30. package/lib/chart/parallel/ParallelSeries.js +2 -0
  31. package/lib/chart/parallel/ParallelView.js +13 -12
  32. package/lib/chart/parallel/parallelVisual.js +9 -1
  33. package/lib/chart/pie/pieLayout.js +25 -17
  34. package/lib/chart/radar/RadarSeries.js +1 -1
  35. package/lib/chart/sankey/sankeyLayout.js +1 -1
  36. package/lib/chart/scatter/ScatterSeries.js +2 -3
  37. package/lib/chart/themeRiver/ThemeRiverSeries.js +6 -5
  38. package/lib/chart/themeRiver/themeRiverVisual.js +1 -1
  39. package/lib/chart/treemap/TreemapSeries.js +3 -3
  40. package/lib/chart/treemap/TreemapView.js +1 -1
  41. package/lib/chart/treemap/treemapLayout.js +6 -1
  42. package/lib/component/axis/AxisBuilder.js +53 -34
  43. package/lib/component/axis/ParallelAxisView.js +45 -37
  44. package/lib/component/axisPointer/AxisPointerModel.js +1 -1
  45. package/lib/component/axisPointer/BaseAxisPointer.js +20 -15
  46. package/lib/component/axisPointer/CartesianAxisPointer.js +9 -6
  47. package/lib/component/axisPointer/PolarAxisPointer.js +10 -8
  48. package/lib/component/axisPointer/SingleAxisPointer.js +11 -7
  49. package/lib/component/axisPointer/axisTrigger.js +87 -72
  50. package/lib/component/axisPointer/viewHelper.js +6 -3
  51. package/lib/component/axisPointer.js +2 -2
  52. package/lib/component/brush/BrushModel.js +6 -4
  53. package/lib/component/brush/BrushView.js +1 -1
  54. package/lib/component/brush/visualEncoding.js +6 -4
  55. package/lib/component/calendar/CalendarView.js +5 -5
  56. package/lib/component/dataZoom/AxisProxy.js +76 -13
  57. package/lib/component/dataZoom/DataZoomModel.js +21 -5
  58. package/lib/component/dataZoom/InsideZoomModel.js +4 -1
  59. package/lib/component/dataZoom/InsideZoomView.js +17 -27
  60. package/lib/component/dataZoom/SliderZoomView.js +63 -26
  61. package/lib/component/dataZoom/roams.js +9 -4
  62. package/lib/component/graphic.js +13 -12
  63. package/lib/component/helper/BrushController.js +75 -114
  64. package/lib/component/helper/BrushTargetManager.js +16 -8
  65. package/lib/component/helper/MapDraw.js +25 -11
  66. package/lib/component/helper/RoamController.js +111 -139
  67. package/lib/component/helper/brushHelper.js +25 -213
  68. package/lib/component/helper/cursorHelper.js +21 -0
  69. package/lib/component/helper/roamHelper.js +54 -0
  70. package/lib/component/helper/selectableMixin.js +7 -7
  71. package/lib/component/helper/sliderMove.js +66 -37
  72. package/lib/component/legend/LegendView.js +6 -6
  73. package/lib/component/legend/legendAction.js +1 -1
  74. package/lib/component/marker/MarkAreaView.js +3 -6
  75. package/lib/component/marker/MarkLineView.js +3 -5
  76. package/lib/component/marker/MarkPointView.js +3 -5
  77. package/lib/component/marker/MarkerView.js +10 -12
  78. package/lib/component/marker/markerHelper.js +1 -1
  79. package/lib/component/parallel.js +94 -29
  80. package/lib/component/polar.js +5 -0
  81. package/lib/component/timeline/SliderTimelineView.js +1 -1
  82. package/lib/component/toolbox/feature/Brush.js +7 -0
  83. package/lib/component/toolbox/feature/DataZoom.js +17 -4
  84. package/lib/component/tooltip/TooltipView.js +92 -20
  85. package/lib/component/visualMap/ContinuousView.js +6 -4
  86. package/lib/coord/Axis.js +34 -2
  87. package/lib/coord/axisDefault.js +4 -1
  88. package/lib/coord/axisHelper.js +32 -26
  89. package/lib/coord/axisModelCommonMixin.js +1 -1
  90. package/lib/coord/calendar/Calendar.js +14 -17
  91. package/lib/coord/calendar/prepareCustom.js +31 -0
  92. package/lib/coord/cartesian/Axis2D.js +0 -12
  93. package/lib/coord/cartesian/Cartesian2D.js +1 -0
  94. package/lib/coord/cartesian/Grid.js +5 -2
  95. package/lib/coord/cartesian/prepareCustom.js +36 -0
  96. package/lib/coord/geo/Geo.js +9 -14
  97. package/lib/coord/geo/GeoModel.js +5 -5
  98. package/lib/coord/geo/geoCreator.js +3 -3
  99. package/lib/coord/geo/parseGeoJson.js +11 -4
  100. package/lib/coord/geo/prepareCustom.js +36 -0
  101. package/lib/coord/parallel/Parallel.js +225 -101
  102. package/lib/coord/parallel/ParallelModel.js +7 -1
  103. package/lib/coord/polar/Polar.js +2 -1
  104. package/lib/coord/polar/prepareCustom.js +53 -0
  105. package/lib/coord/single/Single.js +9 -8
  106. package/lib/coord/single/SingleAxis.js +0 -27
  107. package/lib/coord/single/prepareCustom.js +33 -0
  108. package/lib/data/DataDiffer.js +2 -1
  109. package/lib/data/Graph.js +11 -7
  110. package/lib/data/List.js +59 -20
  111. package/lib/data/helper/completeDimensions.js +184 -23
  112. package/lib/echarts.js +68 -36
  113. package/lib/helper.js +1 -8
  114. package/lib/layout/barGrid.js +91 -19
  115. package/lib/layout/barPolar.js +286 -0
  116. package/lib/layout/points.js +22 -16
  117. package/lib/model/Global.js +34 -31
  118. package/lib/model/Series.js +41 -29
  119. package/lib/model/globalDefault.js +4 -1
  120. package/lib/model/mixin/colorPalette.js +2 -1
  121. package/lib/model/mixin/textStyle.js +7 -13
  122. package/lib/scale/Interval.js +46 -76
  123. package/lib/scale/Log.js +5 -7
  124. package/lib/scale/Scale.js +10 -1
  125. package/lib/scale/Time.js +34 -12
  126. package/lib/scale/helper.js +93 -0
  127. package/lib/util/format.js +20 -9
  128. package/lib/util/graphic.js +70 -8
  129. package/lib/util/layout.js +7 -3
  130. package/lib/util/model.js +63 -7
  131. package/lib/util/number.js +59 -19
  132. package/lib/util/throttle.js +14 -3
  133. package/map/js/world.js +1 -1
  134. package/map/json/world.json +1 -1
  135. package/package.json +3 -3
  136. package/src/ExtensionAPI.js +2 -4
  137. package/src/chart/bar/BarView.js +141 -49
  138. package/src/chart/bar/BaseBarSeries.js +2 -6
  139. package/src/chart/bar.js +1 -0
  140. package/src/chart/boxplot/BoxplotSeries.js +1 -1
  141. package/src/chart/boxplot/boxplotLayout.js +23 -7
  142. package/src/chart/candlestick/CandlestickSeries.js +3 -22
  143. package/src/chart/candlestick/candlestickLayout.js +23 -7
  144. package/src/chart/custom.js +442 -0
  145. package/src/chart/funnel/funnelLayout.js +10 -4
  146. package/src/chart/gauge/GaugeView.js +1 -1
  147. package/src/chart/graph/GraphView.js +15 -9
  148. package/src/chart/graph/categoryVisual.js +3 -2
  149. package/src/chart/heatmap/HeatmapLayer.js +1 -1
  150. package/src/chart/heatmap/HeatmapView.js +75 -73
  151. package/src/chart/helper/Symbol.js +8 -31
  152. package/src/chart/helper/createListFromArray.js +15 -10
  153. package/src/chart/helper/labelHelper.js +49 -0
  154. package/src/chart/helper/whiskerBoxCommon.js +25 -44
  155. package/src/chart/map/mapDataStatistic.js +9 -8
  156. package/src/chart/parallel/ParallelSeries.js +2 -0
  157. package/src/chart/parallel/ParallelView.js +13 -12
  158. package/src/chart/parallel/parallelVisual.js +9 -1
  159. package/src/chart/pie/pieLayout.js +25 -17
  160. package/src/chart/radar/RadarSeries.js +1 -1
  161. package/src/chart/sankey/sankeyLayout.js +1 -1
  162. package/src/chart/scatter/ScatterSeries.js +2 -3
  163. package/src/chart/themeRiver/ThemeRiverSeries.js +6 -5
  164. package/src/chart/themeRiver/themeRiverVisual.js +1 -1
  165. package/src/chart/treemap/TreemapSeries.js +3 -3
  166. package/src/chart/treemap/TreemapView.js +1 -1
  167. package/src/chart/treemap/treemapLayout.js +6 -1
  168. package/src/component/axis/AxisBuilder.js +53 -34
  169. package/src/component/axis/ParallelAxisView.js +45 -37
  170. package/src/component/axisPointer/AxisPointerModel.js +1 -1
  171. package/src/component/axisPointer/BaseAxisPointer.js +20 -15
  172. package/src/component/axisPointer/CartesianAxisPointer.js +9 -6
  173. package/src/component/axisPointer/PolarAxisPointer.js +10 -8
  174. package/src/component/axisPointer/SingleAxisPointer.js +11 -7
  175. package/src/component/axisPointer/axisTrigger.js +87 -72
  176. package/src/component/axisPointer/viewHelper.js +6 -3
  177. package/src/component/axisPointer.js +2 -2
  178. package/src/component/brush/BrushModel.js +6 -4
  179. package/src/component/brush/BrushView.js +1 -1
  180. package/src/component/brush/visualEncoding.js +6 -4
  181. package/src/component/calendar/CalendarView.js +5 -5
  182. package/src/component/dataZoom/AxisProxy.js +76 -13
  183. package/src/component/dataZoom/DataZoomModel.js +21 -5
  184. package/src/component/dataZoom/InsideZoomModel.js +4 -1
  185. package/src/component/dataZoom/InsideZoomView.js +17 -27
  186. package/src/component/dataZoom/SliderZoomView.js +63 -26
  187. package/src/component/dataZoom/roams.js +9 -4
  188. package/src/component/graphic.js +13 -12
  189. package/src/component/helper/BrushController.js +75 -114
  190. package/src/component/helper/BrushTargetManager.js +16 -8
  191. package/src/component/helper/MapDraw.js +25 -11
  192. package/src/component/helper/RoamController.js +111 -139
  193. package/src/component/helper/brushHelper.js +41 -0
  194. package/src/component/helper/cursorHelper.js +22 -0
  195. package/src/component/helper/roamHelper.js +55 -0
  196. package/src/component/helper/selectableMixin.js +7 -7
  197. package/src/component/helper/sliderMove.js +66 -37
  198. package/src/component/legend/LegendView.js +6 -6
  199. package/src/component/legend/legendAction.js +1 -1
  200. package/src/component/marker/MarkAreaView.js +3 -6
  201. package/src/component/marker/MarkLineView.js +3 -5
  202. package/src/component/marker/MarkPointView.js +3 -5
  203. package/src/component/marker/MarkerView.js +10 -12
  204. package/src/component/marker/markerHelper.js +1 -1
  205. package/src/component/parallel.js +94 -29
  206. package/src/component/polar.js +5 -0
  207. package/src/component/timeline/SliderTimelineView.js +1 -1
  208. package/src/component/toolbox/feature/Brush.js +7 -0
  209. package/src/component/toolbox/feature/DataZoom.js +17 -4
  210. package/src/component/tooltip/TooltipView.js +92 -20
  211. package/src/component/visualMap/ContinuousView.js +6 -4
  212. package/src/coord/Axis.js +34 -2
  213. package/src/coord/axisDefault.js +4 -1
  214. package/src/coord/axisHelper.js +32 -26
  215. package/src/coord/axisModelCommonMixin.js +1 -1
  216. package/src/coord/calendar/Calendar.js +14 -17
  217. package/src/coord/calendar/prepareCustom.js +32 -0
  218. package/src/coord/cartesian/Axis2D.js +0 -12
  219. package/src/coord/cartesian/Cartesian2D.js +1 -0
  220. package/src/coord/cartesian/Grid.js +5 -2
  221. package/src/coord/cartesian/prepareCustom.js +37 -0
  222. package/src/coord/geo/Geo.js +9 -14
  223. package/src/coord/geo/GeoModel.js +5 -5
  224. package/src/coord/geo/geoCreator.js +3 -3
  225. package/src/coord/geo/parseGeoJson.js +11 -4
  226. package/src/coord/geo/prepareCustom.js +37 -0
  227. package/src/coord/parallel/Parallel.js +225 -101
  228. package/src/coord/parallel/ParallelModel.js +7 -1
  229. package/src/coord/polar/Polar.js +2 -1
  230. package/src/coord/polar/prepareCustom.js +54 -0
  231. package/src/coord/single/Single.js +9 -8
  232. package/src/coord/single/SingleAxis.js +0 -27
  233. package/src/coord/single/prepareCustom.js +34 -0
  234. package/src/data/DataDiffer.js +2 -1
  235. package/src/data/Graph.js +11 -7
  236. package/src/data/List.js +59 -20
  237. package/src/data/helper/completeDimensions.js +184 -23
  238. package/src/echarts.js +68 -36
  239. package/src/helper.js +1 -8
  240. package/src/layout/barGrid.js +91 -19
  241. package/src/layout/barPolar.js +287 -0
  242. package/src/layout/points.js +22 -16
  243. package/src/model/Global.js +34 -31
  244. package/src/model/Series.js +41 -29
  245. package/src/model/globalDefault.js +4 -1
  246. package/src/model/mixin/colorPalette.js +2 -1
  247. package/src/model/mixin/textStyle.js +7 -13
  248. package/src/scale/Interval.js +46 -76
  249. package/src/scale/Log.js +5 -7
  250. package/src/scale/Scale.js +10 -1
  251. package/src/scale/Time.js +34 -12
  252. package/src/scale/helper.js +94 -0
  253. package/src/util/format.js +20 -9
  254. package/src/util/graphic.js +70 -8
  255. package/src/util/layout.js +7 -3
  256. package/src/util/model.js +63 -7
  257. package/src/util/number.js +59 -19
  258. package/src/util/throttle.js +14 -3
  259. package/src/coord/cartesian/axisLabelInterval.js +0 -26
  260. package/theme/default.js +0 -23
  261. package/theme/halloween.js +0 -528
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echarts",
3
- "version": "3.5.1",
3
+ "version": "3.6.0",
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.4.1"
38
+ "zrender": "^3.5.0"
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.4.1"
48
+ "zrender": "^3.5.0"
49
49
  }
50
50
  }
@@ -9,14 +9,12 @@ define(function(require) {
9
9
  'on', 'off', 'getDataURL', 'getConnectedDataURL', 'getModel', 'getOption',
10
10
  'getViewOfComponentModel', 'getViewOfSeriesModel'
11
11
  ];
12
+ // And `getCoordinateSystems` and `getComponentByElement` will be injected in echarts.js
12
13
 
13
- function ExtensionAPI(chartInstance, coordSysMgr) {
14
+ function ExtensionAPI(chartInstance) {
14
15
  zrUtil.each(echartsAPIList, function (name) {
15
16
  this[name] = zrUtil.bind(chartInstance[name], chartInstance);
16
17
  }, this);
17
-
18
- // Inject getCoordinateSystems to ecModel
19
- this.getCoordinateSystems = zrUtil.bind(coordSysMgr.getCoordinateSystems, coordSysMgr);
20
18
  }
21
19
 
22
20
  return ExtensionAPI;
@@ -19,8 +19,13 @@ define(function (require) {
19
19
  render: function (seriesModel, ecModel, api) {
20
20
  var coordinateSystemType = seriesModel.get('coordinateSystem');
21
21
 
22
- if (coordinateSystemType === 'cartesian2d') {
23
- this._renderOnCartesian(seriesModel, ecModel, api);
22
+ if (coordinateSystemType === 'cartesian2d'
23
+ || coordinateSystemType === 'polar'
24
+ ) {
25
+ this._render(seriesModel, ecModel, api);
26
+ }
27
+ else if (__DEV__) {
28
+ console.warn('Only cartesian2d and polar supported for bar.');
24
29
  }
25
30
 
26
31
  return this.group;
@@ -28,14 +33,22 @@ define(function (require) {
28
33
 
29
34
  dispose: zrUtil.noop,
30
35
 
31
- _renderOnCartesian: function (seriesModel, ecModel, api) {
36
+ _render: function (seriesModel, ecModel, api) {
32
37
  var group = this.group;
33
38
  var data = seriesModel.getData();
34
39
  var oldData = this._data;
35
40
 
36
- var cartesian = seriesModel.coordinateSystem;
37
- var baseAxis = cartesian.getBaseAxis();
38
- var isHorizontal = baseAxis.isHorizontal();
41
+ var coord = seriesModel.coordinateSystem;
42
+ var baseAxis = coord.getBaseAxis();
43
+ var isHorizontalOrRadial;
44
+
45
+ if (coord.type === 'cartesian2d') {
46
+ isHorizontalOrRadial = baseAxis.isHorizontal();
47
+ }
48
+ else if (coord.type === 'polar') {
49
+ isHorizontalOrRadial = baseAxis.dim === 'angle';
50
+ }
51
+
39
52
  var animationModel = seriesModel.isAnimationEnabled() ? seriesModel : null;
40
53
 
41
54
  data.diff(oldData)
@@ -45,12 +58,17 @@ define(function (require) {
45
58
  }
46
59
 
47
60
  var itemModel = data.getItemModel(dataIndex);
48
- var layout = getRectItemLayout(data, dataIndex, itemModel);
49
- var el = createRect(data, dataIndex, itemModel, layout, isHorizontal, animationModel);
61
+ var layout = getLayout[coord.type](data, dataIndex, itemModel);
62
+ var el = elementCreator[coord.type](
63
+ data, dataIndex, itemModel, layout, isHorizontalOrRadial, animationModel
64
+ );
50
65
  data.setItemGraphicEl(dataIndex, el);
51
66
  group.add(el);
52
67
 
53
- updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal);
68
+ updateStyle(
69
+ el, data, dataIndex, itemModel, layout,
70
+ seriesModel, isHorizontalOrRadial, coord.type === 'polar'
71
+ );
54
72
  })
55
73
  .update(function (newIndex, oldIndex) {
56
74
  var el = oldData.getItemGraphicEl(oldIndex);
@@ -61,24 +79,34 @@ define(function (require) {
61
79
  }
62
80
 
63
81
  var itemModel = data.getItemModel(newIndex);
64
- var layout = getRectItemLayout(data, newIndex, itemModel);
82
+ var layout = getLayout[coord.type](data, newIndex, itemModel);
65
83
 
66
84
  if (el) {
67
85
  graphic.updateProps(el, {shape: layout}, animationModel, newIndex);
68
86
  }
69
87
  else {
70
- el = createRect(data, newIndex, itemModel, layout, isHorizontal, animationModel, true);
88
+ el = elementCreator[coord.type](
89
+ data, newIndex, itemModel, layout, isHorizontalOrRadial, animationModel, true
90
+ );
71
91
  }
72
92
 
73
93
  data.setItemGraphicEl(newIndex, el);
74
94
  // Add back
75
95
  group.add(el);
76
96
 
77
- updateStyle(el, data, newIndex, itemModel, layout, seriesModel, isHorizontal);
97
+ updateStyle(
98
+ el, data, newIndex, itemModel, layout,
99
+ seriesModel, isHorizontalOrRadial, coord.type === 'polar'
100
+ );
78
101
  })
79
102
  .remove(function (dataIndex) {
80
103
  var el = oldData.getItemGraphicEl(dataIndex);
81
- el && removeRect(dataIndex, animationModel, el);
104
+ if (coord.type === 'cartesian2d') {
105
+ el && removeRect(dataIndex, animationModel, el);
106
+ }
107
+ else {
108
+ el && removeSector(dataIndex, animationModel, el);
109
+ }
82
110
  })
83
111
  .execute();
84
112
 
@@ -91,7 +119,12 @@ define(function (require) {
91
119
  if (ecModel.get('animation')) {
92
120
  if (data) {
93
121
  data.eachItemGraphicEl(function (el) {
94
- removeRect(el.dataIndex, ecModel, el);
122
+ if (el.type === 'sector') {
123
+ removeSector(el.dataIndex, ecModel, el);
124
+ }
125
+ else {
126
+ removeRect(el.dataIndex, ecModel, el);
127
+ }
95
128
  });
96
129
  }
97
130
  }
@@ -101,23 +134,50 @@ define(function (require) {
101
134
  }
102
135
  });
103
136
 
104
- function createRect(data, dataIndex, itemModel, layout, isHorizontal, animationModel, isUpdate) {
105
- var rect = new graphic.Rect({shape: zrUtil.extend({}, layout)});
106
-
107
- // Animation
108
- if (animationModel) {
109
- var rectShape = rect.shape;
110
- var animateProperty = isHorizontal ? 'height' : 'width';
111
- var animateTarget = {};
112
- rectShape[animateProperty] = 0;
113
- animateTarget[animateProperty] = layout[animateProperty];
114
- graphic[isUpdate ? 'updateProps' : 'initProps'](rect, {
115
- shape: animateTarget
116
- }, animationModel, dataIndex);
117
- }
137
+ var elementCreator = {
138
+
139
+ cartesian2d: function (
140
+ data, dataIndex, itemModel, layout, isHorizontal,
141
+ animationModel, isUpdate
142
+ ) {
143
+ var rect = new graphic.Rect({shape: zrUtil.extend({}, layout)});
144
+
145
+ // Animation
146
+ if (animationModel) {
147
+ var rectShape = rect.shape;
148
+ var animateProperty = isHorizontal ? 'height' : 'width';
149
+ var animateTarget = {};
150
+ rectShape[animateProperty] = 0;
151
+ animateTarget[animateProperty] = layout[animateProperty];
152
+ graphic[isUpdate ? 'updateProps' : 'initProps'](rect, {
153
+ shape: animateTarget
154
+ }, animationModel, dataIndex);
155
+ }
118
156
 
119
- return rect;
120
- }
157
+ return rect;
158
+ },
159
+
160
+ polar: function (
161
+ data, dataIndex, itemModel, layout, isRadial,
162
+ animationModel, isUpdate
163
+ ) {
164
+ var sector = new graphic.Sector({shape: zrUtil.extend({}, layout)});
165
+
166
+ // Animation
167
+ if (animationModel) {
168
+ var sectorShape = sector.shape;
169
+ var animateProperty = isRadial ? 'r' : 'endAngle';
170
+ var animateTarget = {};
171
+ sectorShape[animateProperty] = isRadial ? 0 : layout.startAngle;
172
+ animateTarget[animateProperty] = layout[animateProperty];
173
+ graphic[isUpdate ? 'updateProps' : 'initProps'](sector, {
174
+ shape: animateTarget
175
+ }, animationModel, dataIndex);
176
+ }
177
+
178
+ return sector;
179
+ }
180
+ };
121
181
 
122
182
  function removeRect(dataIndex, animationModel, el) {
123
183
  // Not show text when animating
@@ -131,28 +191,58 @@ define(function (require) {
131
191
  });
132
192
  }
133
193
 
134
- function getRectItemLayout(data, dataIndex, itemModel) {
135
- var layout = data.getItemLayout(dataIndex);
136
- var fixedLineWidth = getLineWidth(itemModel, layout);
137
-
138
- // fix layout with lineWidth
139
- var signX = layout.width > 0 ? 1 : -1;
140
- var signY = layout.height > 0 ? 1 : -1;
141
- return {
142
- x: layout.x + signX * fixedLineWidth / 2,
143
- y: layout.y + signY * fixedLineWidth / 2,
144
- width: layout.width - signX * fixedLineWidth,
145
- height: layout.height - signY * fixedLineWidth
146
- };
194
+ function removeSector(dataIndex, animationModel, el) {
195
+ // Not show text when animating
196
+ el.style.text = '';
197
+ graphic.updateProps(el, {
198
+ shape: {
199
+ r: el.shape.r0
200
+ }
201
+ }, animationModel, dataIndex, function () {
202
+ el.parent && el.parent.remove(el);
203
+ });
147
204
  }
148
205
 
149
- function updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal) {
206
+ var getLayout = {
207
+ cartesian2d: function (data, dataIndex, itemModel) {
208
+ var layout = data.getItemLayout(dataIndex);
209
+ var fixedLineWidth = getLineWidth(itemModel, layout);
210
+
211
+ // fix layout with lineWidth
212
+ var signX = layout.width > 0 ? 1 : -1;
213
+ var signY = layout.height > 0 ? 1 : -1;
214
+ return {
215
+ x: layout.x + signX * fixedLineWidth / 2,
216
+ y: layout.y + signY * fixedLineWidth / 2,
217
+ width: layout.width - signX * fixedLineWidth,
218
+ height: layout.height - signY * fixedLineWidth
219
+ };
220
+ },
221
+
222
+ polar: function (data, dataIndex, itemModel) {
223
+ var layout = data.getItemLayout(dataIndex);
224
+ return {
225
+ cx: layout.cx,
226
+ cy: layout.cy,
227
+ r0: layout.r0,
228
+ r: layout.r,
229
+ startAngle: layout.startAngle,
230
+ endAngle: layout.endAngle
231
+ };
232
+ }
233
+ };
234
+
235
+ function updateStyle(
236
+ el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal, isPolar
237
+ ) {
150
238
  var color = data.getItemVisual(dataIndex, 'color');
151
239
  var opacity = data.getItemVisual(dataIndex, 'opacity');
152
240
  var itemStyleModel = itemModel.getModel('itemStyle.normal');
153
241
  var hoverStyle = itemModel.getModel('itemStyle.emphasis').getBarItemStyle();
154
242
 
155
- el.setShape('r', itemStyleModel.get('barBorderRadius') || 0);
243
+ if (!isPolar && isHorizontal) {
244
+ el.setShape('r', itemStyleModel.get('barBorderRadius') || 0);
245
+ }
156
246
 
157
247
  el.useStyle(zrUtil.defaults(
158
248
  {
@@ -166,10 +256,12 @@ define(function (require) {
166
256
  ? (layout.height > 0 ? 'bottom' : 'top')
167
257
  : (layout.width > 0 ? 'left' : 'right');
168
258
 
169
- helper.setLabel(
170
- el.style, hoverStyle, itemModel, color,
171
- seriesModel, dataIndex, labelPositionOutside
172
- );
259
+ if (!isPolar) {
260
+ helper.setLabel(
261
+ el.style, hoverStyle, itemModel, color,
262
+ seriesModel, dataIndex, labelPositionOutside
263
+ );
264
+ }
173
265
 
174
266
  graphic.setHoverStyle(el, hoverStyle);
175
267
  }
@@ -10,12 +10,6 @@ define(function(require) {
10
10
  type: 'series.__base_bar__',
11
11
 
12
12
  getInitialData: function (option, ecModel) {
13
- if (__DEV__) {
14
- var coordSys = option.coordinateSystem;
15
- if (coordSys !== 'cartesian2d') {
16
- throw new Error('Bar only support cartesian2d coordinateSystem');
17
- }
18
- }
19
13
  return createListFromArray(option.data, this, ecModel);
20
14
  },
21
15
 
@@ -47,6 +41,8 @@ define(function(require) {
47
41
 
48
42
  // 最小高度改为0
49
43
  barMinHeight: 0,
44
+ // 最小角度为0,仅对极坐标系下的柱状图有效
45
+ barMinAngle: 0,
50
46
 
51
47
  // barMaxWidth: null,
52
48
  // 默认自适应
package/src/chart/bar.js CHANGED
@@ -11,6 +11,7 @@ define(function (require) {
11
11
  var echarts = require('../echarts');
12
12
 
13
13
  echarts.registerLayout(zrUtil.curry(barLayoutGrid, 'bar'));
14
+
14
15
  // Visual coding for legend
15
16
  echarts.registerVisual(function (ecModel) {
16
17
  ecModel.eachSeriesByType('bar', function (seriesModel) {
@@ -21,7 +21,7 @@ define(function(require) {
21
21
  * and echarts do not need to know it.
22
22
  * @readOnly
23
23
  */
24
- valueDimensions: ['min', 'Q1', 'median', 'Q3', 'max'],
24
+ defaultValueDimensions: ['min', 'Q1', 'median', 'Q3', 'max'],
25
25
 
26
26
  /**
27
27
  * @type {Array.<string>}
@@ -109,17 +109,33 @@ define(function (require) {
109
109
  function layoutSingleSeries(seriesModel, offset, boxWidth) {
110
110
  var coordSys = seriesModel.coordinateSystem;
111
111
  var data = seriesModel.getData();
112
- var dimensions = seriesModel.dimensions;
113
- var chartLayout = seriesModel.get('layout');
114
112
  var halfWidth = boxWidth / 2;
113
+ var chartLayout = seriesModel.get('layout');
114
+ var variableDim = chartLayout === 'horizontal' ? 0 : 1;
115
+ var constDim = 1 - variableDim;
116
+ var coordDims = ['x', 'y'];
117
+ var vDims = [];
118
+ var cDim;
119
+
120
+ zrUtil.each(data.dimensions, function (dimName) {
121
+ var dimInfo = data.getDimensionInfo(dimName);
122
+ var coordDim = dimInfo.coordDim;
123
+ if (coordDim === coordDims[constDim]) {
124
+ vDims.push(dimName);
125
+ }
126
+ else if (coordDim === coordDims[variableDim]) {
127
+ cDim = dimName;
128
+ }
129
+ });
130
+
131
+ if (cDim == null || vDims.length < 5) {
132
+ return;
133
+ }
115
134
 
116
- data.each(dimensions, function () {
135
+ data.each([cDim].concat(vDims), function () {
117
136
  var args = arguments;
118
- var dimLen = dimensions.length;
119
137
  var axisDimVal = args[0];
120
- var idx = args[dimLen];
121
- var variableDim = chartLayout === 'horizontal' ? 0 : 1;
122
- var constDim = 1 - variableDim;
138
+ var idx = args[vDims.length + 1];
123
139
 
124
140
  var median = getPoint(args[3]);
125
141
  var end1 = getPoint(args[1]);
@@ -5,9 +5,6 @@ define(function(require) {
5
5
  var zrUtil = require('zrender/core/util');
6
6
  var SeriesModel = require('../../model/Series');
7
7
  var whiskerBoxCommon = require('../helper/whiskerBoxCommon');
8
- var formatUtil = require('../../util/format');
9
- var encodeHTML = formatUtil.encodeHTML;
10
- var addCommas = formatUtil.addCommas;
11
8
 
12
9
  var CandlestickSeries = SeriesModel.extend({
13
10
 
@@ -18,7 +15,7 @@ define(function(require) {
18
15
  /**
19
16
  * @readOnly
20
17
  */
21
- valueDimensions: ['open', 'close', 'lowest', 'highest'],
18
+ defaultValueDimensions: ['open', 'close', 'lowest', 'highest'],
22
19
 
23
20
  /**
24
21
  * @type {Array.<string>}
@@ -74,24 +71,8 @@ define(function(require) {
74
71
  return 'open';
75
72
  },
76
73
 
77
- /**
78
- * @override
79
- */
80
- formatTooltip: function (dataIndex, mutipleSeries) {
81
- // It rearly use mutiple candlestick series in one cartesian,
82
- // so only consider one series in this default tooltip.
83
- var valueHTML = zrUtil.map(this.valueDimensions, function (dim) {
84
- return encodeHTML(dim + ': ' + addCommas(this.getData().get(dim, dataIndex)));
85
- }, this).join('<br />');
86
-
87
- var html = [];
88
- this.name != null && html.push(encodeHTML(this.name));
89
- valueHTML != null && html.push(valueHTML);
90
-
91
- return html.join('<br />');
92
- },
93
-
94
- brushSelector: function (itemLayout, selectors) {
74
+ brushSelector: function (dataIndex, data, selectors) {
75
+ var itemLayout = data.getItemLayout(dataIndex);
95
76
  return selectors.rect(itemLayout.brushRect);
96
77
  }
97
78
 
@@ -1,5 +1,6 @@
1
1
  define(function (require) {
2
2
 
3
+ var zrUtil = require('zrender/core/util');
3
4
  var retrieve = require('zrender/core/util').retrieve;
4
5
  var parsePercent = require('../../util/number').parsePercent;
5
6
 
@@ -9,18 +10,33 @@ define(function (require) {
9
10
 
10
11
  var coordSys = seriesModel.coordinateSystem;
11
12
  var data = seriesModel.getData();
12
- var dimensions = seriesModel.dimensions;
13
+ var candleWidth = calculateCandleWidth(seriesModel, data);
13
14
  var chartLayout = seriesModel.get('layout');
15
+ var variableDim = chartLayout === 'horizontal' ? 0 : 1;
16
+ var constDim = 1 - variableDim;
17
+ var coordDims = ['x', 'y'];
18
+ var vDims = [];
19
+ var cDim;
20
+
21
+ zrUtil.each(data.dimensions, function (dimName) {
22
+ var dimInfo = data.getDimensionInfo(dimName);
23
+ var coordDim = dimInfo.coordDim;
24
+ if (coordDim === coordDims[constDim]) {
25
+ vDims.push(dimName);
26
+ }
27
+ else if (coordDim === coordDims[variableDim]) {
28
+ cDim = dimName;
29
+ }
30
+ });
14
31
 
15
- var candleWidth = calculateCandleWidth(seriesModel, data);
32
+ if (cDim == null || vDims.length < 4) {
33
+ return;
34
+ }
16
35
 
17
- data.each(dimensions, function () {
36
+ data.each([cDim].concat(vDims), function () {
18
37
  var args = arguments;
19
- var dimLen = dimensions.length;
20
38
  var axisDimVal = args[0];
21
- var idx = args[dimLen];
22
- var variableDim = chartLayout === 'horizontal' ? 0 : 1;
23
- var constDim = 1 - variableDim;
39
+ var idx = args[vDims.length + 1];
24
40
 
25
41
  var openVal = args[1];
26
42
  var closeVal = args[2];