echarts 4.5.0 → 4.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 (154) hide show
  1. package/dist/echarts-en.common.js +1790 -774
  2. package/dist/echarts-en.common.min.js +1 -1
  3. package/dist/echarts-en.js +2029 -849
  4. package/dist/echarts-en.js.map +1 -1
  5. package/dist/echarts-en.min.js +1 -1
  6. package/dist/echarts-en.simple.js +1676 -691
  7. package/dist/echarts-en.simple.min.js +1 -1
  8. package/dist/echarts.common.js +1790 -774
  9. package/dist/echarts.common.min.js +1 -1
  10. package/dist/echarts.js +2029 -849
  11. package/dist/echarts.js.map +1 -1
  12. package/dist/echarts.min.js +1 -1
  13. package/dist/echarts.simple.js +1676 -691
  14. package/dist/echarts.simple.min.js +1 -1
  15. package/lib/chart/bar/BarView.js +11 -1
  16. package/lib/chart/bar/BaseBarSeries.js +3 -1
  17. package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
  18. package/lib/chart/funnel/FunnelSeries.js +15 -5
  19. package/lib/chart/gauge/GaugeSeries.js +0 -2
  20. package/lib/chart/graph/GraphSeries.js +9 -4
  21. package/lib/chart/graph/GraphView.js +28 -8
  22. package/lib/chart/heatmap/HeatmapView.js +4 -4
  23. package/lib/chart/helper/createListFromArray.js +14 -8
  24. package/lib/chart/helper/whiskerBoxCommon.js +22 -16
  25. package/lib/chart/line/LineSeries.js +3 -1
  26. package/lib/chart/line/LineView.js +8 -2
  27. package/lib/chart/map/MapSeries.js +8 -1
  28. package/lib/chart/pie/PieSeries.js +27 -6
  29. package/lib/chart/pie/PieView.js +1 -1
  30. package/lib/chart/pie/labelLayout.js +102 -19
  31. package/lib/chart/pie/pieLayout.js +19 -7
  32. package/lib/chart/radar/RadarSeries.js +3 -3
  33. package/lib/chart/sankey/SankeyView.js +28 -9
  34. package/lib/chart/scatter/ScatterSeries.js +3 -1
  35. package/lib/chart/themeRiver/ThemeRiverSeries.js +3 -3
  36. package/lib/chart/tree/TreeSeries.js +15 -1
  37. package/lib/component/axis/AngleAxisView.js +64 -7
  38. package/lib/component/axis/AxisBuilder.js +63 -24
  39. package/lib/component/axis/CartesianAxisView.js +55 -11
  40. package/lib/component/axis/RadiusAxisView.js +36 -4
  41. package/lib/component/dataZoom/SliderZoomView.js +4 -10
  42. package/lib/component/helper/BrushController.js +33 -43
  43. package/lib/component/legend/LegendModel.js +3 -3
  44. package/lib/component/legend/LegendView.js +17 -13
  45. package/lib/component/toolbox/ToolboxView.js +5 -1
  46. package/lib/component/toolbox/feature/MagicType.js +19 -14
  47. package/lib/coord/Axis.js +30 -2
  48. package/lib/coord/axisDefault.js +21 -2
  49. package/lib/data/DataDimensionInfo.js +157 -0
  50. package/lib/data/List.js +25 -19
  51. package/lib/data/Tree.js +2 -1
  52. package/lib/data/helper/completeDimensions.js +43 -32
  53. package/lib/data/helper/createDimensions.js +2 -0
  54. package/lib/data/helper/sourceHelper.js +214 -114
  55. package/lib/echarts.js +2 -2
  56. package/lib/layout/barGrid.js +2 -3
  57. package/lib/model/Series.js +3 -3
  58. package/lib/model/referHelper.js +40 -12
  59. package/lib/scale/Interval.js +87 -2
  60. package/lib/scale/Log.js +9 -2
  61. package/lib/scale/helper.js +1 -43
  62. package/lib/theme/dark.js +3 -0
  63. package/lib/util/graphic.js +1 -2
  64. package/lib/visual/LegendVisualProvider.js +75 -0
  65. package/lib/visual/dataColor.js +2 -12
  66. package/lib/visual/seriesColor.js +15 -7
  67. package/map/json/province/tianjin.json +1 -1
  68. package/package.json +3 -2
  69. package/src/chart/bar/BarView.js +12 -2
  70. package/src/chart/bar/BaseBarSeries.js +1 -1
  71. package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
  72. package/src/chart/funnel/FunnelSeries.js +11 -4
  73. package/src/chart/gauge/GaugeSeries.js +0 -1
  74. package/src/chart/graph/GraphSeries.js +8 -3
  75. package/src/chart/graph/GraphView.js +26 -8
  76. package/src/chart/heatmap/HeatmapView.js +4 -4
  77. package/src/chart/helper/createListFromArray.js +13 -8
  78. package/src/chart/helper/whiskerBoxCommon.js +21 -16
  79. package/src/chart/line/LineSeries.js +1 -1
  80. package/src/chart/line/LineView.js +6 -1
  81. package/src/chart/map/MapSeries.js +5 -1
  82. package/src/chart/pie/PieSeries.js +26 -5
  83. package/src/chart/pie/PieView.js +1 -1
  84. package/src/chart/pie/labelLayout.js +114 -22
  85. package/src/chart/pie/pieLayout.js +20 -7
  86. package/src/chart/radar/RadarSeries.js +5 -3
  87. package/src/chart/sankey/SankeyView.js +26 -9
  88. package/src/chart/scatter/ScatterSeries.js +1 -1
  89. package/src/chart/themeRiver/ThemeRiverSeries.js +4 -3
  90. package/src/chart/tree/TreeSeries.js +12 -1
  91. package/src/component/axis/AngleAxisView.js +75 -7
  92. package/src/component/axis/AxisBuilder.js +78 -33
  93. package/src/component/axis/CartesianAxisView.js +58 -11
  94. package/src/component/axis/RadiusAxisView.js +37 -4
  95. package/src/component/dataZoom/SliderZoomView.js +4 -9
  96. package/src/component/helper/BrushController.js +40 -47
  97. package/src/component/legend/LegendModel.js +3 -3
  98. package/src/component/legend/LegendView.js +18 -12
  99. package/src/component/toolbox/ToolboxView.js +5 -0
  100. package/src/component/toolbox/feature/MagicType.js +18 -13
  101. package/src/coord/Axis.js +29 -2
  102. package/src/coord/axisDefault.js +25 -1
  103. package/src/data/DataDimensionInfo.js +135 -0
  104. package/src/data/List.js +29 -16
  105. package/src/data/Tree.js +3 -1
  106. package/src/data/helper/completeDimensions.js +49 -30
  107. package/src/data/helper/createDimensions.js +2 -0
  108. package/src/data/helper/sourceHelper.js +216 -124
  109. package/src/echarts.js +2 -2
  110. package/src/layout/barGrid.js +6 -3
  111. package/src/model/Series.js +3 -3
  112. package/src/model/referHelper.js +34 -11
  113. package/src/scale/Interval.js +84 -4
  114. package/src/scale/Log.js +9 -2
  115. package/src/scale/helper.js +1 -39
  116. package/src/theme/dark.js +3 -0
  117. package/src/util/graphic.js +1 -2
  118. package/src/visual/LegendVisualProvider.js +55 -0
  119. package/src/visual/dataColor.js +0 -13
  120. package/src/visual/seriesColor.js +13 -7
  121. package/theme/azul.js +163 -0
  122. package/theme/bee-inspired.js +178 -0
  123. package/theme/blue.js +178 -0
  124. package/theme/caravan.js +178 -0
  125. package/theme/carp.js +163 -0
  126. package/theme/cool.js +180 -0
  127. package/theme/dark-blue.js +168 -0
  128. package/theme/dark-bold.js +168 -0
  129. package/theme/dark-digerati.js +168 -0
  130. package/theme/dark-fresh-cut.js +168 -0
  131. package/theme/dark-mushroom.js +168 -0
  132. package/theme/dark.js +69 -62
  133. package/theme/eduardo.js +178 -0
  134. package/theme/forest.js +163 -0
  135. package/theme/fresh-cut.js +163 -0
  136. package/theme/fruit.js +178 -0
  137. package/theme/gray.js +220 -0
  138. package/theme/green.js +222 -0
  139. package/theme/helianthus.js +263 -0
  140. package/theme/infographic.js +72 -57
  141. package/theme/inspired.js +163 -0
  142. package/theme/jazz.js +163 -0
  143. package/theme/london.js +163 -0
  144. package/theme/macarons.js +80 -57
  145. package/theme/macarons2.js +251 -0
  146. package/theme/mint.js +155 -0
  147. package/theme/red-velvet.js +163 -0
  148. package/theme/red.js +225 -0
  149. package/theme/roma.js +55 -22
  150. package/theme/royal.js +163 -0
  151. package/theme/sakura.js +140 -0
  152. package/theme/shine.js +52 -45
  153. package/theme/tech-blue.js +180 -0
  154. package/theme/vintage.js +37 -23
@@ -24,6 +24,7 @@ var retrieve = _util.retrieve;
24
24
  var defaults = _util.defaults;
25
25
  var extend = _util.extend;
26
26
  var each = _util.each;
27
+ var map = _util.map;
27
28
 
28
29
  var formatUtil = require("../../util/format");
29
30
 
@@ -248,9 +249,10 @@ var builders = {
248
249
  axisTickLabel: function () {
249
250
  var axisModel = this.axisModel;
250
251
  var opt = this.opt;
251
- var tickEls = buildAxisTick(this, axisModel, opt);
252
+ var ticksEls = buildAxisMajorTicks(this, axisModel, opt);
252
253
  var labelEls = buildAxisLabel(this, axisModel, opt);
253
- fixMinMaxLabelShow(axisModel, labelEls, tickEls);
254
+ fixMinMaxLabelShow(axisModel, labelEls, ticksEls);
255
+ buildAxisMinorTicks(this, axisModel, opt);
254
256
  },
255
257
 
256
258
  /**
@@ -519,38 +521,27 @@ function isNameLocationCenter(nameLocation) {
519
521
  return nameLocation === 'middle' || nameLocation === 'center';
520
522
  }
521
523
 
522
- function buildAxisTick(axisBuilder, axisModel, opt) {
523
- var axis = axisModel.axis;
524
-
525
- if (!axisModel.get('axisTick.show') || axis.scale.isBlank()) {
526
- return;
527
- }
528
-
529
- var tickModel = axisModel.getModel('axisTick');
530
- var lineStyleModel = tickModel.getModel('lineStyle');
531
- var tickLen = tickModel.get('length');
532
- var ticksCoords = axis.getTicksCoords();
524
+ function createTicks(ticksCoords, tickTransform, tickEndCoord, tickLineStyle, aniid) {
525
+ var tickEls = [];
533
526
  var pt1 = [];
534
527
  var pt2 = [];
535
- var matrix = axisBuilder._transform;
536
- var tickEls = [];
537
528
 
538
529
  for (var i = 0; i < ticksCoords.length; i++) {
539
530
  var tickCoord = ticksCoords[i].coord;
540
531
  pt1[0] = tickCoord;
541
532
  pt1[1] = 0;
542
533
  pt2[0] = tickCoord;
543
- pt2[1] = opt.tickDirection * tickLen;
534
+ pt2[1] = tickEndCoord;
544
535
 
545
- if (matrix) {
546
- v2ApplyTransform(pt1, pt1, matrix);
547
- v2ApplyTransform(pt2, pt2, matrix);
536
+ if (tickTransform) {
537
+ v2ApplyTransform(pt1, pt1, tickTransform);
538
+ v2ApplyTransform(pt2, pt2, tickTransform);
548
539
  } // Tick line, Not use group transform to have better line draw
549
540
 
550
541
 
551
542
  var tickEl = new graphic.Line({
552
543
  // Id for animation
553
- anid: 'tick_' + ticksCoords[i].tickValue,
544
+ anid: aniid + '_' + ticksCoords[i].tickValue,
554
545
  subPixelOptimize: true,
555
546
  shape: {
556
547
  x1: pt1[0],
@@ -558,19 +549,67 @@ function buildAxisTick(axisBuilder, axisModel, opt) {
558
549
  x2: pt2[0],
559
550
  y2: pt2[1]
560
551
  },
561
- style: defaults(lineStyleModel.getLineStyle(), {
562
- stroke: axisModel.get('axisLine.lineStyle.color')
563
- }),
552
+ style: tickLineStyle,
564
553
  z2: 2,
565
554
  silent: true
566
555
  });
567
- axisBuilder.group.add(tickEl);
568
556
  tickEls.push(tickEl);
569
557
  }
570
558
 
571
559
  return tickEls;
572
560
  }
573
561
 
562
+ function buildAxisMajorTicks(axisBuilder, axisModel, opt) {
563
+ var axis = axisModel.axis;
564
+ var tickModel = axisModel.getModel('axisTick');
565
+
566
+ if (!tickModel.get('show') || axis.scale.isBlank()) {
567
+ return;
568
+ }
569
+
570
+ var lineStyleModel = tickModel.getModel('lineStyle');
571
+ var tickEndCoord = opt.tickDirection * tickModel.get('length');
572
+ var ticksCoords = axis.getTicksCoords();
573
+ var ticksEls = createTicks(ticksCoords, axisBuilder._transform, tickEndCoord, defaults(lineStyleModel.getLineStyle(), {
574
+ stroke: axisModel.get('axisLine.lineStyle.color')
575
+ }), 'ticks');
576
+
577
+ for (var i = 0; i < ticksEls.length; i++) {
578
+ axisBuilder.group.add(ticksEls[i]);
579
+ }
580
+
581
+ return ticksEls;
582
+ }
583
+
584
+ function buildAxisMinorTicks(axisBuilder, axisModel, opt) {
585
+ var axis = axisModel.axis;
586
+ var minorTickModel = axisModel.getModel('minorTick');
587
+
588
+ if (!minorTickModel.get('show') || axis.scale.isBlank()) {
589
+ return;
590
+ }
591
+
592
+ var minorTicksCoords = axis.getMinorTicksCoords();
593
+
594
+ if (!minorTicksCoords.length) {
595
+ return;
596
+ }
597
+
598
+ var lineStyleModel = minorTickModel.getModel('lineStyle');
599
+ var tickEndCoord = opt.tickDirection * minorTickModel.get('length');
600
+ var minorTickLineStyle = defaults(lineStyleModel.getLineStyle(), defaults(axisModel.getModel('axisTick').getLineStyle(), {
601
+ stroke: axisModel.get('axisLine.lineStyle.color')
602
+ }));
603
+
604
+ for (var i = 0; i < minorTicksCoords.length; i++) {
605
+ var minorTicksEls = createTicks(minorTicksCoords[i], axisBuilder._transform, tickEndCoord, minorTickLineStyle, 'minorticks_' + i);
606
+
607
+ for (var k = 0; k < minorTicksEls.length; k++) {
608
+ axisBuilder.group.add(minorTicksEls[k]);
609
+ }
610
+ }
611
+ }
612
+
574
613
  function buildAxisLabel(axisBuilder, axisModel, opt) {
575
614
  var axis = axisModel.axis;
576
615
  var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show'));
@@ -47,14 +47,7 @@ var cartesianAxisHelper = require("../../coord/cartesian/cartesianAxisHelper");
47
47
  * under the License.
48
48
  */
49
49
  var axisBuilderAttrs = ['axisLine', 'axisTickLabel', 'axisName'];
50
- var selfBuilderAttrs = ['splitArea', 'splitLine']; // function getAlignWithLabel(model, axisModel) {
51
- // var alignWithLabel = model.get('alignWithLabel');
52
- // if (alignWithLabel === 'auto') {
53
- // alignWithLabel = axisModel.get('axisTick.alignWithLabel');
54
- // }
55
- // return alignWithLabel;
56
- // }
57
-
50
+ var selfBuilderAttrs = ['splitArea', 'splitLine', 'minorSplitLine'];
58
51
  var CartesianAxisView = AxisView.extend({
59
52
  type: 'cartesianAxis',
60
53
  axisPointerClass: 'CartesianAxisPointer',
@@ -114,9 +107,7 @@ var CartesianAxisView = AxisView.extend({
114
107
  tickModel: splitLineModel
115
108
  });
116
109
  var p1 = [];
117
- var p2 = []; // Simple optimization
118
- // Batching the lines if color are the same
119
-
110
+ var p2 = [];
120
111
  var lineStyle = lineStyleModel.getLineStyle();
121
112
 
122
113
  for (var i = 0; i < ticksCoords.length; i++) {
@@ -154,6 +145,59 @@ var CartesianAxisView = AxisView.extend({
154
145
  }
155
146
  },
156
147
 
148
+ /**
149
+ * @param {module:echarts/coord/cartesian/AxisModel} axisModel
150
+ * @param {module:echarts/coord/cartesian/GridModel} gridModel
151
+ * @private
152
+ */
153
+ _minorSplitLine: function (axisModel, gridModel) {
154
+ var axis = axisModel.axis;
155
+ var minorSplitLineModel = axisModel.getModel('minorSplitLine');
156
+ var lineStyleModel = minorSplitLineModel.getModel('lineStyle');
157
+ var gridRect = gridModel.coordinateSystem.getRect();
158
+ var isHorizontal = axis.isHorizontal();
159
+ var minorTicksCoords = axis.getMinorTicksCoords();
160
+
161
+ if (!minorTicksCoords.length) {
162
+ return;
163
+ }
164
+
165
+ var p1 = [];
166
+ var p2 = [];
167
+ var lineStyle = lineStyleModel.getLineStyle();
168
+
169
+ for (var i = 0; i < minorTicksCoords.length; i++) {
170
+ for (var k = 0; k < minorTicksCoords[i].length; k++) {
171
+ var tickCoord = axis.toGlobalCoord(minorTicksCoords[i][k].coord);
172
+
173
+ if (isHorizontal) {
174
+ p1[0] = tickCoord;
175
+ p1[1] = gridRect.y;
176
+ p2[0] = tickCoord;
177
+ p2[1] = gridRect.y + gridRect.height;
178
+ } else {
179
+ p1[0] = gridRect.x;
180
+ p1[1] = tickCoord;
181
+ p2[0] = gridRect.x + gridRect.width;
182
+ p2[1] = tickCoord;
183
+ }
184
+
185
+ this._axisGroup.add(new graphic.Line({
186
+ anid: 'minor_line_' + minorTicksCoords[i][k].tickValue,
187
+ subPixelOptimize: true,
188
+ shape: {
189
+ x1: p1[0],
190
+ y1: p1[1],
191
+ x2: p2[0],
192
+ y2: p2[1]
193
+ },
194
+ style: lineStyle,
195
+ silent: true
196
+ }));
197
+ }
198
+ }
199
+ },
200
+
157
201
  /**
158
202
  * @param {module:echarts/coord/cartesian/AxisModel} axisModel
159
203
  * @param {module:echarts/coord/cartesian/GridModel} gridModel
@@ -45,7 +45,7 @@ var AxisView = require("./AxisView");
45
45
  * under the License.
46
46
  */
47
47
  var axisBuilderAttrs = ['axisLine', 'axisTickLabel', 'axisName'];
48
- var selfBuilderAttrs = ['splitLine', 'splitArea'];
48
+ var selfBuilderAttrs = ['splitLine', 'splitArea', 'minorSplitLine'];
49
49
 
50
50
  var _default = AxisView.extend({
51
51
  type: 'radiusAxis',
@@ -61,6 +61,7 @@ var _default = AxisView.extend({
61
61
  var polar = radiusAxis.polar;
62
62
  var angleAxis = polar.getAngleAxis();
63
63
  var ticksCoords = radiusAxis.getTicksCoords();
64
+ var minorTicksCoords = radiusAxis.getMinorTicksCoords();
64
65
  var axisAngle = angleAxis.getExtent()[0];
65
66
  var radiusExtent = radiusAxis.getExtent();
66
67
  var layout = layoutAxis(polar, radiusAxisModel, axisAngle);
@@ -69,7 +70,7 @@ var _default = AxisView.extend({
69
70
  this.group.add(axisBuilder.getGroup());
70
71
  zrUtil.each(selfBuilderAttrs, function (name) {
71
72
  if (radiusAxisModel.get(name + '.show') && !radiusAxis.scale.isBlank()) {
72
- this['_' + name](radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords);
73
+ this['_' + name](radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords, minorTicksCoords);
73
74
  }
74
75
  }, this);
75
76
  },
@@ -93,8 +94,7 @@ var _default = AxisView.extend({
93
94
  cx: polar.cx,
94
95
  cy: polar.cy,
95
96
  r: ticksCoords[i].coord
96
- },
97
- silent: true
97
+ }
98
98
  }));
99
99
  } // Simple optimization
100
100
  // Batching the lines if color are the same
@@ -111,6 +111,38 @@ var _default = AxisView.extend({
111
111
  }
112
112
  },
113
113
 
114
+ /**
115
+ * @private
116
+ */
117
+ _minorSplitLine: function (radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords, minorTicksCoords) {
118
+ if (!minorTicksCoords.length) {
119
+ return;
120
+ }
121
+
122
+ var minorSplitLineModel = radiusAxisModel.getModel('minorSplitLine');
123
+ var lineStyleModel = minorSplitLineModel.getModel('lineStyle');
124
+ var lines = [];
125
+
126
+ for (var i = 0; i < minorTicksCoords.length; i++) {
127
+ for (var k = 0; k < minorTicksCoords[i].length; k++) {
128
+ lines.push(new graphic.Circle({
129
+ shape: {
130
+ cx: polar.cx,
131
+ cy: polar.cy,
132
+ r: minorTicksCoords[i][k].coord
133
+ }
134
+ }));
135
+ }
136
+ }
137
+
138
+ this.group.add(graphic.mergePath(lines, {
139
+ style: zrUtil.defaults({
140
+ fill: null
141
+ }, lineStyleModel.getLineStyle()),
142
+ silent: true
143
+ }));
144
+ },
145
+
114
146
  /**
115
147
  * @private
116
148
  */
@@ -435,10 +435,6 @@ var SliderZoomView = DataZoomView.extend({
435
435
  draggable: true,
436
436
  cursor: getCursor(this._orient),
437
437
  drift: bind(this._onDragMove, this, 'all'),
438
- onmousemove: function (e) {
439
- // Fot mobile devicem, prevent screen slider on the button.
440
- eventTool.stop(e.event);
441
- },
442
438
  ondragstart: bind(this._showDataInfo, this, true),
443
439
  ondragend: bind(this._onDragEnd, this),
444
440
  onmouseover: bind(this._showDataInfo, this, true),
@@ -469,10 +465,6 @@ var SliderZoomView = DataZoomView.extend({
469
465
  cursor: getCursor(this._orient),
470
466
  draggable: true,
471
467
  drift: bind(this._onDragMove, this, handleIndex),
472
- onmousemove: function (e) {
473
- // Fot mobile devicem, prevent screen slider on the button.
474
- eventTool.stop(e.event);
475
- },
476
468
  ondragend: bind(this._onDragEnd, this),
477
469
  onmouseover: bind(this._showDataInfo, this, true),
478
470
  onmouseout: bind(this._showDataInfo, this, false)
@@ -647,8 +639,10 @@ var SliderZoomView = DataZoomView.extend({
647
639
  handleLabels[0].attr('invisible', !showOrHide);
648
640
  handleLabels[1].attr('invisible', !showOrHide);
649
641
  },
650
- _onDragMove: function (handleIndex, dx, dy) {
651
- this._dragging = true; // Transform dx, dy to bar coordination.
642
+ _onDragMove: function (handleIndex, dx, dy, event) {
643
+ this._dragging = true; // For mobile device, prevent screen slider on the button.
644
+
645
+ eventTool.stop(event.event); // Transform dx, dy to bar coordination.
652
646
 
653
647
  var barTransform = this._displayables.barGroup.getLocalTransform();
654
648
 
@@ -153,12 +153,6 @@ function BrushController(zr) {
153
153
  */
154
154
 
155
155
  this._dragging;
156
- /**
157
- * @private
158
- * @type {Object}
159
- */
160
-
161
- this._lastMouseMovePoint = {};
162
156
  /**
163
157
  * @private
164
158
  * @type {Array}
@@ -200,7 +194,7 @@ function BrushController(zr) {
200
194
  */
201
195
 
202
196
  this._handlers = {};
203
- each(mouseHandlers, function (handler, eventName) {
197
+ each(pointerHandlers, function (handler, eventName) {
204
198
  this._handlers[eventName] = zrUtil.bind(handler, this);
205
199
  }, this);
206
200
  }
@@ -351,9 +345,7 @@ function doEnableBrush(controller, brushOption) {
351
345
  interactionMutex.take(zr, MUTEX_RESOURCE_KEY, controller._uid);
352
346
  }
353
347
 
354
- each(controller._handlers, function (handler, eventName) {
355
- zr.on(eventName, handler);
356
- });
348
+ mountHandlers(zr, controller._handlers);
357
349
  controller._brushType = brushOption.brushType;
358
350
  controller._brushOption = zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true);
359
351
  }
@@ -361,10 +353,20 @@ function doEnableBrush(controller, brushOption) {
361
353
  function doDisableBrush(controller) {
362
354
  var zr = controller._zr;
363
355
  interactionMutex.release(zr, MUTEX_RESOURCE_KEY, controller._uid);
364
- each(controller._handlers, function (handler, eventName) {
356
+ unmountHandlers(zr, controller._handlers);
357
+ controller._brushType = controller._brushOption = null;
358
+ }
359
+
360
+ function mountHandlers(zr, handlers) {
361
+ each(handlers, function (handler, eventName) {
362
+ zr.on(eventName, handler);
363
+ });
364
+ }
365
+
366
+ function unmountHandlers(zr, handlers) {
367
+ each(handlers, function (handler, eventName) {
365
368
  zr.off(eventName, handler);
366
369
  });
367
- controller._brushType = controller._brushOption = null;
368
370
  }
369
371
 
370
372
  function createCover(controller, brushOption) {
@@ -667,8 +669,11 @@ function pointsToRect(points) {
667
669
  }
668
670
 
669
671
  function resetCursor(controller, e, localCursorPoint) {
670
- // Check active
671
- if (!controller._brushType) {
672
+ if ( // Check active
673
+ !controller._brushType // resetCursor should be always called when mouse is in zr area,
674
+ // but not called when mouse is out of zr area to avoid bad influence
675
+ // if `mousemove`, `mouseup` are triggered from `document` event.
676
+ || isOutsideZrArea(controller, e)) {
672
677
  return;
673
678
  }
674
679
 
@@ -758,7 +763,7 @@ function determineBrushType(brushType, panel) {
758
763
  return brushType;
759
764
  }
760
765
 
761
- var mouseHandlers = {
766
+ var pointerHandlers = {
762
767
  mousedown: function (e) {
763
768
  if (this._dragging) {
764
769
  // In case some browser do not support globalOut,
@@ -777,10 +782,9 @@ var mouseHandlers = {
777
782
  }
778
783
  },
779
784
  mousemove: function (e) {
780
- var lastPoint = this._lastMouseMovePoint;
781
- lastPoint.x = e.offsetX;
782
- lastPoint.y = e.offsetY;
783
- var localCursorPoint = this.group.transformCoordToLocal(lastPoint.x, lastPoint.y);
785
+ var x = e.offsetX;
786
+ var y = e.offsetY;
787
+ var localCursorPoint = this.group.transformCoordToLocal(x, y);
784
788
  resetCursor(this, e, localCursorPoint);
785
789
 
786
790
  if (this._dragging) {
@@ -791,34 +795,15 @@ var mouseHandlers = {
791
795
  },
792
796
  mouseup: function (e) {
793
797
  handleDragEnd(this, e);
794
- },
795
- globalout: function (e) {
796
- handleDragEnd(this, e, true);
797
798
  }
798
799
  };
799
800
 
800
- function handleDragEnd(controller, e, isGlobalOut) {
801
+ function handleDragEnd(controller, e) {
801
802
  if (controller._dragging) {
802
- // Just be worried about bring some side effect to the world
803
- // out of echarts, we do not `preventDefault` for globalout.
804
- !isGlobalOut && preventDefault(e);
805
- var pointerX = e.offsetX;
806
- var pointerY = e.offsetY;
807
- var lastPoint = controller._lastMouseMovePoint;
808
-
809
- if (isGlobalOut) {
810
- pointerX = lastPoint.x;
811
- pointerY = lastPoint.y;
812
- }
813
-
814
- var localCursorPoint = controller.group.transformCoordToLocal(pointerX, pointerY); // FIXME
815
- // Here `e` is used only in `onIrrelevantElement` finally. And it's OK
816
- // that pass the `e` of `globalout` to `onIrrelevantElement`. But it is
817
- // not a good design of these interfaces. However, we do not refactor
818
- // these code now because the implementation of `onIrrelevantElement`
819
- // need to be discussed and probably be changed in future, becuase it
820
- // slows down the performance of zrender in some cases.
821
-
803
+ preventDefault(e);
804
+ var x = e.offsetX;
805
+ var y = e.offsetY;
806
+ var localCursorPoint = controller.group.transformCoordToLocal(x, y);
822
807
  var eventParams = updateCoverByMouse(controller, e, localCursorPoint, true);
823
808
  controller._dragging = false;
824
809
  controller._track = [];
@@ -827,6 +812,11 @@ function handleDragEnd(controller, e, isGlobalOut) {
827
812
  eventParams && trigger(controller, eventParams);
828
813
  }
829
814
  }
815
+
816
+ function isOutsideZrArea(controller, x, y) {
817
+ var zr = controller._zr;
818
+ return x < 0 || x > zr.getWidth() || y < 0 || y > zr.getHeight();
819
+ }
830
820
  /**
831
821
  * key: brushType
832
822
  * @type {Object}
@@ -131,9 +131,9 @@ var LegendModel = echarts.extendComponentModel({
131
131
  availableNames.push(seriesName);
132
132
  var isPotential;
133
133
 
134
- if (seriesModel.legendDataProvider) {
135
- var data = seriesModel.legendDataProvider();
136
- var names = data.mapArray(data.getName);
134
+ if (seriesModel.legendVisualProvider) {
135
+ var provider = seriesModel.legendVisualProvider;
136
+ var names = provider.getAllNames();
137
137
 
138
138
  if (!ecModel.isSeriesFiltered(seriesModel)) {
139
139
  availableNames = availableNames.concat(names);
@@ -191,7 +191,7 @@ var _default = echarts.extendComponentView({
191
191
  if (legendDrawnMap.get(name)) {
192
192
  // Have been drawed
193
193
  return;
194
- } // Series legend
194
+ } // Legend to control series.
195
195
 
196
196
 
197
197
  if (seriesModel) {
@@ -216,32 +216,32 @@ var _default = echarts.extendComponentView({
216
216
 
217
217
  var itemGroup = this._createItem(name, dataIndex, itemModel, legendModel, legendSymbolType, symbolType, itemAlign, color, borderColor, selectMode);
218
218
 
219
- itemGroup.on('click', curry(dispatchSelectAction, name, api)).on('mouseover', curry(dispatchHighlightAction, seriesModel.name, null, api, excludeSeriesId)).on('mouseout', curry(dispatchDownplayAction, seriesModel.name, null, api, excludeSeriesId));
219
+ itemGroup.on('click', curry(dispatchSelectAction, name, null, api, excludeSeriesId)).on('mouseover', curry(dispatchHighlightAction, seriesModel.name, null, api, excludeSeriesId)).on('mouseout', curry(dispatchDownplayAction, seriesModel.name, null, api, excludeSeriesId));
220
220
  legendDrawnMap.set(name, true);
221
221
  } else {
222
- // Data legend of pie, funnel
222
+ // Legend to control data. In pie and funnel.
223
223
  ecModel.eachRawSeries(function (seriesModel) {
224
224
  // In case multiple series has same data name
225
225
  if (legendDrawnMap.get(name)) {
226
226
  return;
227
227
  }
228
228
 
229
- if (seriesModel.legendDataProvider) {
230
- var data = seriesModel.legendDataProvider();
231
- var idx = data.indexOfName(name);
229
+ if (seriesModel.legendVisualProvider) {
230
+ var provider = seriesModel.legendVisualProvider;
232
231
 
233
- if (idx < 0) {
232
+ if (!provider.containName(name)) {
234
233
  return;
235
234
  }
236
235
 
237
- var color = data.getItemVisual(idx, 'color');
238
- var borderColor = data.getItemVisual(idx, 'borderColor');
236
+ var idx = provider.indexOfName(name);
237
+ var color = provider.getItemVisual(idx, 'color');
238
+ var borderColor = provider.getItemVisual(idx, 'borderColor');
239
239
  var legendSymbolType = 'roundRect';
240
240
 
241
241
  var itemGroup = this._createItem(name, dataIndex, itemModel, legendModel, legendSymbolType, null, itemAlign, color, borderColor, selectMode); // FIXME: consider different series has items with the same name.
242
242
 
243
243
 
244
- itemGroup.on('click', curry(dispatchSelectAction, name, api)) // Should not specify the series name, consider legend controls
244
+ itemGroup.on('click', curry(dispatchSelectAction, null, name, api, excludeSeriesId)) // Should not specify the series name, consider legend controls
245
245
  // more than one pie series.
246
246
  .on('mouseover', curry(dispatchHighlightAction, null, name, api, excludeSeriesId)).on('mouseout', curry(dispatchDownplayAction, null, name, api, excludeSeriesId));
247
247
  legendDrawnMap.set(name, true);
@@ -442,11 +442,15 @@ function setSymbolStyle(symbol, symbolType, legendModelItemStyle, borderColor, i
442
442
  return symbol.setStyle(itemStyle);
443
443
  }
444
444
 
445
- function dispatchSelectAction(name, api) {
445
+ function dispatchSelectAction(seriesName, dataName, api, excludeSeriesId) {
446
+ // downplay before unselect
447
+ dispatchDownplayAction(seriesName, dataName, api, excludeSeriesId);
446
448
  api.dispatchAction({
447
449
  type: 'legendToggleSelect',
448
- name: name
449
- });
450
+ name: seriesName != null ? seriesName : dataName
451
+ }); // highlight after select
452
+
453
+ dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId);
450
454
  }
451
455
 
452
456
  function dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId) {
@@ -78,7 +78,11 @@ var _default = echarts.extendComponentView({
78
78
  var oldName = featureNames[oldIndex];
79
79
  var featureOpt = featureOpts[featureName];
80
80
  var featureModel = new Model(featureOpt, toolboxModel, toolboxModel.ecModel);
81
- var feature;
81
+ var feature; // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
82
+
83
+ if (payload && payload.newTitle != null) {
84
+ featureOpt.title = payload.newTitle;
85
+ }
82
86
 
83
87
  if (featureName && !oldName) {
84
88
  // Create
@@ -45,6 +45,7 @@ var featureManager = require("../featureManager");
45
45
  * under the License.
46
46
  */
47
47
  var magicTypeLang = lang.toolbox.magicType;
48
+ var INNER_STACK_KEYWORD = '__ec_magicType_stack__';
48
49
 
49
50
  function MagicType(model) {
50
51
  this.model = model;
@@ -58,9 +59,8 @@ MagicType.defaultOption = {
58
59
  /* eslint-disable */
59
60
  line: 'M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4',
60
61
  bar: 'M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7',
61
- stack: 'M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z',
62
- // jshint ignore:line
63
- tiled: 'M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z'
62
+ stack: 'M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z' // jshint ignore:line
63
+
64
64
  /* eslint-enable */
65
65
 
66
66
  },
@@ -111,23 +111,18 @@ var seriesOptGenreator = {
111
111
  }
112
112
  },
113
113
  'stack': function (seriesType, seriesId, seriesModel, model) {
114
+ var isStack = seriesModel.get('stack') === INNER_STACK_KEYWORD;
115
+
114
116
  if (seriesType === 'line' || seriesType === 'bar') {
117
+ model.setIconStatus('stack', isStack ? 'normal' : 'emphasis');
115
118
  return zrUtil.merge({
116
119
  id: seriesId,
117
- stack: '__ec_magicType_stack__'
120
+ stack: isStack ? '' : INNER_STACK_KEYWORD
118
121
  }, model.get('option.stack') || {}, true);
119
122
  }
120
- },
121
- 'tiled': function (seriesType, seriesId, seriesModel, model) {
122
- if (seriesType === 'line' || seriesType === 'bar') {
123
- return zrUtil.merge({
124
- id: seriesId,
125
- stack: ''
126
- }, model.get('option.tiled') || {}, true);
127
- }
128
123
  }
129
124
  };
130
- var radioTypes = [['line', 'bar'], ['stack', 'tiled']];
125
+ var radioTypes = [['line', 'bar'], ['stack']];
131
126
 
132
127
  proto.onclick = function (ecModel, api, type) {
133
128
  var model = this.model;
@@ -192,10 +187,20 @@ proto.onclick = function (ecModel, api, type) {
192
187
  seriesIndex: seriesIndex
193
188
  }
194
189
  }, generateNewSeriesTypes);
190
+ var newTitle; // Change title of stack
191
+
192
+ if (type === 'stack') {
193
+ var isStack = newOption.series && newOption.series[0] && newOption.series[0].stack === INNER_STACK_KEYWORD;
194
+ newTitle = isStack ? zrUtil.merge({
195
+ stack: magicTypeLang.title.tiled
196
+ }, magicTypeLang.title) : zrUtil.clone(magicTypeLang.title);
197
+ }
198
+
195
199
  api.dispatchAction({
196
200
  type: 'changeMagicType',
197
201
  currentType: type,
198
- newOption: newOption
202
+ newOption: newOption,
203
+ newTitle: newTitle
199
204
  });
200
205
  };
201
206