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
@@ -17,20 +17,26 @@ define(function(require) {
17
17
  * @param {string} [currTrigger] 'click' | 'mousemove' | 'leave'
18
18
  * @param {Array.<number>} [point] x and y, which are mandatory, specify a point to
19
19
  * tigger axisPointer and tooltip.
20
- * @param {Object} [finder] {xAxisId: ...[], yAxisName: ...[], angleAxisIndex: ...[]}
20
+ * @param {Object} [finder] {
21
+ * seriesIndex, dataIndex,
22
+ * axesInfo: [{
23
+ * axisDim: 'x'|'y'|'angle'|..., axisIndex: ..., value: ...
24
+ * }, ...]
25
+ * }
21
26
  * These properties, which are optional, restrict target axes.
22
27
  * @param {Function} dispatchAction
23
28
  * @param {module:echarts/ExtensionAPI} api
24
29
  * @param {Object} [tooltipOption]
25
- * @param {string} [highDownKey]
26
30
  * @return {Object} content of event obj for echarts.connect.
27
31
  */
28
32
  function axisTrigger(
29
33
  coordSysAxesInfo, currTrigger, point, finder, dispatchAction,
30
- ecModel, api, tooltipOption, highDownKey
34
+ ecModel, api, tooltipOption
31
35
  ) {
32
36
  finder = finder || {};
33
- if (!point || point[0] == null || point[1] == null) {
37
+ if (illegalPoint(point)) {
38
+ // Used in the default behavior of `connection`: use the sample seriesIndex
39
+ // and dataIndex. And also used in the tooltipView trigger.
34
40
  point = findPointFromSeries({
35
41
  seriesIndex: finder.seriesIndex,
36
42
  // Do not use dataIndexInside from other ec instance.
@@ -38,6 +44,13 @@ define(function(require) {
38
44
  dataIndex: finder.dataIndex
39
45
  }, ecModel).point;
40
46
  }
47
+ var isIllegalPoint = illegalPoint(point);
48
+
49
+ // Axis and value can be specified when calling dispatchAction({type: 'updateAxisPointer'}).
50
+ // Notice: In this case, it is difficult to get the `point` (which is necessary to show
51
+ // tooltip, so if point is not given, we just use the point found by sample seriesIndex
52
+ // and dataIndex.
53
+ var inputAxesInfo = finder.axesInfo;
41
54
 
42
55
  var axesInfo = coordSysAxesInfo.axesInfo;
43
56
  var shouldHide = currTrigger === 'leave' || illegalPoint(point);
@@ -45,21 +58,26 @@ define(function(require) {
45
58
 
46
59
  var showValueMap = {};
47
60
  var dataByCoordSys = {list: [], map: {}};
48
- var highlightBatch = [];
49
61
  var updaters = {
50
62
  showPointer: curry(showPointer, showValueMap),
51
- showTooltip: curry(showTooltip, dataByCoordSys),
52
- highlight: curry(highlight, highlightBatch)
63
+ showTooltip: curry(showTooltip, dataByCoordSys)
53
64
  };
54
65
 
55
66
  // Process for triggered axes.
56
67
  each(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) {
57
- var coordSysContainsPoint = coordSys.containPoint(point);
68
+ // If a point given, it must be contained by the coordinate system.
69
+ var coordSysContainsPoint = isIllegalPoint || coordSys.containPoint(point);
58
70
 
59
71
  each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) {
60
72
  var axis = axisInfo.axis;
61
- if (!shouldHide && coordSysContainsPoint && !notTargetAxis(finder, axis)) {
62
- processOnAxis(axisInfo, axis.pointToData(point), updaters, false, outputFinder);
73
+ var inputAxisInfo = findInputAxisInfo(inputAxesInfo, axisInfo);
74
+ // If no inputAxesInfo, no axis is restricted.
75
+ if (!shouldHide && coordSysContainsPoint && (!inputAxesInfo || inputAxisInfo)) {
76
+ var val = inputAxisInfo && inputAxisInfo.value;
77
+ if (val == null && !isIllegalPoint) {
78
+ val = axis.pointToData(point);
79
+ }
80
+ val != null && processOnAxis(axisInfo, val, updaters, false, outputFinder);
63
81
  }
64
82
  });
65
83
  });
@@ -88,9 +106,9 @@ define(function(require) {
88
106
  processOnAxis(axesInfo[tarKey], val, updaters, true, outputFinder);
89
107
  });
90
108
 
91
- updateModelActually(showValueMap, axesInfo);
109
+ updateModelActually(showValueMap, axesInfo, outputFinder);
92
110
  dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction);
93
- dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey);
111
+ dispatchHighDownActually(axesInfo, dispatchAction, api);
94
112
 
95
113
  return outputFinder;
96
114
  }
@@ -126,8 +144,7 @@ define(function(require) {
126
144
  }
127
145
  }
128
146
 
129
- updaters.highlight('highlight', payloadBatch);
130
- updaters.showPointer(axisInfo, newValue, payloadBatch);
147
+ updaters.showPointer(axisInfo, newValue, payloadBatch, outputFinder);
131
148
  // Tooltip should always be snapToValue, otherwise there will be
132
149
  // incorrect "axis value ~ series value" mapping displayed in tooltip.
133
150
  updaters.showTooltip(axisInfo, payloadInfo, snapToValue);
@@ -243,11 +260,8 @@ define(function(require) {
243
260
  });
244
261
  }
245
262
 
246
- function highlight(highlightBatch, actionType, batch) {
247
- highlightBatch.push.apply(highlightBatch, batch);
248
- }
249
-
250
- function updateModelActually(showValueMap, axesInfo) {
263
+ function updateModelActually(showValueMap, axesInfo, outputFinder) {
264
+ var outputAxesInfo = outputFinder.axesInfo = [];
251
265
  // Basic logic: If no 'show' required, 'hide' this axisPointer.
252
266
  each(axesInfo, function (axisInfo, key) {
253
267
  var option = axisInfo.axisPointerModel.option;
@@ -256,7 +270,7 @@ define(function(require) {
256
270
  if (valItem) {
257
271
  !axisInfo.useHandle && (option.status = 'show');
258
272
  option.value = valItem.value;
259
- // For label formatter param.
273
+ // For label formatter param and highlight.
260
274
  option.seriesDataIndices = (valItem.payloadBatch || []).slice();
261
275
  }
262
276
  // When always show (e.g., handle used), remain
@@ -266,6 +280,13 @@ define(function(require) {
266
280
  // click legend to toggle axis blank.
267
281
  !axisInfo.useHandle && (option.status = 'hide');
268
282
  }
283
+
284
+ // If status is 'hide', should be no info in payload.
285
+ option.status === 'show' && outputAxesInfo.push({
286
+ axisDim: axisInfo.axis.dim,
287
+ axisIndex: axisInfo.axis.model.componentIndex,
288
+ value: option.value
289
+ });
269
290
  });
270
291
  }
271
292
 
@@ -295,28 +316,24 @@ define(function(require) {
295
316
  });
296
317
  }
297
318
 
298
- function dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey) {
299
- // Basic logic: If nothing highlighted, should downplay all highlighted items.
300
- // This case will occur when mouse leave coordSys.
301
-
319
+ function dispatchHighDownActually(axesInfo, dispatchAction, api) {
302
320
  // FIXME
303
- // (1) highlight status shoule be managemented in series.getData()?
304
- // (2) If axisPointer A triggerOn 'handle' and axisPointer B triggerOn
305
- // 'mousemove', items highlighted by A will be downplayed by B.
306
- // It will not be fixed until someone requires this scenario.
307
-
308
- // Consider items area hightlighted by 'handle', and globalListener may
309
- // downplay all items (including just highlighted ones) when mousemove.
310
- // So we use a highDownKey to separate them as a temporary solution.
321
+ // highlight status modification shoule be a stage of main process?
322
+ // (Consider confilct (e.g., legend and axisPointer) and setOption)
323
+
311
324
  var zr = api.getZr();
312
- highDownKey = 'lastHighlights' + (highDownKey || '');
325
+ var highDownKey = 'axisPointerLastHighlights';
313
326
  var lastHighlights = get(zr)[highDownKey] || {};
314
327
  var newHighlights = get(zr)[highDownKey] = {};
315
328
 
329
+ // Update highlight/downplay status according to axisPointer model.
316
330
  // Build hash map and remove duplicate incidentally.
317
- zrUtil.each(highlightBatch, function (batchItem) {
318
- var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex;
319
- newHighlights[key] = batchItem;
331
+ each(axesInfo, function (axisInfo, key) {
332
+ var option = axisInfo.axisPointerModel.option;
333
+ option.status === 'show' && each(option.seriesDataIndices, function (batchItem) {
334
+ var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex;
335
+ newHighlights[key] = batchItem;
336
+ });
320
337
  });
321
338
 
322
339
  // Diff.
@@ -337,21 +354,15 @@ define(function(require) {
337
354
  });
338
355
  }
339
356
 
340
- function notTargetAxis(finder, axis) {
341
- var isTarget = 1;
342
- // If none of xxxAxisId and xxxAxisName and xxxAxisIndex exists in finder,
343
- // no axis is not target axis.
344
- each(finder, function (value, propName) {
345
- isTarget &= !(/^.+(AxisId|AxisName|AxisIndex)$/.test(propName));
346
- });
347
- !isTarget && each(
348
- [['AxisId', 'id'], ['AxisIndex', 'componentIndex'], ['AxisName', 'name']],
349
- function (prop) {
350
- var vals = modelUtil.normalizeToArray(finder[axis.dim + prop[0]]);
351
- isTarget |= zrUtil.indexOf(vals, axis.model[prop[1]]) >= 0;
357
+ function findInputAxisInfo(inputAxesInfo, axisInfo) {
358
+ for (var i = 0; i < (inputAxesInfo || []).length; i++) {
359
+ var inputAxisInfo = inputAxesInfo[i];
360
+ if (axisInfo.axis.dim === inputAxisInfo.axisDim
361
+ && axisInfo.axis.model.componentIndex === inputAxisInfo.axisIndex
362
+ ) {
363
+ return inputAxisInfo;
352
364
  }
353
- );
354
- return !isTarget;
365
+ }
355
366
  }
356
367
 
357
368
  function makeMapperParam(axisInfo) {
@@ -365,7 +376,7 @@ define(function(require) {
365
376
  }
366
377
 
367
378
  function illegalPoint(point) {
368
- return point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]);
379
+ return !point || point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]);
369
380
  }
370
381
 
371
382
  return axisTrigger;
@@ -52,8 +52,7 @@ define(function (require) {
52
52
  payload.dispatchAction || zrUtil.bind(api.dispatchAction, api),
53
53
  ecModel,
54
54
  api,
55
- payload.tooltipOption,
56
- payload.highDownKey
55
+ payload.tooltipOption
57
56
  );
58
57
 
59
58
  return outputFinder;
@@ -64,7 +64,7 @@ define(function (require) {
64
64
  var coordSys = calendarModel.coordinateSystem;
65
65
 
66
66
  // range info
67
- var rangeData = coordSys.getHandledRangeInfo();
67
+ var rangeData = coordSys.getRangeInfo();
68
68
  var orient = coordSys.getOrient();
69
69
 
70
70
  this._renderDayRect(calendarModel, rangeData, group);
@@ -91,7 +91,7 @@ define(function (require) {
91
91
  i = coordSys.getNextNDay(i, 1).time
92
92
  ) {
93
93
 
94
- var point = coordSys.dataToRect([i], true).tl;
94
+ var point = coordSys.dataToRect([i], false).tl;
95
95
 
96
96
  // every rect
97
97
  var rect = new graphic.Rect({
@@ -146,7 +146,7 @@ define(function (require) {
146
146
  function addPoints(date) {
147
147
 
148
148
  self._firstDayOfMonth.push(coordSys.getDateInfo(date));
149
- self._firstDayPoints.push(coordSys.dataToRect([date], true).tl);
149
+ self._firstDayPoints.push(coordSys.dataToRect([date], false).tl);
150
150
 
151
151
  var points = self._getLinePointsOfOneWeek(calendarModel, date, orient);
152
152
 
@@ -202,7 +202,7 @@ define(function (require) {
202
202
  for (var i = 0; i < 7; i++) {
203
203
 
204
204
  var tmpD = coordSys.getNextNDay(date.time, i);
205
- var point = coordSys.dataToRect([tmpD.time], true);
205
+ var point = coordSys.dataToRect([tmpD.time], false);
206
206
 
207
207
  points[2 * tmpD.day] = point.tl;
208
208
  points[2 * tmpD.day + 1] = point[orient === 'horizontal' ? 'bl' : 'tr'];
@@ -480,7 +480,7 @@ define(function (require) {
480
480
  for (var i = 0; i < 7; i++) {
481
481
 
482
482
  var tmpD = coordSys.getNextNDay(start, i);
483
- var point = coordSys.dataToRect([tmpD.time], true).center;
483
+ var point = coordSys.dataToRect([tmpD.time], false).center;
484
484
  var day = i;
485
485
  day = Math.abs((i + firstDayOfWeek) % 7);
486
486
  var weekText = new graphic.Text({
@@ -49,6 +49,13 @@ define(function(require) {
49
49
  */
50
50
  this._dataExtent;
51
51
 
52
+ /**
53
+ * {minSpan, maxSpan, minValueSpan, maxValueSpan}
54
+ * @private
55
+ * @type {Object}
56
+ */
57
+ this._minMaxSpan;
58
+
52
59
  /**
53
60
  * @readOnly
54
61
  * @type {module: echarts/model/Global}
@@ -147,6 +154,10 @@ define(function(require) {
147
154
  return foundOtherAxisModel;
148
155
  },
149
156
 
157
+ getMinMaxSpan: function () {
158
+ return zrUtil.clone(this._minMaxSpan);
159
+ },
160
+
150
161
  /**
151
162
  * Only calculate by given range and this._dataExtent, do not change anything.
152
163
  *
@@ -241,6 +252,8 @@ define(function(require) {
241
252
  this._valueWindow = dataWindow.valueWindow;
242
253
  this._percentWindow = dataWindow.percentWindow;
243
254
 
255
+ setMinMaxSpan(this);
256
+
244
257
  // Update axis setting then.
245
258
  setAxisModel(this);
246
259
  },
@@ -270,6 +283,10 @@ define(function(require) {
270
283
  var filterMode = dataZoomModel.get('filterMode');
271
284
  var valueWindow = this._valueWindow;
272
285
 
286
+ if (filterMode === 'none') {
287
+ return;
288
+ }
289
+
273
290
  // FIXME
274
291
  // Toolbox may has dataZoom injected. And if there are stacked bar chart
275
292
  // with NaN data, NaN will be filtered and stack will be wrong.
@@ -289,19 +306,43 @@ define(function(require) {
289
306
  // Process series data
290
307
  each(seriesModels, function (seriesModel) {
291
308
  var seriesData = seriesModel.getData();
292
-
293
- seriesData && each(seriesModel.coordDimToDataDim(axisDim), function (dim) {
294
- if (filterMode === 'empty') {
295
- seriesModel.setData(
296
- seriesData.map(dim, function (value) {
297
- return !isInWindow(value) ? NaN : value;
298
- })
299
- );
300
- }
301
- else {
302
- seriesData.filterSelf(dim, isInWindow);
303
- }
304
- });
309
+ var dataDims = seriesModel.coordDimToDataDim(axisDim);
310
+
311
+ if (filterMode === 'weakFilter') {
312
+ seriesData && seriesData.filterSelf(function (dataIndex) {
313
+ var leftOut;
314
+ var rightOut;
315
+ var hasValue;
316
+ for (var i = 0; i < dataDims.length; i++) {
317
+ var value = seriesData.get(dataDims[i], dataIndex);
318
+ var thisHasValue = !isNaN(value);
319
+ var thisLeftOut = value < valueWindow[0];
320
+ var thisRightOut = value > valueWindow[1];
321
+ if (thisHasValue && !thisLeftOut && !thisRightOut) {
322
+ return true;
323
+ }
324
+ thisHasValue && (hasValue = true);
325
+ thisLeftOut && (leftOut = true);
326
+ thisRightOut && (rightOut = true);
327
+ }
328
+ // If both left out and right out, do not filter.
329
+ return hasValue && leftOut && rightOut;
330
+ });
331
+ }
332
+ else {
333
+ seriesData && each(dataDims, function (dim) {
334
+ if (filterMode === 'empty') {
335
+ seriesModel.setData(
336
+ seriesData.map(dim, function (value) {
337
+ return !isInWindow(value) ? NaN : value;
338
+ })
339
+ );
340
+ }
341
+ else {
342
+ seriesData.filterSelf(dim, isInWindow);
343
+ }
344
+ });
345
+ }
305
346
  });
306
347
 
307
348
  function isInWindow(value) {
@@ -400,6 +441,28 @@ define(function(require) {
400
441
  );
401
442
  }
402
443
 
444
+ function setMinMaxSpan(axisProxy) {
445
+ var minMaxSpan = axisProxy._minMaxSpan = {};
446
+ var dataZoomModel = axisProxy._dataZoomModel;
447
+
448
+ each(['min', 'max'], function (minMax) {
449
+ minMaxSpan[minMax + 'Span'] = dataZoomModel.get(minMax + 'Span');
450
+
451
+ // minValueSpan and maxValueSpan has higher priority than minSpan and maxSpan
452
+ var valueSpan = dataZoomModel.get(minMax + 'ValueSpan');
453
+ if (valueSpan != null) {
454
+ minMaxSpan[minMax + 'ValueSpan'] = valueSpan;
455
+
456
+ valueSpan = axisProxy.getAxisModel().axis.scale.parse(valueSpan);
457
+ if (valueSpan != null) {
458
+ minMaxSpan[minMax + 'Span'] = numberUtil.linearMap(
459
+ valueSpan, axisProxy._dataExtent, [0, 100], true
460
+ );
461
+ }
462
+ }
463
+ });
464
+ }
465
+
403
466
  return AxisProxy;
404
467
 
405
468
  });
@@ -30,12 +30,18 @@ define(function(require) {
30
30
  xAxisIndex: null, // Default the first horizontal category axis.
31
31
  yAxisIndex: null, // Default the first vertical category axis.
32
32
 
33
- filterMode: 'filter', // Possible values: 'filter' or 'empty'.
34
- // 'filter': data items which are out of window will be removed.
35
- // This option is applicable when filtering outliers.
33
+ filterMode: 'filter', // Possible values: 'filter' or 'empty' or 'weakFilter'.
34
+ // 'filter': data items which are out of window will be removed. This option is
35
+ // applicable when filtering outliers. For each data item, it will be
36
+ // filtered if one of the relevant dimensions is out of the window.
37
+ // 'weakFilter': data items which are out of window will be removed. This option
38
+ // is applicable when filtering outliers. For each data item, it will be
39
+ // filtered only if all of the relevant dimensions are out of the same
40
+ // side of the window.
36
41
  // 'empty': data items which are out of window will be set to empty.
37
42
  // This option is applicable when user should not neglect
38
43
  // that there are some data items out of window.
44
+ // 'none': Do not filter.
39
45
  // Taking line chart as an example, line will be broken in
40
46
  // the filtered points when filterModel is set to 'empty', but
41
47
  // be connected when set to 'filter'.
@@ -47,7 +53,11 @@ define(function(require) {
47
53
  start: 0, // Start percent. 0 ~ 100
48
54
  end: 100, // End percent. 0 ~ 100
49
55
  startValue: null, // Start value. If startValue specified, start is ignored.
50
- endValue: null // End value. If endValue specified, end is ignored.
56
+ endValue: null, // End value. If endValue specified, end is ignored.
57
+ minSpan: null, // 0 ~ 100
58
+ maxSpan: null, // 0 ~ 100
59
+ minValueSpan: null, // The range of dataZoom can not be smaller than that.
60
+ maxValueSpan: null // The range of dataZoom can not be larger than that.
51
61
  },
52
62
 
53
63
  /**
@@ -469,9 +479,15 @@ define(function(require) {
469
479
 
470
480
  /**
471
481
  * @public
482
+ * @param {module:echarts/model/Model} [axisModel] If axisModel given, find axisProxy
483
+ * corresponding to the axisModel
472
484
  * @return {module:echarts/component/dataZoom/AxisProxy}
473
485
  */
474
- findRepresentativeAxisProxy: function () {
486
+ findRepresentativeAxisProxy: function (axisModel) {
487
+ if (axisModel) {
488
+ return axisModel.__dzAxisProxy;
489
+ }
490
+
475
491
  // Find the first hosted axisProxy
476
492
  var axisProxies = this._axisProxies;
477
493
  for (var key in axisProxies) {
@@ -12,7 +12,10 @@ define(function(require) {
12
12
  */
13
13
  defaultOption: {
14
14
  disabled: false, // Whether disable this inside zoom.
15
- zoomLock: false // Whether disable zoom but only pan.
15
+ zoomLock: false, // Whether disable zoom but only pan.
16
+ zoomOnMouseWheel: true, // Can be: true / false / 'shift' / 'ctrl' / 'alt'.
17
+ moveOnMouseMove: true, // Can be: true / false / 'shift' / 'ctrl' / 'alt'.
18
+ preventDefaultMouseMove: true
16
19
  }
17
20
  });
18
21
  });
@@ -45,6 +45,7 @@ define(function (require) {
45
45
 
46
46
  zrUtil.each(coordInfoList, function (coordInfo) {
47
47
  var coordModel = coordInfo.model;
48
+ var dataZoomOption = dataZoomModel.option;
48
49
 
49
50
  roams.register(
50
51
  api,
@@ -57,7 +58,14 @@ define(function (require) {
57
58
  dataZoomId: dataZoomModel.id,
58
59
  throttleRate: dataZoomModel.get('throttle', true),
59
60
  panGetRange: bind(this._onPan, this, coordInfo, coordSysName),
60
- zoomGetRange: bind(this._onZoom, this, coordInfo, coordSysName)
61
+ zoomGetRange: bind(this._onZoom, this, coordInfo, coordSysName),
62
+ zoomLock: dataZoomOption.zoomLock,
63
+ disabled: dataZoomOption.disabled,
64
+ roamControllerOpt: {
65
+ zoomOnMouseWheel: dataZoomOption.zoomOnMouseWheel,
66
+ moveOnMouseMove: dataZoomOption.moveOnMouseMove,
67
+ preventDefaultMouseMove: dataZoomOption.preventDefaultMouseMove
68
+ }
61
69
  }
62
70
  );
63
71
  }, this);
@@ -78,10 +86,6 @@ define(function (require) {
78
86
  * @private
79
87
  */
80
88
  _onPan: function (coordInfo, coordSysName, controller, dx, dy, oldX, oldY, newX, newY) {
81
- if (this.dataZoomModel.option.disabled) {
82
- return this._range;
83
- }
84
-
85
89
  var range = this._range.slice();
86
90
 
87
91
  // Calculate transform by the first axis.
@@ -98,7 +102,7 @@ define(function (require) {
98
102
  * (range[1] - range[0])
99
103
  * directionInfo.pixel / directionInfo.pixelLength;
100
104
 
101
- sliderMove(percentDelta, range, [0, 100], 'rigid');
105
+ sliderMove(percentDelta, range, [0, 100], 'all');
102
106
 
103
107
  return (this._range = range);
104
108
  },
@@ -107,12 +111,6 @@ define(function (require) {
107
111
  * @private
108
112
  */
109
113
  _onZoom: function (coordInfo, coordSysName, controller, scale, mouseX, mouseY) {
110
- var option = this.dataZoomModel.option;
111
-
112
- if (option.disabled || option.zoomLock) {
113
- return this._range;
114
- }
115
-
116
114
  var range = this._range.slice();
117
115
 
118
116
  // Calculate transform by the first axis.
@@ -131,7 +129,12 @@ define(function (require) {
131
129
  scale = Math.max(1 / scale, 0);
132
130
  range[0] = (range[0] - percentPoint) * scale + percentPoint;
133
131
  range[1] = (range[1] - percentPoint) * scale + percentPoint;
134
- return (this._range = fixRange(range));
132
+
133
+ // Restrict range.
134
+ var minMaxSpan = this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();
135
+ sliderMove(0, range, [0, 100], 0, minMaxSpan.minSpan, minMaxSpan.maxSpan);
136
+
137
+ return (this._range = range);
135
138
  }
136
139
 
137
140
  });
@@ -214,18 +217,5 @@ define(function (require) {
214
217
  }
215
218
  };
216
219
 
217
- function fixRange(range) {
218
- // Clamp, using !(<= or >=) to handle NaN.
219
- // jshint ignore:start
220
- var bound = [0, 100];
221
- !(range[0] <= bound[1]) && (range[0] = bound[1]);
222
- !(range[1] <= bound[1]) && (range[1] = bound[1]);
223
- !(range[0] >= bound[0]) && (range[0] = bound[0]);
224
- !(range[1] >= bound[0]) && (range[1] = bound[0]);
225
- // jshint ignore:end
226
-
227
- return range;
228
- }
229
-
230
220
  return InsideZoomView;
231
221
  });