echarts 3.7.1 → 3.7.2

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 (94) hide show
  1. package/dist/echarts-en.js +77756 -0
  2. package/dist/echarts-en.min.js +38 -0
  3. package/dist/echarts.common-en.js +50169 -0
  4. package/dist/echarts.common-en.min.js +30 -0
  5. package/dist/echarts.common.js +1408 -1186
  6. package/dist/echarts.common.min.js +14 -14
  7. package/dist/echarts.js +1572 -1278
  8. package/dist/echarts.min.js +22 -22
  9. package/dist/echarts.simple-en.js +34988 -0
  10. package/dist/echarts.simple-en.min.js +27 -0
  11. package/dist/echarts.simple.js +1152 -994
  12. package/dist/echarts.simple.min.js +11 -11
  13. package/index.blank.js +4 -0
  14. package/lib/chart/bar/BaseBarSeries.js +3 -3
  15. package/lib/chart/candlestick/candlestickLayout.js +26 -1
  16. package/lib/chart/graph/forceHelper.js +5 -0
  17. package/lib/chart/graph/forceLayout.js +0 -1
  18. package/lib/chart/helper/whiskerBoxCommon.js +6 -1
  19. package/lib/chart/line/LineView.js +14 -2
  20. package/lib/chart/lines/LinesView.js +22 -7
  21. package/lib/chart/pie/PieSeries.js +3 -1
  22. package/lib/chart/pie/PieView.js +1 -1
  23. package/lib/chart/treemap/TreemapView.js +5 -28
  24. package/lib/component/axis/AxisBuilder.js +249 -178
  25. package/lib/component/axis/CartesianAxisView.js +15 -3
  26. package/lib/component/axis/ParallelAxisView.js +1 -1
  27. package/lib/component/axis/RadiusAxisView.js +1 -1
  28. package/lib/component/axis/SingleAxisView.js +8 -2
  29. package/lib/component/helper/RoamController.js +12 -11
  30. package/lib/component/marker/MarkAreaView.js +1 -1
  31. package/lib/component/radar/RadarView.js +1 -1
  32. package/lib/component/toolbox/feature/Brush.js +3 -8
  33. package/lib/component/toolbox/feature/DataView.js +3 -3
  34. package/lib/component/toolbox/feature/DataZoom.js +3 -4
  35. package/lib/component/toolbox/feature/MagicType.js +3 -6
  36. package/lib/component/toolbox/feature/Restore.js +2 -1
  37. package/lib/component/toolbox/feature/SaveAsImage.js +23 -9
  38. package/lib/component/visualMap/ContinuousModel.js +2 -2
  39. package/lib/component/visualMap/ContinuousView.js +3 -3
  40. package/lib/component/visualMap/PiecewiseModel.js +0 -1
  41. package/lib/component/visualMap/VisualMapModel.js +17 -11
  42. package/lib/coord/calendar/Calendar.js +64 -20
  43. package/lib/echarts.js +5 -4
  44. package/lib/lang/cn.js +4 -0
  45. package/lib/lang/default.js +42 -0
  46. package/lib/lang/en.js +42 -0
  47. package/lib/lang.js +42 -0
  48. package/lib/langEN.js +42 -0
  49. package/lib/preprocessor/helper/compatStyle.js +24 -23
  50. package/lib/scale/Time.js +4 -4
  51. package/lib/util/graphic.js +5 -5
  52. package/lib/util/number.js +42 -21
  53. package/lib/visual/VisualMapping.js +3 -3
  54. package/package.json +3 -3
  55. package/rollup.config.js +49 -0
  56. package/src/chart/bar/BaseBarSeries.js +3 -3
  57. package/src/chart/candlestick/candlestickLayout.js +26 -1
  58. package/src/chart/graph/forceHelper.js +5 -0
  59. package/src/chart/graph/forceLayout.js +0 -1
  60. package/src/chart/helper/whiskerBoxCommon.js +6 -2
  61. package/src/chart/line/LineView.js +14 -2
  62. package/src/chart/lines/LinesView.js +22 -7
  63. package/src/chart/pie/PieSeries.js +3 -1
  64. package/src/chart/pie/PieView.js +1 -1
  65. package/src/chart/treemap/TreemapView.js +5 -28
  66. package/src/component/axis/AxisBuilder.js +249 -178
  67. package/src/component/axis/CartesianAxisView.js +15 -3
  68. package/src/component/axis/ParallelAxisView.js +1 -1
  69. package/src/component/axis/RadiusAxisView.js +1 -1
  70. package/src/component/axis/SingleAxisView.js +8 -2
  71. package/src/component/helper/RoamController.js +12 -11
  72. package/src/component/marker/MarkAreaView.js +1 -1
  73. package/src/component/radar/RadarView.js +1 -1
  74. package/src/component/toolbox/feature/Brush.js +3 -8
  75. package/src/component/toolbox/feature/DataView.js +3 -3
  76. package/src/component/toolbox/feature/DataZoom.js +3 -4
  77. package/src/component/toolbox/feature/MagicType.js +3 -6
  78. package/src/component/toolbox/feature/Restore.js +2 -1
  79. package/src/component/toolbox/feature/SaveAsImage.js +23 -10
  80. package/src/component/visualMap/ContinuousModel.js +2 -2
  81. package/src/component/visualMap/ContinuousView.js +3 -3
  82. package/src/component/visualMap/PiecewiseModel.js +0 -1
  83. package/src/component/visualMap/VisualMapModel.js +17 -11
  84. package/src/coord/calendar/Calendar.js +64 -20
  85. package/src/echarts.js +5 -4
  86. package/src/lang.js +43 -0
  87. package/src/langEN.js +43 -0
  88. package/src/preprocessor/helper/compatStyle.js +24 -23
  89. package/src/scale/Time.js +4 -4
  90. package/src/util/graphic.js +5 -5
  91. package/src/util/number.js +42 -21
  92. package/src/visual/VisualMapping.js +3 -3
  93. package/webpack.config.js +21 -7
  94. package/.npmignore +0 -10
package/index.blank.js ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Export echarts as CommonJS module
3
+ */
4
+ module.exports = require('./lib/echarts');
@@ -57,10 +57,10 @@
57
57
  // }
58
58
  // },
59
59
  itemStyle: {
60
- normal: {
60
+ // normal: {
61
61
  // color: '各异'
62
- },
63
- emphasis: {}
62
+ // },
63
+ // emphasis: {}
64
64
  }
65
65
  }
66
66
  });
@@ -34,6 +34,8 @@
34
34
  return;
35
35
  }
36
36
 
37
+ var dataIndex = 0;
38
+
37
39
  data.each([cDim].concat(vDims), function () {
38
40
  var args = arguments;
39
41
  var axisDimVal = args[0];
@@ -67,9 +69,30 @@
67
69
  addBodyEnd(ocHighPoint, 0);
68
70
  addBodyEnd(ocLowPoint, 1);
69
71
 
72
+ var sign;
73
+ if (openVal > closeVal) {
74
+ sign = -1;
75
+ }
76
+ else if (openVal < closeVal) {
77
+ sign = 1;
78
+ }
79
+ else {
80
+ // If close === open, compare with close of last record
81
+ if (dataIndex > 0) {
82
+ sign = data.getItemModel(dataIndex - 1).get()[2]
83
+ <= closeVal
84
+ ? 1
85
+ : -1;
86
+ }
87
+ else {
88
+ // No record of previous, set to be positive
89
+ sign = 1;
90
+ }
91
+ }
92
+
70
93
  data.setItemLayout(idx, {
71
94
  chartLayout: chartLayout,
72
- sign: openVal > closeVal ? -1 : openVal < closeVal ? 1 : 0,
95
+ sign: sign,
73
96
  initBaseline: openVal > closeVal
74
97
  ? ocHighPoint[constDim] : ocLowPoint[constDim], // open point.
75
98
  bodyEnds: bodyEnds,
@@ -77,6 +100,8 @@
77
100
  brushRect: makeBrushRect()
78
101
  });
79
102
 
103
+ ++dataIndex;
104
+
80
105
  function getPoint(val) {
81
106
  var p = [];
82
107
  p[variableDim] = axisDimVal;
@@ -83,6 +83,11 @@
83
83
  vec2.sub(v12, n2.p, n1.p);
84
84
  var d = vec2.len(v12) - e.d;
85
85
  var w = n2.w / (n1.w + n2.w);
86
+
87
+ if (isNaN(w)) {
88
+ w = 0;
89
+ }
90
+
86
91
  vec2.normalize(v12, v12);
87
92
 
88
93
  !n1.fixed && scaleAndAdd(n1.p, n1.p, v12, w * d * friction);
@@ -49,7 +49,6 @@
49
49
 
50
50
  var nodes = nodeData.mapArray('value', function (value, idx) {
51
51
  var point = nodeData.getItemLayout(idx);
52
- // var w = numberUtil.linearMap(value, nodeDataExtent, [0, 50]);
53
52
  var rep = numberUtil.linearMap(value, nodeDataExtent, repulsion);
54
53
  if (isNaN(rep)) {
55
54
  rep = (repulsion[0] + repulsion[1]) / 2;
@@ -54,7 +54,11 @@
54
54
  var data = option.data;
55
55
 
56
56
  addOrdinal && zrUtil.each(data, function (item, index) {
57
- zrUtil.isArray(item) && item.unshift(index);
57
+ if (item.value && zrUtil.isArray(item.value)) {
58
+ item.value.unshift(index);
59
+ } else {
60
+ zrUtil.isArray(item) && item.unshift(index);
61
+ }
58
62
  });
59
63
 
60
64
  var defaultValueDimensions = this.defaultValueDimensions;
@@ -120,3 +124,4 @@
120
124
  seriesModelMixin: seriesModelMixin,
121
125
  viewMixin: viewMixin
122
126
  };
127
+
@@ -53,8 +53,20 @@
53
53
  function getStackedOnPoints(coordSys, data) {
54
54
  var baseAxis = coordSys.getBaseAxis();
55
55
  var valueAxis = coordSys.getOtherAxis(baseAxis);
56
- var valueStart = baseAxis.onZero
57
- ? 0 : valueAxis.scale.getExtent()[0];
56
+
57
+ var valueStart = 0;
58
+ if (!baseAxis.onZero) {
59
+ var extent = valueAxis.scale.getExtent();
60
+ if (extent[0] > 0) {
61
+ // Both positive
62
+ valueStart = extent[0];
63
+ }
64
+ else if (extent[1] < 0) {
65
+ // Both negative
66
+ valueStart = extent[1];
67
+ }
68
+ // If is one positive, and one negative, onZero shall be true
69
+ }
58
70
 
59
71
  var valueDim = valueAxis.dim;
60
72
 
@@ -48,9 +48,13 @@
48
48
  var zr = api.getZr();
49
49
  // Avoid the drag cause ghost shadow
50
50
  // FIXME Better way ?
51
- zr.painter.getLayer(zlevel).clear(true);
51
+ // SVG doesn't support
52
+ var isSvg = zr.painter.getType() === 'svg';
53
+ if (!isSvg) {
54
+ zr.painter.getLayer(zlevel).clear(true);
55
+ }
52
56
  // Config layer with motion blur
53
- if (this._lastZlevel != null) {
57
+ if (this._lastZlevel != null && !isSvg) {
54
58
  zr.configLayer(this._lastZlevel, {
55
59
  motionBlur: false
56
60
  });
@@ -66,10 +70,12 @@
66
70
  notInIndividual && console.warn('Lines with trail effect should have an individual zlevel');
67
71
  }
68
72
 
69
- zr.configLayer(zlevel, {
70
- motionBlur: true,
71
- lastFrameAlpha: Math.max(Math.min(trailLength / 10 + 0.9, 1), 0)
72
- });
73
+ if (!isSvg) {
74
+ zr.configLayer(zlevel, {
75
+ motionBlur: true,
76
+ lastFrameAlpha: Math.max(Math.min(trailLength / 10 + 0.9, 1), 0)
77
+ });
78
+ }
73
79
  }
74
80
 
75
81
  this.group.add(lineDraw.group);
@@ -83,11 +89,20 @@
83
89
  this._lineDraw.updateLayout(seriesModel);
84
90
  // Not use motion when dragging or zooming
85
91
  var zr = api.getZr();
86
- zr.painter.getLayer(this._lastZlevel).clear(true);
92
+ var isSvg = zr.painter.getType() === 'svg';
93
+ if (!isSvg) {
94
+ zr.painter.getLayer(this._lastZlevel).clear(true);
95
+ }
87
96
  },
88
97
 
89
98
  remove: function (ecModel, api) {
90
99
  this._lineDraw && this._lineDraw.remove(api, true);
100
+ // Clear motion when lineDraw is removed
101
+ var zr = api.getZr();
102
+ var isSvg = zr.painter.getType() === 'svg';
103
+ if (!isSvg) {
104
+ zr.painter.getLayer(this._lastZlevel).clear(true);
105
+ }
91
106
  },
92
107
 
93
108
  dispose: function () {}
@@ -89,8 +89,10 @@
89
89
  startAngle: 90,
90
90
  // 最小角度改为0
91
91
  minAngle: 0,
92
- // 选中是扇区偏移量
92
+ // 选中时扇区偏移量
93
93
  selectedOffset: 10,
94
+ // 高亮扇区偏移量
95
+ hoverOffset: 10,
94
96
 
95
97
  // If use strategy to avoid label overlapping
96
98
  avoidLabelOverlap: true,
@@ -168,7 +168,7 @@
168
168
  sector.stopAnimation(true);
169
169
  sector.animateTo({
170
170
  shape: {
171
- r: layout.r + 10
171
+ r: layout.r + seriesModel.get('hoverOffset')
172
172
  }
173
173
  }, 300, 'elasticOut');
174
174
  }
@@ -67,12 +67,6 @@
67
67
  * @private
68
68
  */
69
69
  this._state = 'ready';
70
-
71
- /**
72
- * @private
73
- * @type {boolean}
74
- */
75
- this._mayClick;
76
70
  },
77
71
 
78
72
  /**
@@ -397,8 +391,6 @@
397
391
  * @private
398
392
  */
399
393
  _onPan: function (dx, dy) {
400
- this._mayClick = false;
401
-
402
394
  if (this._state !== 'animating'
403
395
  && (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD)
404
396
  ) {
@@ -431,8 +423,6 @@
431
423
  * @private
432
424
  */
433
425
  _onZoom: function (scale, mouseX, mouseY) {
434
- this._mayClick = false;
435
-
436
426
  if (this._state !== 'animating') {
437
427
  // These param must not be cached.
438
428
  var root = this.seriesModel.getData().tree.root;
@@ -480,25 +470,11 @@
480
470
  * @private
481
471
  */
482
472
  _initEvents: function (containerGroup) {
483
- // FIXME
484
- // 不用click以及silent的原因是,animate时视图设置silent true来避免click生效,
485
- // 但是animate中,按下鼠标,animate结束后(silent设回为false)松开鼠标,
486
- // 还是会触发click,期望是不触发。
487
-
488
- // Mousedown occurs when drag start, and mouseup occurs when drag end,
489
- // click event should not be triggered in that case.
490
-
491
- containerGroup.on('mousedown', function (e) {
492
- this._state === 'ready' && (this._mayClick = true);
493
- }, this);
494
- containerGroup.on('mouseup', function (e) {
495
- if (this._mayClick) {
496
- this._mayClick = false;
497
- this._state === 'ready' && onClick.call(this, e);
473
+ containerGroup.on('click', function (e) {
474
+ if (this._state !== 'ready') {
475
+ return;
498
476
  }
499
- }, this);
500
477
 
501
- function onClick(e) {
502
478
  var nodeClick = this.seriesModel.get('nodeClick', true);
503
479
 
504
480
  if (!nodeClick) {
@@ -526,7 +502,8 @@
526
502
  link && window.open(link, linkTarget);
527
503
  }
528
504
  }
529
- }
505
+
506
+ }, this);
530
507
  },
531
508
 
532
509
  /**