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
@@ -1,5 +1,3 @@
1
- // TODO minAngle
2
-
3
1
 
4
2
 
5
3
  var numberUtil = require('../../util/number');
@@ -36,9 +34,14 @@
36
34
 
37
35
  var minAngle = seriesModel.get('minAngle') * RADIAN;
38
36
 
37
+ var validDataCount = 0;
38
+ data.each('value', function (value) {
39
+ !isNaN(value) && validDataCount++;
40
+ });
41
+
39
42
  var sum = data.getSum('value');
40
43
  // Sum may be 0
41
- var unitRadian = Math.PI / (sum || data.count()) * 2;
44
+ var unitRadian = Math.PI / (sum || validDataCount) * 2;
42
45
 
43
46
  var clockwise = seriesModel.get('clockwise');
44
47
 
@@ -54,8 +57,8 @@
54
57
  var valueSumLargerThanMinAngle = 0;
55
58
 
56
59
  var currentAngle = startAngle;
57
-
58
60
  var dir = clockwise ? 1 : -1;
61
+
59
62
  data.each('value', function (value, idx) {
60
63
  var angle;
61
64
  if (isNaN(value)) {
@@ -80,7 +83,7 @@
80
83
  ? unitRadian : (value * unitRadian);
81
84
  }
82
85
  else {
83
- angle = PI2 / (data.count() || 1);
86
+ angle = PI2 / validDataCount;
84
87
  }
85
88
 
86
89
  if (angle < minAngle) {
@@ -110,27 +113,32 @@
110
113
 
111
114
  // Some sector is constrained by minAngle
112
115
  // Rest sectors needs recalculate angle
113
- if (restAngle < PI2) {
116
+ if (restAngle < PI2 && validDataCount) {
114
117
  // Average the angle if rest angle is not enough after all angles is
115
118
  // Constrained by minAngle
116
119
  if (restAngle <= 1e-3) {
117
- var angle = PI2 / data.count();
118
- data.each(function (idx) {
119
- var layout = data.getItemLayout(idx);
120
- layout.startAngle = startAngle + dir * idx * angle;
121
- layout.endAngle = startAngle + dir * (idx + 1) * angle;
120
+ var angle = PI2 / validDataCount;
121
+ data.each('value', function (value, idx) {
122
+ if (!isNaN(value)) {
123
+ var layout = data.getItemLayout(idx);
124
+ layout.angle = angle;
125
+ layout.startAngle = startAngle + dir * idx * angle;
126
+ layout.endAngle = startAngle + dir * (idx + 1) * angle;
127
+ }
122
128
  });
123
129
  }
124
130
  else {
125
131
  unitRadian = restAngle / valueSumLargerThanMinAngle;
126
132
  currentAngle = startAngle;
127
133
  data.each('value', function (value, idx) {
128
- var layout = data.getItemLayout(idx);
129
- var angle = layout.angle === minAngle
130
- ? minAngle : value * unitRadian;
131
- layout.startAngle = currentAngle;
132
- layout.endAngle = currentAngle + dir * angle;
133
- currentAngle += dir * angle;
134
+ if (!isNaN(value)) {
135
+ var layout = data.getItemLayout(idx);
136
+ var angle = layout.angle === minAngle
137
+ ? minAngle : value * unitRadian;
138
+ layout.startAngle = currentAngle;
139
+ layout.endAngle = currentAngle + dir * angle;
140
+ currentAngle += dir * angle;
141
+ }
134
142
  });
135
143
  }
136
144
  }
@@ -28,7 +28,7 @@
28
28
  getInitialData: function (option, ecModel) {
29
29
  var data = option.data || [];
30
30
  var dimensions = completeDimensions(
31
- [], data, {extraPrefix: 'indicator_'}
31
+ [], data, {extraPrefix: 'indicator_', extraFromZero: true}
32
32
  );
33
33
  var list = new List(dimensions, this);
34
34
  list.initData(data);
@@ -29,7 +29,7 @@
29
29
 
30
30
  computeNodeValues(nodes);
31
31
 
32
- var filteredNodes = nodes.filter(function (node) {
32
+ var filteredNodes = zrUtil.filter(nodes, function (node) {
33
33
  return node.getLayout().value === 0;
34
34
  });
35
35
 
@@ -8,11 +8,10 @@
8
8
 
9
9
  type: 'series.scatter',
10
10
 
11
- dependencies: ['grid', 'polar', 'geo', 'singleAxis'],
11
+ dependencies: ['grid', 'polar', 'geo', 'singleAxis', 'calendar'],
12
12
 
13
13
  getInitialData: function (option, ecModel) {
14
- var list = createListFromArray(option.data, this, ecModel);
15
- return list;
14
+ return createListFromArray(option.data, this, ecModel);
16
15
  },
17
16
 
18
17
  brushSelector: 'point',
@@ -23,7 +23,7 @@
23
23
 
24
24
  /**
25
25
  * @readOnly
26
- * @type {Object}
26
+ * @type {module:zrender/core/util#HashMap}
27
27
  */
28
28
  nameMap: null,
29
29
 
@@ -150,17 +150,18 @@
150
150
 
151
151
  var data = this.fixData(filterData || []);
152
152
  var nameList = [];
153
- var nameMap = this.nameMap = {};
153
+ var nameMap = this.nameMap = zrUtil.createHashMap();
154
154
  var count = 0;
155
155
 
156
156
  for (var i = 0; i < data.length; ++i) {
157
157
  nameList.push(data[i][DATA_NAME_INDEX]);
158
- if (!nameMap[data[i][DATA_NAME_INDEX]]) {
159
- nameMap[data[i][DATA_NAME_INDEX]] = count++;
158
+ if (!nameMap.get(data[i][DATA_NAME_INDEX])) {
159
+ nameMap.set(data[i][DATA_NAME_INDEX], count);
160
+ count++;
160
161
  }
161
162
  }
162
163
 
163
- completeDimensions(dimensions, data);
164
+ dimensions = completeDimensions(dimensions, data);
164
165
 
165
166
  var list = new List(dimensions, this);
166
167
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  data.each(function (index) {
14
14
  var name = data.getName(index);
15
- var color = colorList[(seriesModel.nameMap[name] - 1) % colorList.length];
15
+ var color = colorList[(seriesModel.nameMap.get(name) - 1) % colorList.length];
16
16
  rawData.setItemVisual(index, 'color', color);
17
17
  });
18
18
  });
@@ -237,7 +237,7 @@
237
237
  var idIndexMap = this._idIndexMap;
238
238
 
239
239
  if (!idIndexMap) {
240
- idIndexMap = this._idIndexMap = {};
240
+ idIndexMap = this._idIndexMap = zrUtil.createHashMap();
241
241
  /**
242
242
  * @private
243
243
  * @type {number}
@@ -245,9 +245,9 @@
245
245
  this._idIndexMapCount = 0;
246
246
  }
247
247
 
248
- var index = idIndexMap[id];
248
+ var index = idIndexMap.get(id);
249
249
  if (index == null) {
250
- idIndexMap[id] = index = this._idIndexMapCount++;
250
+ idIndexMap.set(id, index = this._idIndexMapCount++);
251
251
  }
252
252
 
253
253
  return index;
@@ -375,7 +375,7 @@
375
375
  }
376
376
 
377
377
  var rect = new BoundingRect(0, 0, api.getWidth(), api.getHeight());
378
- controller.setContainsPoint(function (x, y) {
378
+ controller.setPointerChecker(function (e, x, y) {
379
379
  return rect.contain(x, y);
380
380
  });
381
381
  },
@@ -301,8 +301,13 @@
301
301
  function sort(viewChildren, orderBy) {
302
302
  if (orderBy) {
303
303
  viewChildren.sort(function (a, b) {
304
- return orderBy === 'asc'
304
+ var diff = orderBy === 'asc'
305
305
  ? a.getValue() - b.getValue() : b.getValue() - a.getValue();
306
+ return diff === 0
307
+ ? (orderBy === 'asc'
308
+ ? a.dataIndex - b.dataIndex : b.dataIndex - a.dataIndex
309
+ )
310
+ : diff;
306
311
  });
307
312
  }
308
313
  return viewChildren;
@@ -8,6 +8,7 @@
8
8
  var remRadian = numberUtil.remRadian;
9
9
  var isRadianAroundZero = numberUtil.isRadianAroundZero;
10
10
  var vec2 = require('zrender/lib/core/vector');
11
+ var matrix = require('zrender/lib/core/matrix');
11
12
  var v2ApplyTransform = vec2.applyTransform;
12
13
  var retrieve = zrUtil.retrieve;
13
14
 
@@ -59,6 +60,7 @@
59
60
  * @param {number} [opt.labelInterval] Default label interval when label
60
61
  * interval from model is null or 'auto'.
61
62
  * @param {number} [opt.strokeContainThreshold] Default label interval when label
63
+ * @param {number} [opt.nameTruncateMaxWidth]
62
64
  */
63
65
  var AxisBuilder = function (axisModel, opt) {
64
66
 
@@ -334,33 +336,7 @@
334
336
 
335
337
  }, this);
336
338
 
337
- function isTwoLabelOverlapped(current, next) {
338
- var firstRect = current && current.getBoundingRect().clone();
339
- var nextRect = next && next.getBoundingRect().clone();
340
- if (firstRect && nextRect) {
341
- firstRect.applyTransform(current.getLocalTransform());
342
- nextRect.applyTransform(next.getLocalTransform());
343
- return firstRect.intersect(nextRect);
344
- }
345
- }
346
-
347
- // If min or max are user set, we need to check
348
- // If the tick on min(max) are overlap on their neighbour tick
349
- // If they are overlapped, we need to hide the min(max) tick label
350
- if (axisModel.getMin() != null) {
351
- var firstLabel = textEls[0];
352
- var nextLabel = textEls[1];
353
- if (isTwoLabelOverlapped(firstLabel, nextLabel)) {
354
- firstLabel.ignore = true;
355
- }
356
- }
357
- if (axisModel.getMax() != null) {
358
- var lastLabel = textEls[textEls.length - 1];
359
- var prevLabel = textEls[textEls.length - 2];
360
- if (isTwoLabelOverlapped(prevLabel, lastLabel)) {
361
- lastLabel.ignore = true;
362
- }
363
- }
339
+ fixMinMaxLabelShow(axisModel, textEls);
364
340
  },
365
341
 
366
342
  /**
@@ -426,7 +402,9 @@
426
402
 
427
403
  var truncateOpt = axisModel.get('nameTruncate', true) || {};
428
404
  var ellipsis = truncateOpt.ellipsis;
429
- var maxWidth = retrieve(truncateOpt.maxWidth, axisNameAvailableWidth);
405
+ var maxWidth = retrieve(
406
+ opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth
407
+ );
430
408
  var truncatedText = (ellipsis != null && maxWidth != null)
431
409
  ? formatUtil.truncateText(
432
410
  name, maxWidth, textFont, ellipsis,
@@ -536,9 +514,6 @@
536
514
  };
537
515
  };
538
516
 
539
- /**
540
- * @inner
541
- */
542
517
  function endTextLayout(opt, textPosition, textRotate, extent) {
543
518
  var rotationDiff = remRadian(textRotate - opt.rotation);
544
519
  var textAlign;
@@ -572,9 +547,6 @@
572
547
  };
573
548
  }
574
549
 
575
- /**
576
- * @inner
577
- */
578
550
  function isSilent(axisModel) {
579
551
  var tooltipOpt = axisModel.get('tooltip');
580
552
  return axisModel.get('silent')
@@ -584,6 +556,53 @@
584
556
  );
585
557
  }
586
558
 
559
+ function fixMinMaxLabelShow(axisModel, textEls) {
560
+ // If min or max are user set, we need to check
561
+ // If the tick on min(max) are overlap on their neighbour tick
562
+ // If they are overlapped, we need to hide the min(max) tick label
563
+ var showMinLabel = axisModel.get('axisLabel.showMinLabel');
564
+ var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
565
+ var firstLabel = textEls[0];
566
+ var nextLabel = textEls[1];
567
+ var lastLabel = textEls[textEls.length - 1];
568
+ var prevLabel = textEls[textEls.length - 2];
569
+
570
+ if (showMinLabel === false) {
571
+ firstLabel.ignore = true;
572
+ }
573
+ else if (axisModel.getMin() != null && isTwoLabelOverlapped(firstLabel, nextLabel)) {
574
+ showMinLabel ? (nextLabel.ignore = true) : (firstLabel.ignore = true);
575
+ }
576
+
577
+ if (showMaxLabel === false) {
578
+ lastLabel.ignore = true;
579
+ }
580
+ else if (axisModel.getMax() != null && isTwoLabelOverlapped(prevLabel, lastLabel)) {
581
+ showMaxLabel ? (prevLabel.ignore = true) : (lastLabel.ignore = true);
582
+ }
583
+ }
584
+
585
+ function isTwoLabelOverlapped(current, next, labelLayout) {
586
+ // current and next has the same rotation.
587
+ var firstRect = current && current.getBoundingRect().clone();
588
+ var nextRect = next && next.getBoundingRect().clone();
589
+
590
+ if (!firstRect || !nextRect) {
591
+ return;
592
+ }
593
+
594
+ // When checking intersect of two rotated labels, we use mRotationBack
595
+ // to avoid that boundingRect is enlarge when using `boundingRect.applyTransform`.
596
+ var mRotationBack = matrix.identity([]);
597
+ matrix.rotate(mRotationBack, mRotationBack, -current.rotation);
598
+
599
+ firstRect.applyTransform(matrix.mul([], mRotationBack, current.getLocalTransform()));
600
+ nextRect.applyTransform(matrix.mul([], mRotationBack, next.getLocalTransform()));
601
+
602
+ return firstRect.intersect(nextRect);
603
+ }
604
+
605
+
587
606
  /**
588
607
  * @static
589
608
  */
@@ -3,6 +3,7 @@
3
3
  var zrUtil = require('zrender/lib/core/util');
4
4
  var AxisBuilder = require('./AxisBuilder');
5
5
  var BrushController = require('../helper/BrushController');
6
+ var brushHelper = require('../helper/brushHelper');
6
7
  var graphic = require('../../util/graphic');
7
8
 
8
9
  var elementList = ['axisLine', 'axisLabel', 'axisTick', 'axisName'];
@@ -45,9 +46,8 @@
45
46
  return;
46
47
  }
47
48
 
48
- var coordSys = ecModel.getComponent(
49
- 'parallel', axisModel.get('parallelIndex')
50
- ).coordinateSystem;
49
+ var coordSysModel = getCoordSysModel(axisModel, ecModel);
50
+ var coordSys = coordSysModel.coordinateSystem;
51
51
 
52
52
  var areaSelectStyle = axisModel.getAreaSelectStyle();
53
53
  var areaWidth = areaSelectStyle.width;
@@ -55,22 +55,8 @@
55
55
  var dim = axisModel.axis.dim;
56
56
  var axisLayout = coordSys.getAxisLayout(dim);
57
57
 
58
- // Fetch from axisModel by default.
59
- var axisLabelShow;
60
- var axisIndex = zrUtil.indexOf(coordSys.dimensions, dim);
61
-
62
- var axisExpandWindow = axisLayout.axisExpandWindow;
63
- if (axisExpandWindow
64
- && (axisIndex <= axisExpandWindow[0] || axisIndex >= axisExpandWindow[1])
65
- ) {
66
- axisLabelShow = false;
67
- }
68
-
69
58
  var builderOpt = zrUtil.extend(
70
- {
71
- axisLabelShow: axisLabelShow,
72
- strokeContainThreshold: areaWidth
73
- },
59
+ {strokeContainThreshold: areaWidth},
74
60
  axisLayout
75
61
  );
76
62
 
@@ -80,26 +66,27 @@
80
66
 
81
67
  this._axisGroup.add(axisBuilder.getGroup());
82
68
 
83
- this._refreshBrushController(builderOpt, areaSelectStyle, axisModel, areaWidth);
69
+ this._refreshBrushController(
70
+ builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api
71
+ );
84
72
 
85
- graphic.groupTransition(oldAxisGroup, this._axisGroup, axisModel);
73
+ var animationModel = (payload && payload.animation === false) ? null : axisModel;
74
+ graphic.groupTransition(oldAxisGroup, this._axisGroup, animationModel);
86
75
  },
87
76
 
88
- _refreshBrushController: function (builderOpt, areaSelectStyle, axisModel, areaWidth) {
89
- // After filtering, axis may change, select area needs to be update.
90
- var axis = axisModel.axis;
91
- var coverInfoList = zrUtil.map(axisModel.activeIntervals, function (interval) {
92
- return {
93
- brushType: 'lineX',
94
- panelId: 'pl',
95
- range: [
96
- axis.dataToCoord(interval[0], true),
97
- axis.dataToCoord(interval[1], true)
98
- ]
99
- };
100
- });
77
+ /**
78
+ * @override
79
+ */
80
+ updateVisual: function (axisModel, ecModel, api, payload) {
81
+ this._brushController && this._brushController
82
+ .updateCovers(getCoverInfoList(axisModel));
83
+ },
101
84
 
102
- var extent = axis.getExtent();
85
+ _refreshBrushController: function (
86
+ builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api
87
+ ) {
88
+ // After filtering, axis may change, select area needs to be update.
89
+ var extent = axisModel.axis.getExtent();
103
90
  var extentLen = extent[1] - extent[0];
104
91
  var extra = Math.min(30, Math.abs(extentLen) * 0.1); // Arbitrary value.
105
92
 
@@ -122,21 +109,22 @@
122
109
  })
123
110
  .setPanels([{
124
111
  panelId: 'pl',
125
- rect: rect
112
+ clipPath: brushHelper.makeRectPanelClipPath(rect),
113
+ isTargetByCursor: brushHelper.makeRectIsTargetByCursor(rect, api, coordSysModel),
114
+ getLinearBrushOtherExtent: brushHelper.makeLinearBrushOtherExtent(rect, 0)
126
115
  }])
127
116
  .enableBrush({
128
117
  brushType: 'lineX',
129
118
  brushStyle: areaSelectStyle,
130
119
  removeOnClick: true
131
120
  })
132
- .updateCovers(coverInfoList);
121
+ .updateCovers(getCoverInfoList(axisModel));
133
122
  },
134
123
 
135
124
  _onBrush: function (coverInfoList, opt) {
136
125
  // Do not cache these object, because the mey be changed.
137
126
  var axisModel = this.axisModel;
138
127
  var axis = axisModel.axis;
139
-
140
128
  var intervals = zrUtil.map(coverInfoList, function (coverInfo) {
141
129
  return [
142
130
  axis.coordToData(coverInfo.range[0], true),
@@ -172,4 +160,24 @@
172
160
  )[0] === axisModel;
173
161
  }
174
162
 
163
+ function getCoverInfoList(axisModel) {
164
+ var axis = axisModel.axis;
165
+ return zrUtil.map(axisModel.activeIntervals, function (interval) {
166
+ return {
167
+ brushType: 'lineX',
168
+ panelId: 'pl',
169
+ range: [
170
+ axis.dataToCoord(interval[0], true),
171
+ axis.dataToCoord(interval[1], true)
172
+ ]
173
+ };
174
+ });
175
+ }
176
+
177
+ function getCoordSysModel(axisModel, ecModel) {
178
+ return ecModel.getComponent(
179
+ 'parallel', axisModel.get('parallelIndex')
180
+ );
181
+ }
182
+
175
183
  module.exports = AxisView;
@@ -76,7 +76,7 @@
76
76
 
77
77
  handle: {
78
78
  show: false,
79
- icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', // jshint ignore:line
79
+ icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z', // jshint ignore:line
80
80
  size: 45,
81
81
  // handle margin is from symbol center to axis, which is stable when circular move.
82
82
  margin: 50,
@@ -194,22 +194,26 @@
194
194
  */
195
195
  createPointerEl: function (group, elOption, axisModel, axisPointerModel) {
196
196
  var pointerOption = elOption.pointer;
197
- var pointerEl = get(group).pointerEl = new graphic[pointerOption.type](
198
- clone(elOption.pointer)
199
- );
200
- group.add(pointerEl);
197
+ if (pointerOption) {
198
+ var pointerEl = get(group).pointerEl = new graphic[pointerOption.type](
199
+ clone(elOption.pointer)
200
+ );
201
+ group.add(pointerEl);
202
+ }
201
203
  },
202
204
 
203
205
  /**
204
206
  * @protected
205
207
  */
206
208
  createLabelEl: function (group, elOption, axisModel, axisPointerModel) {
207
- var labelEl = get(group).labelEl = new graphic.Rect(
208
- clone(elOption.label)
209
- );
209
+ if (elOption.label) {
210
+ var labelEl = get(group).labelEl = new graphic.Rect(
211
+ clone(elOption.label)
212
+ );
210
213
 
211
- group.add(labelEl);
212
- updateLabelShowHide(labelEl, axisPointerModel);
214
+ group.add(labelEl);
215
+ updateLabelShowHide(labelEl, axisPointerModel);
216
+ }
213
217
  },
214
218
 
215
219
  /**
@@ -354,16 +358,17 @@
354
358
  }
355
359
 
356
360
  var payloadInfo = this._payloadInfo;
357
- var payload = {
361
+ var axisModel = this._axisModel;
362
+ this._api.dispatchAction({
358
363
  type: 'updateAxisPointer',
359
364
  x: payloadInfo.cursorPoint[0],
360
365
  y: payloadInfo.cursorPoint[1],
361
366
  tooltipOption: payloadInfo.tooltipOption,
362
- highDownKey: 'axisPointerHandle'
363
- };
364
- var axis = this._axisModel.axis;
365
- payload[axis.dim + 'AxisId'] = this._axisModel.id;
366
- this._api.dispatchAction(payload);
367
+ axesInfo: [{
368
+ axisDim: axisModel.axis.dim,
369
+ axisIndex: axisModel.componentIndex
370
+ }]
371
+ });
367
372
  },
368
373
 
369
374
  /**
@@ -19,12 +19,15 @@
19
19
  var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent();
20
20
  var pixelValue = axis.toGlobalCoord(axis.dataToCoord(value, true));
21
21
 
22
- var elStyle = viewHelper.buildElStyle(axisPointerModel);
23
- var pointerOption = pointerShapeBuilder[axisPointerType](axis, pixelValue, otherExtent, elStyle);
24
- pointerOption.style = elStyle;
25
-
26
- elOption.graphicKey = pointerOption.type;
27
- elOption.pointer = pointerOption;
22
+ if (axisPointerType && axisPointerType !== 'none') {
23
+ var elStyle = viewHelper.buildElStyle(axisPointerModel);
24
+ var pointerOption = pointerShapeBuilder[axisPointerType](
25
+ axis, pixelValue, otherExtent, elStyle
26
+ );
27
+ pointerOption.style = elStyle;
28
+ elOption.graphicKey = pointerOption.type;
29
+ elOption.pointer = pointerOption;
30
+ }
28
31
 
29
32
  var layoutInfo = cartesianAxisHelper.layout(grid.model, axisModel);
30
33
  viewHelper.buildCartesianSingleLabelElOption(
@@ -28,14 +28,16 @@
28
28
  var coordValue;
29
29
  coordValue = axis['dataTo' + formatUtil.capitalFirst(axis.dim)](value);
30
30
 
31
- var elStyle = viewHelper.buildElStyle(axisPointerModel);
32
- var pointerOption = pointerShapeBuilder[axisPointerModel.get('type')](
33
- axis, polar, coordValue, otherExtent, elStyle
34
- );
35
- pointerOption.style = elStyle;
36
-
37
- elOption.graphicKey = pointerOption.type;
38
- elOption.pointer = pointerOption;
31
+ var axisPointerType = axisPointerModel.get('type');
32
+ if (axisPointerType && axisPointerType !== 'none') {
33
+ var elStyle = viewHelper.buildElStyle(axisPointerModel);
34
+ var pointerOption = pointerShapeBuilder[axisPointerType](
35
+ axis, polar, coordValue, otherExtent, elStyle
36
+ );
37
+ pointerOption.style = elStyle;
38
+ elOption.graphicKey = pointerOption.type;
39
+ elOption.pointer = pointerOption;
40
+ }
39
41
 
40
42
  var labelMargin = axisPointerModel.get('label.margin');
41
43
  var labelPos = getLabelPosition(value, axisModel, axisPointerModel, polar, labelMargin);
@@ -20,14 +20,18 @@
20
20
  var coordSys = axis.coordinateSystem;
21
21
  var otherExtent = getGlobalExtent(coordSys, 1 - getPointDimIndex(axis));
22
22
  var pixelValue = coordSys.dataToPoint(value)[0];
23
- var elStyle = viewHelper.buildElStyle(axisPointerModel);
24
- var pointerOption = pointerShapeBuilder[axisPointerModel.get('type')](
25
- axis, pixelValue, otherExtent, elStyle
26
- );
27
- pointerOption.style = elStyle;
28
23
 
29
- elOption.graphicKey = pointerOption.type;
30
- elOption.pointer = pointerOption;
24
+ var axisPointerType = axisPointerModel.get('type');
25
+ if (axisPointerType && axisPointerType !== 'none') {
26
+ var elStyle = viewHelper.buildElStyle(axisPointerModel);
27
+ var pointerOption = pointerShapeBuilder[axisPointerType](
28
+ axis, pixelValue, otherExtent, elStyle
29
+ );
30
+ pointerOption.style = elStyle;
31
+
32
+ elOption.graphicKey = pointerOption.type;
33
+ elOption.pointer = pointerOption;
34
+ }
31
35
 
32
36
  var layoutInfo = singleAxisHelper.layout(axisModel);
33
37
  viewHelper.buildCartesianSingleLabelElOption(