echarts 4.7.0 → 4.8.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 (96) hide show
  1. package/dist/echarts-en.common.js +370 -150
  2. package/dist/echarts-en.common.min.js +1 -1
  3. package/dist/echarts-en.js +508 -229
  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 +312 -123
  7. package/dist/echarts-en.simple.min.js +1 -1
  8. package/dist/echarts.common.js +344 -150
  9. package/dist/echarts.common.min.js +1 -1
  10. package/dist/echarts.js +482 -229
  11. package/dist/echarts.js.map +1 -1
  12. package/dist/echarts.min.js +1 -1
  13. package/dist/echarts.simple.js +286 -123
  14. package/dist/echarts.simple.min.js +1 -1
  15. package/dist/extension/bmap.js +336 -2
  16. package/dist/extension/bmap.js.map +1 -1
  17. package/dist/extension/bmap.min.js +1 -1
  18. package/extension/bmap/BMapView.js +6 -2
  19. package/extension-src/bmap/BMapView.js +3 -2
  20. package/lib/chart/bar/BarView.js +20 -5
  21. package/lib/chart/heatmap/HeatmapView.js +2 -2
  22. package/lib/chart/helper/EffectSymbol.js +2 -1
  23. package/lib/chart/helper/LineDraw.js +5 -1
  24. package/lib/chart/helper/Symbol.js +1 -2
  25. package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
  26. package/lib/chart/line/LineView.js +33 -0
  27. package/lib/chart/map/MapSeries.js +3 -2
  28. package/lib/chart/pie/PieView.js +20 -13
  29. package/lib/chart/sankey/sankeyLayout.js +18 -0
  30. package/lib/chart/sunburst/SunburstPiece.js +1 -0
  31. package/lib/chart/sunburst/SunburstSeries.js +12 -7
  32. package/lib/chart/sunburst/SunburstView.js +5 -1
  33. package/lib/chart/tree/TreeSeries.js +4 -4
  34. package/lib/chart/treemap/TreemapSeries.js +15 -3
  35. package/lib/chart/treemap/TreemapView.js +23 -11
  36. package/lib/component/helper/MapDraw.js +32 -4
  37. package/lib/component/title.js +6 -2
  38. package/lib/component/toolbox/ToolboxView.js +1 -1
  39. package/lib/component/toolbox/feature/MagicType.js +2 -1
  40. package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
  41. package/lib/component/tooltip/TooltipView.js +1 -1
  42. package/lib/component/visualMap/PiecewiseModel.js +3 -6
  43. package/lib/coord/axisHelper.js +22 -16
  44. package/lib/coord/calendar/Calendar.js +8 -4
  45. package/lib/coord/geo/geoJSONLoader.js +3 -2
  46. package/lib/coord/geo/geoSourceManager.js +3 -2
  47. package/lib/coord/geo/parseGeoJson.js +3 -2
  48. package/lib/coord/radar/Radar.js +1 -1
  49. package/lib/data/Tree.js +8 -19
  50. package/lib/echarts.js +57 -34
  51. package/lib/langEN.js +26 -0
  52. package/lib/loading/default.js +43 -27
  53. package/lib/model/Series.js +1 -1
  54. package/lib/util/format.js +19 -2
  55. package/lib/util/graphic.js +11 -8
  56. package/lib/visual/symbol.js +12 -2
  57. package/map/js/province/gansu.js +2 -2
  58. package/package.json +2 -2
  59. package/src/chart/bar/BarView.js +16 -3
  60. package/src/chart/heatmap/HeatmapView.js +2 -2
  61. package/src/chart/helper/EffectSymbol.js +2 -1
  62. package/src/chart/helper/LineDraw.js +5 -1
  63. package/src/chart/helper/Symbol.js +2 -2
  64. package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
  65. package/src/chart/line/LineView.js +39 -0
  66. package/src/chart/map/MapSeries.js +3 -2
  67. package/src/chart/pie/PieView.js +18 -13
  68. package/src/chart/sankey/sankeyLayout.js +21 -2
  69. package/src/chart/sunburst/SunburstPiece.js +2 -0
  70. package/src/chart/sunburst/SunburstSeries.js +12 -7
  71. package/src/chart/sunburst/SunburstView.js +2 -1
  72. package/src/chart/tree/TreeSeries.js +3 -6
  73. package/src/chart/treemap/TreemapSeries.js +15 -5
  74. package/src/chart/treemap/TreemapView.js +20 -14
  75. package/src/component/helper/MapDraw.js +26 -3
  76. package/src/component/title.js +3 -2
  77. package/src/component/toolbox/ToolboxView.js +1 -1
  78. package/src/component/toolbox/feature/MagicType.js +2 -1
  79. package/src/component/toolbox/feature/SaveAsImage.js +2 -1
  80. package/src/component/tooltip/TooltipView.js +1 -1
  81. package/src/component/visualMap/PiecewiseModel.js +5 -9
  82. package/src/coord/axisHelper.js +26 -19
  83. package/src/coord/calendar/Calendar.js +12 -5
  84. package/src/coord/geo/geoJSONLoader.js +3 -2
  85. package/src/coord/geo/geoSourceManager.js +3 -2
  86. package/src/coord/geo/parseGeoJson.js +3 -2
  87. package/src/coord/radar/Radar.js +1 -1
  88. package/src/data/Tree.js +11 -18
  89. package/src/echarts.js +60 -36
  90. package/src/langEN.js +26 -0
  91. package/src/layout/barGrid.js +4 -2
  92. package/src/loading/default.js +46 -34
  93. package/src/model/Series.js +1 -1
  94. package/src/util/format.js +17 -1
  95. package/src/util/graphic.js +10 -7
  96. package/src/visual/symbol.js +11 -2
@@ -9948,6 +9948,10 @@ Painter.prototype = {
9948
9948
  if (this._layerConfig[zlevel]) {
9949
9949
  merge(layer, this._layerConfig[zlevel], true);
9950
9950
  }
9951
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
9952
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
9953
+ merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
9954
+ }
9951
9955
 
9952
9956
  if (virtual) {
9953
9957
  layer.virtual = virtual;
@@ -10100,12 +10104,26 @@ Painter.prototype = {
10100
10104
 
10101
10105
  var prevLayer = null;
10102
10106
  var incrementalLayerCount = 0;
10107
+ var prevZlevel;
10103
10108
  for (var i = 0; i < list.length; i++) {
10104
10109
  var el = list[i];
10105
10110
  var zlevel = el.zlevel;
10106
10111
  var layer;
10107
- // PENDING If change one incremental element style ?
10108
- // TODO Where there are non-incremental elements between incremental elements.
10112
+
10113
+ if (prevZlevel !== zlevel) {
10114
+ prevZlevel = zlevel;
10115
+ incrementalLayerCount = 0;
10116
+ }
10117
+
10118
+ // TODO Not use magic number on zlevel.
10119
+
10120
+ // Each layer with increment element can be separated to 3 layers.
10121
+ // (Other Element drawn after incremental element)
10122
+ // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------
10123
+ // (Incremental element)
10124
+ // ----------------------zlevel + INCREMENTAL_INC------------------------
10125
+ // (Element drawn before incremental element)
10126
+ // --------------------------------zlevel--------------------------------
10109
10127
  if (el.incremental) {
10110
10128
  layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
10111
10129
  layer.incremental = true;
@@ -10200,6 +10218,7 @@ Painter.prototype = {
10200
10218
 
10201
10219
  for (var i = 0; i < this._zlevelList.length; i++) {
10202
10220
  var _zlevel = this._zlevelList[i];
10221
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
10203
10222
  if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
10204
10223
  var layer = this._layers[_zlevel];
10205
10224
  merge(layer, layerConfig[zlevel], true);
@@ -11270,7 +11289,7 @@ var painterCtors = {
11270
11289
  /**
11271
11290
  * @type {string}
11272
11291
  */
11273
- var version$1 = '4.3.0';
11292
+ var version$1 = '4.3.1';
11274
11293
 
11275
11294
  /**
11276
11295
  * Initializing a zrender instance
@@ -13098,7 +13117,30 @@ var extremity = create();
13098
13117
  * @param {number} min
13099
13118
  * @param {number} max
13100
13119
  */
13120
+ function fromPoints(points, min$$1, max$$1) {
13121
+ if (points.length === 0) {
13122
+ return;
13123
+ }
13124
+ var p = points[0];
13125
+ var left = p[0];
13126
+ var right = p[0];
13127
+ var top = p[1];
13128
+ var bottom = p[1];
13129
+ var i;
13101
13130
 
13131
+ for (i = 1; i < points.length; i++) {
13132
+ p = points[i];
13133
+ left = mathMin$3(left, p[0]);
13134
+ right = mathMax$3(right, p[0]);
13135
+ top = mathMin$3(top, p[1]);
13136
+ bottom = mathMax$3(bottom, p[1]);
13137
+ }
13138
+
13139
+ min$$1[0] = left;
13140
+ min$$1[1] = top;
13141
+ max$$1[0] = right;
13142
+ max$$1[1] = bottom;
13143
+ }
13102
13144
 
13103
13145
  /**
13104
13146
  * @memberOf module:zrender/core/bbox
@@ -17420,11 +17462,13 @@ function getHighlightDigit(highlightKey) {
17420
17462
  * @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
17421
17463
  * @param {string|Function} [opt.defaultText]
17422
17464
  * @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
17423
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17424
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
17425
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17426
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
17427
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17465
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17466
+ * @param {number} [opt.labelDataIndex] Fetch text by
17467
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17468
+ * @param {number} [opt.labelDimIndex] Fetch text by
17469
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17470
+ * @param {string} [opt.labelProp] Fetch text by
17471
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17428
17472
  * @param {Object} [normalSpecified]
17429
17473
  * @param {Object} [emphasisSpecified]
17430
17474
  */
@@ -17438,6 +17482,7 @@ function setLabelStyle(
17438
17482
  var labelFetcher = opt.labelFetcher;
17439
17483
  var labelDataIndex = opt.labelDataIndex;
17440
17484
  var labelDimIndex = opt.labelDimIndex;
17485
+ var labelProp = opt.labelProp;
17441
17486
 
17442
17487
  // This scenario, `label.normal.show = true; label.emphasis.show = false`,
17443
17488
  // is not supported util someone requests.
@@ -17451,7 +17496,7 @@ function setLabelStyle(
17451
17496
  var baseText;
17452
17497
  if (showNormal || showEmphasis) {
17453
17498
  if (labelFetcher) {
17454
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
17499
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
17455
17500
  }
17456
17501
  if (baseText == null) {
17457
17502
  baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17461,7 +17506,7 @@ function setLabelStyle(
17461
17506
  var emphasisStyleText = showEmphasis
17462
17507
  ? retrieve2(
17463
17508
  labelFetcher
17464
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
17509
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
17465
17510
  : null,
17466
17511
  baseText
17467
17512
  )
@@ -19280,7 +19325,7 @@ function nice(val, round) {
19280
19325
  // import Text from 'zrender/src/graphic/Text';
19281
19326
 
19282
19327
  /**
19283
- * 每三位默认加,格式化
19328
+ * add commas after every three numbers
19284
19329
  * @param {string|number} x
19285
19330
  * @return {string}
19286
19331
  */
@@ -19495,6 +19540,13 @@ var truncateText$1 = truncateText;
19495
19540
  * But deprecated this interface. Please use `getTextBoundingRect` instead.
19496
19541
  */
19497
19542
 
19543
+
19544
+ /**
19545
+ * open new tab
19546
+ * @param {string} link url
19547
+ * @param {string} target blank or self
19548
+ */
19549
+
19498
19550
  /*
19499
19551
  * Licensed to the Apache Software Foundation (ASF) under one
19500
19552
  * or more contributor license agreements. See the NOTICE file
@@ -24429,7 +24481,7 @@ function dataTaskReset(context) {
24429
24481
 
24430
24482
  function dataTaskProgress(param, context) {
24431
24483
  // Avoid repead cloneShallow when data just created in reset.
24432
- if (param.end > context.outputData.count()) {
24484
+ if (context.outputData && param.end > context.outputData.count()) {
24433
24485
  context.model.getRawData().cloneShallow(context.outputData);
24434
24486
  }
24435
24487
  }
@@ -25374,11 +25426,16 @@ var loadingDefault = function (api, opts) {
25374
25426
  opts = opts || {};
25375
25427
  defaults(opts, {
25376
25428
  text: 'loading',
25377
- color: '#c23531',
25378
25429
  textColor: '#000',
25430
+ fontSize: '12px',
25379
25431
  maskColor: 'rgba(255, 255, 255, 0.8)',
25432
+ showSpinner: true,
25433
+ color: '#c23531',
25434
+ spinnerRadius: 10,
25435
+ lineWidth: 5,
25380
25436
  zlevel: 0
25381
25437
  });
25438
+ var group = new Group();
25382
25439
  var mask = new Rect({
25383
25440
  style: {
25384
25441
  fill: opts.maskColor
@@ -25386,24 +25443,13 @@ var loadingDefault = function (api, opts) {
25386
25443
  zlevel: opts.zlevel,
25387
25444
  z: 10000
25388
25445
  });
25389
- var arc = new Arc({
25390
- shape: {
25391
- startAngle: -PI$1 / 2,
25392
- endAngle: -PI$1 / 2 + 0.1,
25393
- r: 10
25394
- },
25395
- style: {
25396
- stroke: opts.color,
25397
- lineCap: 'round',
25398
- lineWidth: 5
25399
- },
25400
- zlevel: opts.zlevel,
25401
- z: 10001
25402
- });
25446
+ group.add(mask);
25447
+ var font = opts.fontSize + ' sans-serif';
25403
25448
  var labelRect = new Rect({
25404
25449
  style: {
25405
25450
  fill: 'none',
25406
25451
  text: opts.text,
25452
+ font: font,
25407
25453
  textPosition: 'right',
25408
25454
  textDistance: 10,
25409
25455
  textFill: opts.textColor
@@ -25411,32 +25457,49 @@ var loadingDefault = function (api, opts) {
25411
25457
  zlevel: opts.zlevel,
25412
25458
  z: 10001
25413
25459
  });
25414
-
25415
- arc.animateShape(true)
25416
- .when(1000, {
25417
- endAngle: PI$1 * 3 / 2
25418
- })
25419
- .start('circularInOut');
25420
- arc.animateShape(true)
25421
- .when(1000, {
25422
- startAngle: PI$1 * 3 / 2
25423
- })
25424
- .delay(300)
25425
- .start('circularInOut');
25426
-
25427
- var group = new Group();
25428
- group.add(arc);
25429
25460
  group.add(labelRect);
25430
- group.add(mask);
25461
+ if (opts.showSpinner) {
25462
+ var arc = new Arc({
25463
+ shape: {
25464
+ startAngle: -PI$1 / 2,
25465
+ endAngle: -PI$1 / 2 + 0.1,
25466
+ r: opts.spinnerRadius
25467
+ },
25468
+ style: {
25469
+ stroke: opts.color,
25470
+ lineCap: 'round',
25471
+ lineWidth: opts.lineWidth
25472
+ },
25473
+ zlevel: opts.zlevel,
25474
+ z: 10001
25475
+ });
25476
+ arc.animateShape(true)
25477
+ .when(1000, {
25478
+ endAngle: PI$1 * 3 / 2
25479
+ })
25480
+ .start('circularInOut');
25481
+ arc.animateShape(true)
25482
+ .when(1000, {
25483
+ startAngle: PI$1 * 3 / 2
25484
+ })
25485
+ .delay(300)
25486
+ .start('circularInOut');
25487
+ group.add(arc);
25488
+ }
25431
25489
  // Inject resize
25432
25490
  group.resize = function () {
25433
- var cx = api.getWidth() / 2;
25491
+ var textWidth = getWidth(opts.text, font);
25492
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
25493
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
25494
+ // textDistance needs to be calculated when both animation and text exist
25495
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
25496
+ // only show the text
25497
+ - (opts.showSpinner ? 0 : textWidth / 2);
25434
25498
  var cy = api.getHeight() / 2;
25435
- arc.setShape({
25499
+ opts.showSpinner && arc.setShape({
25436
25500
  cx: cx,
25437
25501
  cy: cy
25438
25502
  });
25439
- var r = arc.shape.r;
25440
25503
  labelRect.setShape({
25441
25504
  x: cx - r,
25442
25505
  y: cy - r,
@@ -27092,10 +27155,10 @@ var isFunction = isFunction$1;
27092
27155
  var isObject = isObject$1;
27093
27156
  var parseClassType = ComponentModel.parseClassType;
27094
27157
 
27095
- var version = '4.7.0';
27158
+ var version = '4.8.0';
27096
27159
 
27097
27160
  var dependencies = {
27098
- zrender: '4.3.0'
27161
+ zrender: '4.3.1'
27099
27162
  };
27100
27163
 
27101
27164
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -27514,7 +27577,7 @@ echartsProto.getRenderedCanvas = function (opts) {
27514
27577
  * Get svg data url
27515
27578
  * @return {string}
27516
27579
  */
27517
- echartsProto.getSvgDataUrl = function () {
27580
+ echartsProto.getSvgDataURL = function () {
27518
27581
  if (!env$1.svgSupported) {
27519
27582
  return;
27520
27583
  }
@@ -27526,7 +27589,7 @@ echartsProto.getSvgDataUrl = function () {
27526
27589
  el.stopAnimation(true);
27527
27590
  });
27528
27591
 
27529
- return zr.painter.pathToDataUrl();
27592
+ return zr.painter.toDataURL();
27530
27593
  };
27531
27594
 
27532
27595
  /**
@@ -27562,7 +27625,7 @@ echartsProto.getDataURL = function (opts) {
27562
27625
  });
27563
27626
 
27564
27627
  var url = this._zr.painter.getType() === 'svg'
27565
- ? this.getSvgDataUrl()
27628
+ ? this.getSvgDataURL()
27566
27629
  : this.getRenderedCanvas(opts).toDataURL(
27567
27630
  'image/' + (opts && opts.type || 'png')
27568
27631
  );
@@ -27591,6 +27654,7 @@ echartsProto.getConnectedDataURL = function (opts) {
27591
27654
  if (!env$1.canvasSupported) {
27592
27655
  return;
27593
27656
  }
27657
+ var isSvg = opts.type === 'svg';
27594
27658
  var groupId = this.group;
27595
27659
  var mathMin = Math.min;
27596
27660
  var mathMax = Math.max;
@@ -27605,9 +27669,9 @@ echartsProto.getConnectedDataURL = function (opts) {
27605
27669
 
27606
27670
  each$1(instances, function (chart, id) {
27607
27671
  if (chart.group === groupId) {
27608
- var canvas = chart.getRenderedCanvas(
27609
- clone(opts)
27610
- );
27672
+ var canvas = isSvg
27673
+ ? chart.getZr().painter.getSvgDom().innerHTML
27674
+ : chart.getRenderedCanvas(clone(opts));
27611
27675
  var boundingRect = chart.getDom().getBoundingClientRect();
27612
27676
  left = mathMin(boundingRect.left, left);
27613
27677
  top = mathMin(boundingRect.top, top);
@@ -27628,38 +27692,61 @@ echartsProto.getConnectedDataURL = function (opts) {
27628
27692
  var width = right - left;
27629
27693
  var height = bottom - top;
27630
27694
  var targetCanvas = createCanvas();
27631
- targetCanvas.width = width;
27632
- targetCanvas.height = height;
27633
- var zr = init$1(targetCanvas);
27695
+ var zr = init$1(targetCanvas, {
27696
+ renderer: isSvg ? 'svg' : 'canvas'
27697
+ });
27698
+ zr.resize({
27699
+ width: width,
27700
+ height: height
27701
+ });
27634
27702
 
27635
- // Background between the charts
27636
- if (opts.connectedBackgroundColor) {
27637
- zr.add(new Rect({
27638
- shape: {
27639
- x: 0,
27640
- y: 0,
27641
- width: width,
27642
- height: height
27643
- },
27644
- style: {
27645
- fill: opts.connectedBackgroundColor
27646
- }
27647
- }));
27703
+ if (isSvg) {
27704
+ var content = '';
27705
+ each(canvasList, function (item) {
27706
+ var x = item.left - left;
27707
+ var y = item.top - top;
27708
+ content += '<g transform="translate(' + x + ','
27709
+ + y + ')">' + item.dom + '</g>';
27710
+ });
27711
+ zr.painter.getSvgRoot().innerHTML = content;
27712
+
27713
+ if (opts.connectedBackgroundColor) {
27714
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
27715
+ }
27716
+
27717
+ zr.refreshImmediately();
27718
+ return zr.painter.toDataURL();
27648
27719
  }
27720
+ else {
27721
+ // Background between the charts
27722
+ if (opts.connectedBackgroundColor) {
27723
+ zr.add(new Rect({
27724
+ shape: {
27725
+ x: 0,
27726
+ y: 0,
27727
+ width: width,
27728
+ height: height
27729
+ },
27730
+ style: {
27731
+ fill: opts.connectedBackgroundColor
27732
+ }
27733
+ }));
27734
+ }
27649
27735
 
27650
- each(canvasList, function (item) {
27651
- var img = new ZImage({
27652
- style: {
27653
- x: item.left * dpr - left,
27654
- y: item.top * dpr - top,
27655
- image: item.dom
27656
- }
27736
+ each(canvasList, function (item) {
27737
+ var img = new ZImage({
27738
+ style: {
27739
+ x: item.left * dpr - left,
27740
+ y: item.top * dpr - top,
27741
+ image: item.dom
27742
+ }
27743
+ });
27744
+ zr.add(img);
27657
27745
  });
27658
- zr.add(img);
27659
- });
27660
- zr.refreshImmediately();
27661
27746
 
27662
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
27747
+ zr.refreshImmediately();
27748
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
27749
+ }
27663
27750
  }
27664
27751
  else {
27665
27752
  return this.getDataURL(opts);
@@ -33517,7 +33604,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
33517
33604
 
33518
33605
  var itemStyle = seriesScope && seriesScope.itemStyle;
33519
33606
  var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
33520
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
33521
33607
  var symbolOffset = seriesScope && seriesScope.symbolOffset;
33522
33608
  var labelModel = seriesScope && seriesScope.labelModel;
33523
33609
  var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -33533,7 +33619,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
33533
33619
  itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
33534
33620
  hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
33535
33621
 
33536
- symbolRotate = itemModel.getShallow('symbolRotate');
33537
33622
  symbolOffset = itemModel.getShallow('symbolOffset');
33538
33623
 
33539
33624
  labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -33547,6 +33632,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
33547
33632
 
33548
33633
  var elStyle = symbolPath.style;
33549
33634
 
33635
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
33636
+
33550
33637
  symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
33551
33638
 
33552
33639
  if (symbolOffset) {
@@ -34602,6 +34689,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
34602
34689
  width += lineWidth;
34603
34690
  height += lineWidth;
34604
34691
 
34692
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
34693
+ x = Math.floor(x);
34694
+ width = Math.round(width);
34695
+
34605
34696
  var clipPath = new Rect({
34606
34697
  shape: {
34607
34698
  x: x,
@@ -34699,6 +34790,26 @@ function isPointsSame(points1, points2) {
34699
34790
  return true;
34700
34791
  }
34701
34792
 
34793
+ function getBoundingDiff(points1, points2) {
34794
+ var min1 = [];
34795
+ var max1 = [];
34796
+
34797
+ var min2 = [];
34798
+ var max2 = [];
34799
+
34800
+ fromPoints(points1, min1, max1);
34801
+ fromPoints(points2, min2, max2);
34802
+
34803
+ // Get a max value from each corner of two boundings.
34804
+ return Math.max(
34805
+ Math.abs(min1[0] - min2[0]),
34806
+ Math.abs(min1[1] - min2[1]),
34807
+
34808
+ Math.abs(max1[0] - max2[0]),
34809
+ Math.abs(max1[1] - max2[1])
34810
+ );
34811
+ }
34812
+
34702
34813
  function getSmooth(smooth) {
34703
34814
  return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
34704
34815
  }
@@ -35311,6 +35422,24 @@ Chart.extend({
35311
35422
  next = turnPointsIntoStep(diff.next, coordSys, step);
35312
35423
  stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
35313
35424
  }
35425
+ // Don't apply animation if diff is large.
35426
+ // For better result and avoid memory explosion problems like
35427
+ // https://github.com/apache/incubator-echarts/issues/12229
35428
+ if (getBoundingDiff(current, next) > 3000
35429
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
35430
+ ) {
35431
+ polyline.setShape({
35432
+ points: next
35433
+ });
35434
+ if (polygon) {
35435
+ polygon.setShape({
35436
+ points: next,
35437
+ stackedOnPoints: stackedOnNext
35438
+ });
35439
+ }
35440
+ return;
35441
+ }
35442
+
35314
35443
  // `diff.current` is subset of `current` (which should be ensured by
35315
35444
  // turnPointsIntoStep), so points in `__points` can be updated when
35316
35445
  // points in `current` are update during animation.
@@ -35417,13 +35546,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
35417
35546
  var symbolType = seriesModel.get('symbol');
35418
35547
  var symbolSize = seriesModel.get('symbolSize');
35419
35548
  var keepAspect = seriesModel.get('symbolKeepAspect');
35549
+ var symbolRotate = seriesModel.get('symbolRotate');
35420
35550
 
35421
35551
  var hasSymbolTypeCallback = isFunction$1(symbolType);
35422
35552
  var hasSymbolSizeCallback = isFunction$1(symbolSize);
35423
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
35553
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
35554
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
35424
35555
  var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
35425
35556
  var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
35426
-
35427
35557
  data.setVisual({
35428
35558
  legendSymbol: legendSymbol || seriesSymbol,
35429
35559
  // If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -35432,7 +35562,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
35432
35562
  // some cases but generally it is not recommanded.
35433
35563
  symbol: seriesSymbol,
35434
35564
  symbolSize: seriesSymbolSize,
35435
- symbolKeepAspect: keepAspect
35565
+ symbolKeepAspect: keepAspect,
35566
+ symbolRotate: symbolRotate
35436
35567
  });
35437
35568
 
35438
35569
  // Only visible series has each data be visual encoded
@@ -35446,12 +35577,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
35446
35577
  var params = seriesModel.getDataParams(idx);
35447
35578
  hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
35448
35579
  hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
35580
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
35449
35581
  }
35450
35582
 
35451
35583
  if (data.hasItemOption) {
35452
35584
  var itemModel = data.getItemModel(idx);
35453
35585
  var itemSymbolType = itemModel.getShallow('symbol', true);
35454
35586
  var itemSymbolSize = itemModel.getShallow('symbolSize', true);
35587
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
35455
35588
  var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
35456
35589
 
35457
35590
  // If has item symbol
@@ -35462,6 +35595,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
35462
35595
  // PENDING Transform symbolSize ?
35463
35596
  data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
35464
35597
  }
35598
+ if (itemSymbolRotate != null) {
35599
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
35600
+ }
35465
35601
  if (itemSymbolKeepAspect != null) {
35466
35602
  data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
35467
35603
  }
@@ -36970,9 +37106,11 @@ var largeLayout = {
36970
37106
 
36971
37107
  coord = cartesian.dataToPoint(valuePair, null, coord);
36972
37108
  // Data index might not be in order, depends on `progressiveChunkMode`.
36973
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
37109
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
37110
+ ? coordLayout.x + coordLayout.width : coord[0];
36974
37111
  largePoints[pointsOffset++] = coord[0];
36975
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
37112
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
37113
+ ? coord[1] : coordLayout.y + coordLayout.height;
36976
37114
  largePoints[pointsOffset++] = coord[1];
36977
37115
  largeDataIndices[idxOffset++] = dataIndex;
36978
37116
  }
@@ -37462,8 +37600,6 @@ function getScaleExtent(scale, model) {
37462
37600
 
37463
37601
  var min = model.getMin();
37464
37602
  var max = model.getMax();
37465
- var fixMin = min != null;
37466
- var fixMax = max != null;
37467
37603
  var originalExtent = scale.getExtent();
37468
37604
 
37469
37605
  var axisDataLen;
@@ -37507,17 +37643,6 @@ function getScaleExtent(scale, model) {
37507
37643
  // (2) When `needCrossZero` and all data is positive/negative, should it be ensured
37508
37644
  // that the results processed by boundaryGap are positive/negative?
37509
37645
 
37510
- if (min == null) {
37511
- min = scaleType === 'ordinal'
37512
- ? (axisDataLen ? 0 : NaN)
37513
- : originalExtent[0] - boundaryGap[0] * span;
37514
- }
37515
- if (max == null) {
37516
- max = scaleType === 'ordinal'
37517
- ? (axisDataLen ? axisDataLen - 1 : NaN)
37518
- : originalExtent[1] + boundaryGap[1] * span;
37519
- }
37520
-
37521
37646
  if (min === 'dataMin') {
37522
37647
  min = originalExtent[0];
37523
37648
  }
@@ -37538,6 +37663,20 @@ function getScaleExtent(scale, model) {
37538
37663
  });
37539
37664
  }
37540
37665
 
37666
+ var fixMin = min != null;
37667
+ var fixMax = max != null;
37668
+
37669
+ if (min == null) {
37670
+ min = scaleType === 'ordinal'
37671
+ ? (axisDataLen ? 0 : NaN)
37672
+ : originalExtent[0] - boundaryGap[0] * span;
37673
+ }
37674
+ if (max == null) {
37675
+ max = scaleType === 'ordinal'
37676
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
37677
+ : originalExtent[1] + boundaryGap[1] * span;
37678
+ }
37679
+
37541
37680
  (min == null || !isFinite(min)) && (min = NaN);
37542
37681
  (max == null || !isFinite(max)) && (max = NaN);
37543
37682
 
@@ -37588,7 +37727,13 @@ function getScaleExtent(scale, model) {
37588
37727
  }
37589
37728
  }
37590
37729
 
37591
- return [min, max];
37730
+ return {
37731
+ extent: [min, max],
37732
+ // "fix" means "fixed", the value should not be
37733
+ // changed in the subsequent steps.
37734
+ fixMin: fixMin,
37735
+ fixMax: fixMax
37736
+ };
37592
37737
  }
37593
37738
 
37594
37739
  function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -37627,9 +37772,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
37627
37772
  }
37628
37773
 
37629
37774
  function niceScaleExtent(scale, model) {
37630
- var extent = getScaleExtent(scale, model);
37631
- var fixMin = model.getMin() != null;
37632
- var fixMax = model.getMax() != null;
37775
+ var extentInfo = getScaleExtent(scale, model);
37776
+ var extent = extentInfo.extent;
37777
+
37633
37778
  var splitNumber = model.get('splitNumber');
37634
37779
 
37635
37780
  if (scale.type === 'log') {
@@ -37640,8 +37785,8 @@ function niceScaleExtent(scale, model) {
37640
37785
  scale.setExtent(extent[0], extent[1]);
37641
37786
  scale.niceExtent({
37642
37787
  splitNumber: splitNumber,
37643
- fixMin: fixMin,
37644
- fixMax: fixMax,
37788
+ fixMin: extentInfo.fixMin,
37789
+ fixMax: extentInfo.fixMax,
37645
37790
  minInterval: (scaleType === 'interval' || scaleType === 'time')
37646
37791
  ? model.get('minInterval') : null,
37647
37792
  maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -42081,6 +42226,7 @@ extendChartView({
42081
42226
 
42082
42227
  var drawBackground = seriesModel.get('showBackground', true);
42083
42228
  var backgroundModel = seriesModel.getModel('backgroundStyle');
42229
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
42084
42230
 
42085
42231
  var bgEls = [];
42086
42232
  var oldBgEls = this._backgroundEls || [];
@@ -42091,8 +42237,13 @@ extendChartView({
42091
42237
  var layout = getLayout[coord.type](data, dataIndex, itemModel);
42092
42238
 
42093
42239
  if (drawBackground) {
42094
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
42240
+ var bgLayout = getLayout[coord.type](data, dataIndex);
42241
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
42095
42242
  bgEl.useStyle(backgroundModel.getBarItemStyle());
42243
+ // Only cartesian2d support borderRadius.
42244
+ if (coord.type === 'cartesian2d') {
42245
+ bgEl.setShape('r', barBorderRadius);
42246
+ }
42096
42247
  bgEls[dataIndex] = bgEl;
42097
42248
  }
42098
42249
 
@@ -42129,9 +42280,14 @@ extendChartView({
42129
42280
  if (drawBackground) {
42130
42281
  var bgEl = oldBgEls[oldIndex];
42131
42282
  bgEl.useStyle(backgroundModel.getBarItemStyle());
42283
+ // Only cartesian2d support borderRadius.
42284
+ if (coord.type === 'cartesian2d') {
42285
+ bgEl.setShape('r', barBorderRadius);
42286
+ }
42132
42287
  bgEls[newIndex] = bgEl;
42133
42288
 
42134
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
42289
+ var bgLayout = getLayout[coord.type](data, newIndex);
42290
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
42135
42291
  updateProps(bgEl, { shape: shape }, animationModel, newIndex);
42136
42292
  }
42137
42293
 
@@ -42381,9 +42537,11 @@ function removeSector(dataIndex, animationModel, el) {
42381
42537
  }
42382
42538
 
42383
42539
  var getLayout = {
42540
+ // itemModel is only used to get borderWidth, which is not needed
42541
+ // when calculating bar background layout.
42384
42542
  cartesian2d: function (data, dataIndex, itemModel) {
42385
42543
  var layout = data.getItemLayout(dataIndex);
42386
- var fixedLineWidth = getLineWidth(itemModel, layout);
42544
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
42387
42545
 
42388
42546
  // fix layout with lineWidth
42389
42547
  var signX = layout.width > 0 ? 1 : -1;
@@ -43257,31 +43415,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
43257
43415
  var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
43258
43416
  this._updateLabel(data, idx, withAnimation);
43259
43417
 
43260
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
43418
+ this.highDownOnUpdate = !seriesModel.get('silent')
43261
43419
  ? function (fromState, toState) {
43420
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
43262
43421
  if (toState === 'emphasis') {
43263
43422
  labelLine.ignore = labelLine.hoverIgnore;
43264
43423
  labelText.ignore = labelText.hoverIgnore;
43265
43424
 
43266
43425
  // Sector may has animation of updating data. Force to move to the last frame
43267
43426
  // Or it may stopped on the wrong shape
43268
- sector.stopAnimation(true);
43269
- sector.animateTo({
43270
- shape: {
43271
- r: layout.r + seriesModel.get('hoverOffset')
43272
- }
43273
- }, 300, 'elasticOut');
43427
+ if (hasAnimation) {
43428
+ sector.stopAnimation(true);
43429
+ sector.animateTo({
43430
+ shape: {
43431
+ r: layout.r + seriesModel.get('hoverOffset')
43432
+ }
43433
+ }, 300, 'elasticOut');
43434
+ }
43274
43435
  }
43275
43436
  else {
43276
43437
  labelLine.ignore = labelLine.normalIgnore;
43277
43438
  labelText.ignore = labelText.normalIgnore;
43278
43439
 
43279
- sector.stopAnimation(true);
43280
- sector.animateTo({
43281
- shape: {
43282
- r: layout.r
43283
- }
43284
- }, 300, 'elasticOut');
43440
+ if (hasAnimation) {
43441
+ sector.stopAnimation(true);
43442
+ sector.animateTo({
43443
+ shape: {
43444
+ r: layout.r
43445
+ }
43446
+ }, 300, 'elasticOut');
43447
+ }
43285
43448
  }
43286
43449
  }
43287
43450
  : null;