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
@@ -14,25 +14,29 @@
14
14
  * then hide/downplay them.
15
15
  *
16
16
  * @param {Object} coordSysAxesInfo
17
- * @param {string} currTrigger 'click' | 'mousemove' | 'leave'
18
- * @param {Object} finder {x, y, xAxisId: ...[], yAxisName: ...[], angleAxisIndex: ...[]}
19
- * x and y, which are mandatory, specify a point to tigger axisPointer and tooltip.
20
- * other properties, which are optional, restrict target axes.
17
+ * @param {string} [currTrigger] 'click' | 'mousemove' | 'leave'
18
+ * @param {Array.<number>} [point] x and y, which are mandatory, specify a point to
19
+ * tigger axisPointer and tooltip.
20
+ * @param {Object} [finder] {
21
+ * seriesIndex, dataIndex,
22
+ * axesInfo: [{
23
+ * axisDim: 'x'|'y'|'angle'|..., axisIndex: ..., value: ...
24
+ * }, ...]
25
+ * }
26
+ * These properties, which are optional, restrict target axes.
21
27
  * @param {Function} dispatchAction
22
28
  * @param {module:echarts/ExtensionAPI} api
23
- * @param {Object} tooltipOption
24
- * @param {string} [highDownKey]
29
+ * @param {Object} [tooltipOption]
25
30
  * @return {Object} content of event obj for echarts.connect.
26
31
  */
27
32
  function axisTrigger(
28
- coordSysAxesInfo, currTrigger, finder, dispatchAction,
29
- ecModel, api, tooltipOption, highDownKey
33
+ coordSysAxesInfo, currTrigger, point, finder, dispatchAction,
34
+ ecModel, api, tooltipOption
30
35
  ) {
31
- var point = [];
32
- if (finder.x != null && finder.y != null) {
33
- point = [finder.x, finder.y];
34
- }
35
- else {
36
+ finder = finder || {};
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.
36
40
  point = findPointFromSeries({
37
41
  seriesIndex: finder.seriesIndex,
38
42
  // Do not use dataIndexInside from other ec instance.
@@ -40,6 +44,13 @@
40
44
  dataIndex: finder.dataIndex
41
45
  }, ecModel).point;
42
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;
43
54
 
44
55
  var axesInfo = coordSysAxesInfo.axesInfo;
45
56
  var shouldHide = currTrigger === 'leave' || illegalPoint(point);
@@ -47,46 +58,57 @@
47
58
 
48
59
  var showValueMap = {};
49
60
  var dataByCoordSys = {list: [], map: {}};
50
- var highlightBatch = [];
51
61
  var updaters = {
52
62
  showPointer: curry(showPointer, showValueMap),
53
- showTooltip: curry(showTooltip, dataByCoordSys),
54
- highlight: curry(highlight, highlightBatch)
63
+ showTooltip: curry(showTooltip, dataByCoordSys)
55
64
  };
56
65
 
57
66
  // Process for triggered axes.
58
67
  each(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) {
59
- 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);
60
70
 
61
71
  each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) {
62
72
  var axis = axisInfo.axis;
63
- if (!shouldHide && coordSysContainsPoint && !notTargetAxis(finder, axis)) {
64
- 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);
65
81
  }
66
82
  });
67
83
  });
68
84
 
69
85
  // Process for linked axes.
86
+ var linkTriggers = {};
70
87
  each(axesInfo, function (tarAxisInfo, tarKey) {
71
88
  var linkGroup = tarAxisInfo.linkGroup;
72
89
 
73
90
  // If axis has been triggered in the previous stage, it should not be triggered by link.
74
- linkGroup && !showValueMap[tarKey] && each(linkGroup.axesInfo, function (srcAxisInfo, srcKey) {
75
- var srcValItem = showValueMap[srcKey];
76
- // If srcValItem exist, source axis is triggered, so link to target axis.
77
- if (srcAxisInfo !== tarAxisInfo && srcValItem) {
78
- var val = srcValItem.value;
79
- linkGroup.mapper && (val = tarAxisInfo.axis.scale.parse(linkGroup.mapper(
80
- val, makeMapperParam(srcAxisInfo), makeMapperParam(tarAxisInfo)
81
- )));
82
- processOnAxis(tarAxisInfo, val, updaters, true, outputFinder);
83
- }
84
- });
91
+ if (linkGroup && !showValueMap[tarKey]) {
92
+ each(linkGroup.axesInfo, function (srcAxisInfo, srcKey) {
93
+ var srcValItem = showValueMap[srcKey];
94
+ // If srcValItem exist, source axis is triggered, so link to target axis.
95
+ if (srcAxisInfo !== tarAxisInfo && srcValItem) {
96
+ var val = srcValItem.value;
97
+ linkGroup.mapper && (val = tarAxisInfo.axis.scale.parse(linkGroup.mapper(
98
+ val, makeMapperParam(srcAxisInfo), makeMapperParam(tarAxisInfo)
99
+ )));
100
+ linkTriggers[tarAxisInfo.key] = val;
101
+ }
102
+ });
103
+ }
104
+ });
105
+ each(linkTriggers, function (val, tarKey) {
106
+ processOnAxis(axesInfo[tarKey], val, updaters, true, outputFinder);
85
107
  });
86
108
 
87
- updateModelActually(showValueMap, axesInfo);
109
+ updateModelActually(showValueMap, axesInfo, outputFinder);
88
110
  dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction);
89
- dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey);
111
+ dispatchHighDownActually(axesInfo, dispatchAction, api);
90
112
 
91
113
  return outputFinder;
92
114
  }
@@ -122,8 +144,7 @@
122
144
  }
123
145
  }
124
146
 
125
- updaters.highlight('highlight', payloadBatch);
126
- updaters.showPointer(axisInfo, newValue, payloadBatch);
147
+ updaters.showPointer(axisInfo, newValue, payloadBatch, outputFinder);
127
148
  // Tooltip should always be snapToValue, otherwise there will be
128
149
  // incorrect "axis value ~ series value" mapping displayed in tooltip.
129
150
  updaters.showTooltip(axisInfo, payloadInfo, snapToValue);
@@ -148,7 +169,7 @@
148
169
  seriesNestestValue = result.nestestValue;
149
170
  }
150
171
  else {
151
- dataIndices = series.getData().indexOfNearest(
172
+ dataIndices = series.getData().indicesOfNearest(
152
173
  dataDim[0],
153
174
  value,
154
175
  // Add a threshold to avoid find the wrong dataIndex
@@ -239,11 +260,8 @@
239
260
  });
240
261
  }
241
262
 
242
- function highlight(highlightBatch, actionType, batch) {
243
- highlightBatch.push.apply(highlightBatch, batch);
244
- }
245
-
246
- function updateModelActually(showValueMap, axesInfo) {
263
+ function updateModelActually(showValueMap, axesInfo, outputFinder) {
264
+ var outputAxesInfo = outputFinder.axesInfo = [];
247
265
  // Basic logic: If no 'show' required, 'hide' this axisPointer.
248
266
  each(axesInfo, function (axisInfo, key) {
249
267
  var option = axisInfo.axisPointerModel.option;
@@ -252,7 +270,7 @@
252
270
  if (valItem) {
253
271
  !axisInfo.useHandle && (option.status = 'show');
254
272
  option.value = valItem.value;
255
- // For label formatter param.
273
+ // For label formatter param and highlight.
256
274
  option.seriesDataIndices = (valItem.payloadBatch || []).slice();
257
275
  }
258
276
  // When always show (e.g., handle used), remain
@@ -262,6 +280,13 @@
262
280
  // click legend to toggle axis blank.
263
281
  !axisInfo.useHandle && (option.status = 'hide');
264
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
+ });
265
290
  });
266
291
  }
267
292
 
@@ -291,28 +316,24 @@
291
316
  });
292
317
  }
293
318
 
294
- function dispatchHighDownActually(highlightBatch, dispatchAction, api, highDownKey) {
295
- // Basic logic: If nothing highlighted, should downplay all highlighted items.
296
- // This case will occur when mouse leave coordSys.
297
-
319
+ function dispatchHighDownActually(axesInfo, dispatchAction, api) {
298
320
  // FIXME
299
- // (1) highlight status shoule be managemented in series.getData()?
300
- // (2) If axisPointer A triggerOn 'handle' and axisPointer B triggerOn
301
- // 'mousemove', items highlighted by A will be downplayed by B.
302
- // It will not be fixed until someone requires this scenario.
303
-
304
- // Consider items area hightlighted by 'handle', and globalListener may
305
- // downplay all items (including just highlighted ones) when mousemove.
306
- // 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
+
307
324
  var zr = api.getZr();
308
- highDownKey = 'lastHighlights' + (highDownKey || '');
325
+ var highDownKey = 'axisPointerLastHighlights';
309
326
  var lastHighlights = get(zr)[highDownKey] || {};
310
327
  var newHighlights = get(zr)[highDownKey] = {};
311
328
 
329
+ // Update highlight/downplay status according to axisPointer model.
312
330
  // Build hash map and remove duplicate incidentally.
313
- zrUtil.each(highlightBatch, function (batchItem) {
314
- var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex;
315
- 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
+ });
316
337
  });
317
338
 
318
339
  // Diff.
@@ -333,21 +354,15 @@
333
354
  });
334
355
  }
335
356
 
336
- function notTargetAxis(finder, axis) {
337
- var isTarget = 1;
338
- // If none of xxxAxisId and xxxAxisName and xxxAxisIndex exists in finder,
339
- // no axis is not target axis.
340
- each(finder, function (value, propName) {
341
- isTarget &= !(/^.+(AxisId|AxisName|AxisIndex)$/.test(propName));
342
- });
343
- !isTarget && each(
344
- [['AxisId', 'id'], ['AxisIndex', 'componentIndex'], ['AxisName', 'name']],
345
- function (prop) {
346
- var vals = modelUtil.normalizeToArray(finder[axis.dim + prop[0]]);
347
- 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;
348
364
  }
349
- );
350
- return !isTarget;
365
+ }
351
366
  }
352
367
 
353
368
  function makeMapperParam(axisInfo) {
@@ -361,7 +376,7 @@
361
376
  }
362
377
 
363
378
  function illegalPoint(point) {
364
- 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]);
365
380
  }
366
381
 
367
382
  module.exports = axisTrigger;
@@ -88,7 +88,9 @@
88
88
  shadowColor: labelModel.get('shadowColor'),
89
89
  shadowOffsetX: labelModel.get('shadowOffsetX'),
90
90
  shadowOffsetY: labelModel.get('shadowOffsetY')
91
- }
91
+ },
92
+ // Lable should be over axisPointer.
93
+ z2: 10
92
94
  };
93
95
  };
94
96
 
@@ -113,8 +115,9 @@
113
115
  */
114
116
  helper.getValueLabel = function (value, axis, ecModel, seriesDataIndices, opt) {
115
117
  var text = axis.scale.getLabel(
116
- // Use 'pad' to try to fix width, which helps to debounce when when moving label.
117
- value, {precision: opt.precision, pad: true}
118
+ // If `precision` is set, width can be fixed (like '12.00500'), which
119
+ // helps to debounce when when moving label.
120
+ value, {precision: opt.precision}
118
121
  );
119
122
  var formatter = opt.formatter;
120
123
 
@@ -47,12 +47,12 @@
47
47
  var outputFinder = axisTrigger(
48
48
  ecModel.getComponent('axisPointer').coordSysAxesInfo,
49
49
  payload.currTrigger,
50
+ [payload.x, payload.y],
50
51
  payload,
51
52
  payload.dispatchAction || zrUtil.bind(api.dispatchAction, api),
52
53
  ecModel,
53
54
  api,
54
- payload.tooltipOption,
55
- payload.highDownKey
55
+ payload.tooltipOption
56
56
  );
57
57
 
58
58
  return outputFinder;
@@ -36,8 +36,7 @@
36
36
  brushStyle: { // Default brushStyle
37
37
  borderWidth: 1,
38
38
  color: 'rgba(120,140,180,0.3)',
39
- borderColor: 'rgba(120,140,180,0.8)',
40
- width: null // do not use bursh width in line brush, but fetch from grid.
39
+ borderColor: 'rgba(120,140,180,0.8)'
41
40
  },
42
41
 
43
42
  throttleType: 'fixRate',// Throttle in brushSelected event. 'fixRate' or 'debounce'.
@@ -46,7 +45,9 @@
46
45
 
47
46
  // FIXME
48
47
  // 试验效果
49
- removeOnClick: true
48
+ removeOnClick: true,
49
+
50
+ z: 10000
50
51
  },
51
52
 
52
53
  /**
@@ -133,7 +134,8 @@
133
134
  brushMode: option.brushMode,
134
135
  transformable: option.transformable,
135
136
  brushStyle: new Model(option.brushStyle).getItemStyle(),
136
- removeOnClick: option.removeOnClick
137
+ removeOnClick: option.removeOnClick,
138
+ z: option.z
137
139
  },
138
140
  brushOption,
139
141
  true
@@ -92,7 +92,7 @@
92
92
  function updateController(brushModel, ecModel, api, payload) {
93
93
  // Do not update controller when drawing.
94
94
  (!payload || payload.$from !== brushModel.id) && this._brushController
95
- .setPanels(brushModel.brushTargetManager.makePanelOpts())
95
+ .setPanels(brushModel.brushTargetManager.makePanelOpts(api))
96
96
  .enableBrush(brushModel.brushOption)
97
97
  .updateCovers(brushModel.areas.slice());
98
98
  }
@@ -120,7 +120,7 @@
120
120
 
121
121
  function stepAParallel(seriesModel, seriesIndex) {
122
122
  var coordSys = seriesModel.coordinateSystem;
123
- hasBrushExists |= coordSys.hasAxisbrushed();
123
+ hasBrushExists |= coordSys.hasAxisBrushed();
124
124
 
125
125
  linkOthers(seriesIndex) && coordSys.eachActiveState(
126
126
  seriesModel.getData(),
@@ -233,11 +233,10 @@
233
233
  }
234
234
 
235
235
  function checkInRange(selectorsByBrushType, rangeInfoList, data, dataIndex) {
236
- var itemLayout = data.getItemLayout(dataIndex);
237
236
  for (var i = 0, len = rangeInfoList.length; i < len; i++) {
238
237
  var area = rangeInfoList[i];
239
238
  if (selectorsByBrushType[area.brushType](
240
- itemLayout, area.selectors, area
239
+ dataIndex, data, area.selectors, area
241
240
  )) {
242
241
  return true;
243
242
  }
@@ -249,7 +248,10 @@
249
248
  if (zrUtil.isString(brushSelector)) {
250
249
  var sels = [];
251
250
  zrUtil.each(selector, function (selectorsByElementType, brushType) {
252
- sels[brushType] = selectorsByElementType[brushSelector];
251
+ sels[brushType] = function (dataIndex, data, selectors, area) {
252
+ var itemLayout = data.getItemLayout(dataIndex);
253
+ return selectorsByElementType[brushSelector](itemLayout, selectors, area);
254
+ };
253
255
  });
254
256
  return sels;
255
257
  }
@@ -63,7 +63,7 @@
63
63
  var coordSys = calendarModel.coordinateSystem;
64
64
 
65
65
  // range info
66
- var rangeData = coordSys.getHandledRangeInfo();
66
+ var rangeData = coordSys.getRangeInfo();
67
67
  var orient = coordSys.getOrient();
68
68
 
69
69
  this._renderDayRect(calendarModel, rangeData, group);
@@ -90,7 +90,7 @@
90
90
  i = coordSys.getNextNDay(i, 1).time
91
91
  ) {
92
92
 
93
- var point = coordSys.dataToRect([i], true).tl;
93
+ var point = coordSys.dataToRect([i], false).tl;
94
94
 
95
95
  // every rect
96
96
  var rect = new graphic.Rect({
@@ -145,7 +145,7 @@
145
145
  function addPoints(date) {
146
146
 
147
147
  self._firstDayOfMonth.push(coordSys.getDateInfo(date));
148
- self._firstDayPoints.push(coordSys.dataToRect([date], true).tl);
148
+ self._firstDayPoints.push(coordSys.dataToRect([date], false).tl);
149
149
 
150
150
  var points = self._getLinePointsOfOneWeek(calendarModel, date, orient);
151
151
 
@@ -201,7 +201,7 @@
201
201
  for (var i = 0; i < 7; i++) {
202
202
 
203
203
  var tmpD = coordSys.getNextNDay(date.time, i);
204
- var point = coordSys.dataToRect([tmpD.time], true);
204
+ var point = coordSys.dataToRect([tmpD.time], false);
205
205
 
206
206
  points[2 * tmpD.day] = point.tl;
207
207
  points[2 * tmpD.day + 1] = point[orient === 'horizontal' ? 'bl' : 'tr'];
@@ -479,7 +479,7 @@
479
479
  for (var i = 0; i < 7; i++) {
480
480
 
481
481
  var tmpD = coordSys.getNextNDay(start, i);
482
- var point = coordSys.dataToRect([tmpD.time], true).center;
482
+ var point = coordSys.dataToRect([tmpD.time], false).center;
483
483
  var day = i;
484
484
  day = Math.abs((i + firstDayOfWeek) % 7);
485
485
  var weekText = new graphic.Text({
@@ -49,6 +49,13 @@
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 @@
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 @@
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 @@
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 @@
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,5 +441,27 @@
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
  module.exports = AxisProxy;
404
467
 
@@ -30,12 +30,18 @@
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 @@
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 @@
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,6 +12,9 @@
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
  });