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