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
@@ -10252,6 +10252,10 @@ Painter.prototype = {
10252
10252
  if (this._layerConfig[zlevel]) {
10253
10253
  merge(layer, this._layerConfig[zlevel], true);
10254
10254
  }
10255
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
10256
+ else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
10257
+ merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
10258
+ }
10255
10259
 
10256
10260
  if (virtual) {
10257
10261
  layer.virtual = virtual;
@@ -10404,12 +10408,26 @@ Painter.prototype = {
10404
10408
 
10405
10409
  var prevLayer = null;
10406
10410
  var incrementalLayerCount = 0;
10411
+ var prevZlevel;
10407
10412
  for (var i = 0; i < list.length; i++) {
10408
10413
  var el = list[i];
10409
10414
  var zlevel = el.zlevel;
10410
10415
  var layer;
10411
- // PENDING If change one incremental element style ?
10412
- // TODO Where there are non-incremental elements between incremental elements.
10416
+
10417
+ if (prevZlevel !== zlevel) {
10418
+ prevZlevel = zlevel;
10419
+ incrementalLayerCount = 0;
10420
+ }
10421
+
10422
+ // TODO Not use magic number on zlevel.
10423
+
10424
+ // Each layer with increment element can be separated to 3 layers.
10425
+ // (Other Element drawn after incremental element)
10426
+ // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------
10427
+ // (Incremental element)
10428
+ // ----------------------zlevel + INCREMENTAL_INC------------------------
10429
+ // (Element drawn before incremental element)
10430
+ // --------------------------------zlevel--------------------------------
10413
10431
  if (el.incremental) {
10414
10432
  layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
10415
10433
  layer.incremental = true;
@@ -10504,6 +10522,7 @@ Painter.prototype = {
10504
10522
 
10505
10523
  for (var i = 0; i < this._zlevelList.length; i++) {
10506
10524
  var _zlevel = this._zlevelList[i];
10525
+ // TODO Remove EL_AFTER_INCREMENTAL_INC magic number
10507
10526
  if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
10508
10527
  var layer = this._layers[_zlevel];
10509
10528
  merge(layer, layerConfig[zlevel], true);
@@ -11576,7 +11595,7 @@ var instances$1 = {}; // ZRender实例map索引
11576
11595
  /**
11577
11596
  * @type {string}
11578
11597
  */
11579
- var version$1 = '4.3.0';
11598
+ var version$1 = '4.3.1';
11580
11599
 
11581
11600
  /**
11582
11601
  * Initializing a zrender instance
@@ -17782,11 +17801,13 @@ function getHighlightDigit(highlightKey) {
17782
17801
  * @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
17783
17802
  * @param {string|Function} [opt.defaultText]
17784
17803
  * @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
17785
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17786
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
17787
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17788
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
17789
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17804
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17805
+ * @param {number} [opt.labelDataIndex] Fetch text by
17806
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17807
+ * @param {number} [opt.labelDimIndex] Fetch text by
17808
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17809
+ * @param {string} [opt.labelProp] Fetch text by
17810
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17790
17811
  * @param {Object} [normalSpecified]
17791
17812
  * @param {Object} [emphasisSpecified]
17792
17813
  */
@@ -17800,6 +17821,7 @@ function setLabelStyle(
17800
17821
  var labelFetcher = opt.labelFetcher;
17801
17822
  var labelDataIndex = opt.labelDataIndex;
17802
17823
  var labelDimIndex = opt.labelDimIndex;
17824
+ var labelProp = opt.labelProp;
17803
17825
 
17804
17826
  // This scenario, `label.normal.show = true; label.emphasis.show = false`,
17805
17827
  // is not supported util someone requests.
@@ -17813,7 +17835,7 @@ function setLabelStyle(
17813
17835
  var baseText;
17814
17836
  if (showNormal || showEmphasis) {
17815
17837
  if (labelFetcher) {
17816
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
17838
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
17817
17839
  }
17818
17840
  if (baseText == null) {
17819
17841
  baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17823,7 +17845,7 @@ function setLabelStyle(
17823
17845
  var emphasisStyleText = showEmphasis
17824
17846
  ? retrieve2(
17825
17847
  labelFetcher
17826
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
17848
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
17827
17849
  : null,
17828
17850
  baseText
17829
17851
  )
@@ -19734,7 +19756,7 @@ var number = (Object.freeze || Object)({
19734
19756
  // import Text from 'zrender/src/graphic/Text';
19735
19757
 
19736
19758
  /**
19737
- * 每三位默认加,格式化
19759
+ * add commas after every three numbers
19738
19760
  * @param {string|number} x
19739
19761
  * @return {string}
19740
19762
  */
@@ -19987,6 +20009,22 @@ function getTextRect(
19987
20009
  );
19988
20010
  }
19989
20011
 
20012
+ /**
20013
+ * open new tab
20014
+ * @param {string} link url
20015
+ * @param {string} target blank or self
20016
+ */
20017
+ function windowOpen(link, target) {
20018
+ if (target === '_blank' || target === 'blank') {
20019
+ var blank = window.open();
20020
+ blank.opener = null;
20021
+ blank.location = link;
20022
+ }
20023
+ else {
20024
+ window.open(link, target);
20025
+ }
20026
+ }
20027
+
19990
20028
 
19991
20029
  var format = (Object.freeze || Object)({
19992
20030
  addCommas: addCommas,
@@ -20000,7 +20038,8 @@ var format = (Object.freeze || Object)({
20000
20038
  capitalFirst: capitalFirst,
20001
20039
  truncateText: truncateText$1,
20002
20040
  getTextBoundingRect: getTextBoundingRect,
20003
- getTextRect: getTextRect
20041
+ getTextRect: getTextRect,
20042
+ windowOpen: windowOpen
20004
20043
  });
20005
20044
 
20006
20045
  /*
@@ -24981,7 +25020,7 @@ function dataTaskReset(context) {
24981
25020
 
24982
25021
  function dataTaskProgress(param, context) {
24983
25022
  // Avoid repead cloneShallow when data just created in reset.
24984
- if (param.end > context.outputData.count()) {
25023
+ if (context.outputData && param.end > context.outputData.count()) {
24985
25024
  context.model.getRawData().cloneShallow(context.outputData);
24986
25025
  }
24987
25026
  }
@@ -25961,11 +26000,16 @@ var loadingDefault = function (api, opts) {
25961
26000
  opts = opts || {};
25962
26001
  defaults(opts, {
25963
26002
  text: 'loading',
25964
- color: '#c23531',
25965
26003
  textColor: '#000',
26004
+ fontSize: '12px',
25966
26005
  maskColor: 'rgba(255, 255, 255, 0.8)',
26006
+ showSpinner: true,
26007
+ color: '#c23531',
26008
+ spinnerRadius: 10,
26009
+ lineWidth: 5,
25967
26010
  zlevel: 0
25968
26011
  });
26012
+ var group = new Group();
25969
26013
  var mask = new Rect({
25970
26014
  style: {
25971
26015
  fill: opts.maskColor
@@ -25973,24 +26017,13 @@ var loadingDefault = function (api, opts) {
25973
26017
  zlevel: opts.zlevel,
25974
26018
  z: 10000
25975
26019
  });
25976
- var arc = new Arc({
25977
- shape: {
25978
- startAngle: -PI$1 / 2,
25979
- endAngle: -PI$1 / 2 + 0.1,
25980
- r: 10
25981
- },
25982
- style: {
25983
- stroke: opts.color,
25984
- lineCap: 'round',
25985
- lineWidth: 5
25986
- },
25987
- zlevel: opts.zlevel,
25988
- z: 10001
25989
- });
26020
+ group.add(mask);
26021
+ var font = opts.fontSize + ' sans-serif';
25990
26022
  var labelRect = new Rect({
25991
26023
  style: {
25992
26024
  fill: 'none',
25993
26025
  text: opts.text,
26026
+ font: font,
25994
26027
  textPosition: 'right',
25995
26028
  textDistance: 10,
25996
26029
  textFill: opts.textColor
@@ -25998,32 +26031,49 @@ var loadingDefault = function (api, opts) {
25998
26031
  zlevel: opts.zlevel,
25999
26032
  z: 10001
26000
26033
  });
26001
-
26002
- arc.animateShape(true)
26003
- .when(1000, {
26004
- endAngle: PI$1 * 3 / 2
26005
- })
26006
- .start('circularInOut');
26007
- arc.animateShape(true)
26008
- .when(1000, {
26009
- startAngle: PI$1 * 3 / 2
26010
- })
26011
- .delay(300)
26012
- .start('circularInOut');
26013
-
26014
- var group = new Group();
26015
- group.add(arc);
26016
26034
  group.add(labelRect);
26017
- group.add(mask);
26035
+ if (opts.showSpinner) {
26036
+ var arc = new Arc({
26037
+ shape: {
26038
+ startAngle: -PI$1 / 2,
26039
+ endAngle: -PI$1 / 2 + 0.1,
26040
+ r: opts.spinnerRadius
26041
+ },
26042
+ style: {
26043
+ stroke: opts.color,
26044
+ lineCap: 'round',
26045
+ lineWidth: opts.lineWidth
26046
+ },
26047
+ zlevel: opts.zlevel,
26048
+ z: 10001
26049
+ });
26050
+ arc.animateShape(true)
26051
+ .when(1000, {
26052
+ endAngle: PI$1 * 3 / 2
26053
+ })
26054
+ .start('circularInOut');
26055
+ arc.animateShape(true)
26056
+ .when(1000, {
26057
+ startAngle: PI$1 * 3 / 2
26058
+ })
26059
+ .delay(300)
26060
+ .start('circularInOut');
26061
+ group.add(arc);
26062
+ }
26018
26063
  // Inject resize
26019
26064
  group.resize = function () {
26020
- var cx = api.getWidth() / 2;
26065
+ var textWidth = getWidth(opts.text, font);
26066
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
26067
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
26068
+ // textDistance needs to be calculated when both animation and text exist
26069
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
26070
+ // only show the text
26071
+ - (opts.showSpinner ? 0 : textWidth / 2);
26021
26072
  var cy = api.getHeight() / 2;
26022
- arc.setShape({
26073
+ opts.showSpinner && arc.setShape({
26023
26074
  cx: cx,
26024
26075
  cy: cy
26025
26076
  });
26026
- var r = arc.shape.r;
26027
26077
  labelRect.setShape({
26028
26078
  x: cx - r,
26029
26079
  y: cy - r,
@@ -27679,10 +27729,10 @@ var isFunction = isFunction$1;
27679
27729
  var isObject = isObject$1;
27680
27730
  var parseClassType = ComponentModel.parseClassType;
27681
27731
 
27682
- var version = '4.7.0';
27732
+ var version = '4.8.0';
27683
27733
 
27684
27734
  var dependencies = {
27685
- zrender: '4.3.0'
27735
+ zrender: '4.3.1'
27686
27736
  };
27687
27737
 
27688
27738
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -28101,7 +28151,7 @@ echartsProto.getRenderedCanvas = function (opts) {
28101
28151
  * Get svg data url
28102
28152
  * @return {string}
28103
28153
  */
28104
- echartsProto.getSvgDataUrl = function () {
28154
+ echartsProto.getSvgDataURL = function () {
28105
28155
  if (!env$1.svgSupported) {
28106
28156
  return;
28107
28157
  }
@@ -28113,7 +28163,7 @@ echartsProto.getSvgDataUrl = function () {
28113
28163
  el.stopAnimation(true);
28114
28164
  });
28115
28165
 
28116
- return zr.painter.pathToDataUrl();
28166
+ return zr.painter.toDataURL();
28117
28167
  };
28118
28168
 
28119
28169
  /**
@@ -28149,7 +28199,7 @@ echartsProto.getDataURL = function (opts) {
28149
28199
  });
28150
28200
 
28151
28201
  var url = this._zr.painter.getType() === 'svg'
28152
- ? this.getSvgDataUrl()
28202
+ ? this.getSvgDataURL()
28153
28203
  : this.getRenderedCanvas(opts).toDataURL(
28154
28204
  'image/' + (opts && opts.type || 'png')
28155
28205
  );
@@ -28178,6 +28228,7 @@ echartsProto.getConnectedDataURL = function (opts) {
28178
28228
  if (!env$1.canvasSupported) {
28179
28229
  return;
28180
28230
  }
28231
+ var isSvg = opts.type === 'svg';
28181
28232
  var groupId = this.group;
28182
28233
  var mathMin = Math.min;
28183
28234
  var mathMax = Math.max;
@@ -28192,9 +28243,9 @@ echartsProto.getConnectedDataURL = function (opts) {
28192
28243
 
28193
28244
  each$1(instances, function (chart, id) {
28194
28245
  if (chart.group === groupId) {
28195
- var canvas = chart.getRenderedCanvas(
28196
- clone(opts)
28197
- );
28246
+ var canvas = isSvg
28247
+ ? chart.getZr().painter.getSvgDom().innerHTML
28248
+ : chart.getRenderedCanvas(clone(opts));
28198
28249
  var boundingRect = chart.getDom().getBoundingClientRect();
28199
28250
  left = mathMin(boundingRect.left, left);
28200
28251
  top = mathMin(boundingRect.top, top);
@@ -28215,38 +28266,61 @@ echartsProto.getConnectedDataURL = function (opts) {
28215
28266
  var width = right - left;
28216
28267
  var height = bottom - top;
28217
28268
  var targetCanvas = createCanvas();
28218
- targetCanvas.width = width;
28219
- targetCanvas.height = height;
28220
- var zr = init$1(targetCanvas);
28269
+ var zr = init$1(targetCanvas, {
28270
+ renderer: isSvg ? 'svg' : 'canvas'
28271
+ });
28272
+ zr.resize({
28273
+ width: width,
28274
+ height: height
28275
+ });
28221
28276
 
28222
- // Background between the charts
28223
- if (opts.connectedBackgroundColor) {
28224
- zr.add(new Rect({
28225
- shape: {
28226
- x: 0,
28227
- y: 0,
28228
- width: width,
28229
- height: height
28230
- },
28231
- style: {
28232
- fill: opts.connectedBackgroundColor
28233
- }
28234
- }));
28277
+ if (isSvg) {
28278
+ var content = '';
28279
+ each(canvasList, function (item) {
28280
+ var x = item.left - left;
28281
+ var y = item.top - top;
28282
+ content += '<g transform="translate(' + x + ','
28283
+ + y + ')">' + item.dom + '</g>';
28284
+ });
28285
+ zr.painter.getSvgRoot().innerHTML = content;
28286
+
28287
+ if (opts.connectedBackgroundColor) {
28288
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
28289
+ }
28290
+
28291
+ zr.refreshImmediately();
28292
+ return zr.painter.toDataURL();
28235
28293
  }
28294
+ else {
28295
+ // Background between the charts
28296
+ if (opts.connectedBackgroundColor) {
28297
+ zr.add(new Rect({
28298
+ shape: {
28299
+ x: 0,
28300
+ y: 0,
28301
+ width: width,
28302
+ height: height
28303
+ },
28304
+ style: {
28305
+ fill: opts.connectedBackgroundColor
28306
+ }
28307
+ }));
28308
+ }
28236
28309
 
28237
- each(canvasList, function (item) {
28238
- var img = new ZImage({
28239
- style: {
28240
- x: item.left * dpr - left,
28241
- y: item.top * dpr - top,
28242
- image: item.dom
28243
- }
28310
+ each(canvasList, function (item) {
28311
+ var img = new ZImage({
28312
+ style: {
28313
+ x: item.left * dpr - left,
28314
+ y: item.top * dpr - top,
28315
+ image: item.dom
28316
+ }
28317
+ });
28318
+ zr.add(img);
28244
28319
  });
28245
- zr.add(img);
28246
- });
28247
- zr.refreshImmediately();
28248
28320
 
28249
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
28321
+ zr.refreshImmediately();
28322
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
28323
+ }
28250
28324
  }
28251
28325
  else {
28252
28326
  return this.getDataURL(opts);
@@ -34654,9 +34728,11 @@ var largeLayout = {
34654
34728
 
34655
34729
  coord = cartesian.dataToPoint(valuePair, null, coord);
34656
34730
  // Data index might not be in order, depends on `progressiveChunkMode`.
34657
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
34731
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
34732
+ ? coordLayout.x + coordLayout.width : coord[0];
34658
34733
  largePoints[pointsOffset++] = coord[0];
34659
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
34734
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
34735
+ ? coord[1] : coordLayout.y + coordLayout.height;
34660
34736
  largePoints[pointsOffset++] = coord[1];
34661
34737
  largeDataIndices[idxOffset++] = dataIndex;
34662
34738
  }
@@ -35146,8 +35222,6 @@ function getScaleExtent(scale, model) {
35146
35222
 
35147
35223
  var min = model.getMin();
35148
35224
  var max = model.getMax();
35149
- var fixMin = min != null;
35150
- var fixMax = max != null;
35151
35225
  var originalExtent = scale.getExtent();
35152
35226
 
35153
35227
  var axisDataLen;
@@ -35191,17 +35265,6 @@ function getScaleExtent(scale, model) {
35191
35265
  // (2) When `needCrossZero` and all data is positive/negative, should it be ensured
35192
35266
  // that the results processed by boundaryGap are positive/negative?
35193
35267
 
35194
- if (min == null) {
35195
- min = scaleType === 'ordinal'
35196
- ? (axisDataLen ? 0 : NaN)
35197
- : originalExtent[0] - boundaryGap[0] * span;
35198
- }
35199
- if (max == null) {
35200
- max = scaleType === 'ordinal'
35201
- ? (axisDataLen ? axisDataLen - 1 : NaN)
35202
- : originalExtent[1] + boundaryGap[1] * span;
35203
- }
35204
-
35205
35268
  if (min === 'dataMin') {
35206
35269
  min = originalExtent[0];
35207
35270
  }
@@ -35222,6 +35285,20 @@ function getScaleExtent(scale, model) {
35222
35285
  });
35223
35286
  }
35224
35287
 
35288
+ var fixMin = min != null;
35289
+ var fixMax = max != null;
35290
+
35291
+ if (min == null) {
35292
+ min = scaleType === 'ordinal'
35293
+ ? (axisDataLen ? 0 : NaN)
35294
+ : originalExtent[0] - boundaryGap[0] * span;
35295
+ }
35296
+ if (max == null) {
35297
+ max = scaleType === 'ordinal'
35298
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
35299
+ : originalExtent[1] + boundaryGap[1] * span;
35300
+ }
35301
+
35225
35302
  (min == null || !isFinite(min)) && (min = NaN);
35226
35303
  (max == null || !isFinite(max)) && (max = NaN);
35227
35304
 
@@ -35272,7 +35349,13 @@ function getScaleExtent(scale, model) {
35272
35349
  }
35273
35350
  }
35274
35351
 
35275
- return [min, max];
35352
+ return {
35353
+ extent: [min, max],
35354
+ // "fix" means "fixed", the value should not be
35355
+ // changed in the subsequent steps.
35356
+ fixMin: fixMin,
35357
+ fixMax: fixMax
35358
+ };
35276
35359
  }
35277
35360
 
35278
35361
  function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -35311,9 +35394,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
35311
35394
  }
35312
35395
 
35313
35396
  function niceScaleExtent(scale, model) {
35314
- var extent = getScaleExtent(scale, model);
35315
- var fixMin = model.getMin() != null;
35316
- var fixMax = model.getMax() != null;
35397
+ var extentInfo = getScaleExtent(scale, model);
35398
+ var extent = extentInfo.extent;
35399
+
35317
35400
  var splitNumber = model.get('splitNumber');
35318
35401
 
35319
35402
  if (scale.type === 'log') {
@@ -35324,8 +35407,8 @@ function niceScaleExtent(scale, model) {
35324
35407
  scale.setExtent(extent[0], extent[1]);
35325
35408
  scale.niceExtent({
35326
35409
  splitNumber: splitNumber,
35327
- fixMin: fixMin,
35328
- fixMax: fixMax,
35410
+ fixMin: extentInfo.fixMin,
35411
+ fixMax: extentInfo.fixMax,
35329
35412
  minInterval: (scaleType === 'interval' || scaleType === 'time')
35330
35413
  ? model.get('minInterval') : null,
35331
35414
  maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -36358,9 +36441,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
36358
36441
  /**
36359
36442
  * @alias module:echarts/coord/geo/parseGeoJson
36360
36443
  * @param {Object} geoJson
36444
+ * @param {string} nameProperty
36361
36445
  * @return {module:zrender/container/Group}
36362
36446
  */
36363
- var parseGeoJSON = function (geoJson) {
36447
+ var parseGeoJSON = function (geoJson, nameProperty) {
36364
36448
 
36365
36449
  decode(geoJson);
36366
36450
 
@@ -36398,7 +36482,7 @@ var parseGeoJSON = function (geoJson) {
36398
36482
  }
36399
36483
 
36400
36484
  var region = new Region(
36401
- properties.name,
36485
+ properties[nameProperty || 'name'],
36402
36486
  geometries,
36403
36487
  properties.cp
36404
36488
  );
@@ -37595,7 +37679,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37595
37679
 
37596
37680
  var itemStyle = seriesScope && seriesScope.itemStyle;
37597
37681
  var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
37598
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
37599
37682
  var symbolOffset = seriesScope && seriesScope.symbolOffset;
37600
37683
  var labelModel = seriesScope && seriesScope.labelModel;
37601
37684
  var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -37611,7 +37694,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37611
37694
  itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
37612
37695
  hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
37613
37696
 
37614
- symbolRotate = itemModel.getShallow('symbolRotate');
37615
37697
  symbolOffset = itemModel.getShallow('symbolOffset');
37616
37698
 
37617
37699
  labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -37625,6 +37707,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37625
37707
 
37626
37708
  var elStyle = symbolPath.style;
37627
37709
 
37710
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
37711
+
37628
37712
  symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
37629
37713
 
37630
37714
  if (symbolOffset) {
@@ -38680,6 +38764,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
38680
38764
  width += lineWidth;
38681
38765
  height += lineWidth;
38682
38766
 
38767
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
38768
+ x = Math.floor(x);
38769
+ width = Math.round(width);
38770
+
38683
38771
  var clipPath = new Rect({
38684
38772
  shape: {
38685
38773
  x: x,
@@ -38777,6 +38865,26 @@ function isPointsSame(points1, points2) {
38777
38865
  return true;
38778
38866
  }
38779
38867
 
38868
+ function getBoundingDiff(points1, points2) {
38869
+ var min1 = [];
38870
+ var max1 = [];
38871
+
38872
+ var min2 = [];
38873
+ var max2 = [];
38874
+
38875
+ fromPoints(points1, min1, max1);
38876
+ fromPoints(points2, min2, max2);
38877
+
38878
+ // Get a max value from each corner of two boundings.
38879
+ return Math.max(
38880
+ Math.abs(min1[0] - min2[0]),
38881
+ Math.abs(min1[1] - min2[1]),
38882
+
38883
+ Math.abs(max1[0] - max2[0]),
38884
+ Math.abs(max1[1] - max2[1])
38885
+ );
38886
+ }
38887
+
38780
38888
  function getSmooth(smooth) {
38781
38889
  return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
38782
38890
  }
@@ -39389,6 +39497,24 @@ Chart.extend({
39389
39497
  next = turnPointsIntoStep(diff.next, coordSys, step);
39390
39498
  stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
39391
39499
  }
39500
+ // Don't apply animation if diff is large.
39501
+ // For better result and avoid memory explosion problems like
39502
+ // https://github.com/apache/incubator-echarts/issues/12229
39503
+ if (getBoundingDiff(current, next) > 3000
39504
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
39505
+ ) {
39506
+ polyline.setShape({
39507
+ points: next
39508
+ });
39509
+ if (polygon) {
39510
+ polygon.setShape({
39511
+ points: next,
39512
+ stackedOnPoints: stackedOnNext
39513
+ });
39514
+ }
39515
+ return;
39516
+ }
39517
+
39392
39518
  // `diff.current` is subset of `current` (which should be ensured by
39393
39519
  // turnPointsIntoStep), so points in `__points` can be updated when
39394
39520
  // points in `current` are update during animation.
@@ -39495,13 +39621,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39495
39621
  var symbolType = seriesModel.get('symbol');
39496
39622
  var symbolSize = seriesModel.get('symbolSize');
39497
39623
  var keepAspect = seriesModel.get('symbolKeepAspect');
39624
+ var symbolRotate = seriesModel.get('symbolRotate');
39498
39625
 
39499
39626
  var hasSymbolTypeCallback = isFunction$1(symbolType);
39500
39627
  var hasSymbolSizeCallback = isFunction$1(symbolSize);
39501
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
39628
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
39629
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
39502
39630
  var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
39503
39631
  var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
39504
-
39505
39632
  data.setVisual({
39506
39633
  legendSymbol: legendSymbol || seriesSymbol,
39507
39634
  // If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -39510,7 +39637,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39510
39637
  // some cases but generally it is not recommanded.
39511
39638
  symbol: seriesSymbol,
39512
39639
  symbolSize: seriesSymbolSize,
39513
- symbolKeepAspect: keepAspect
39640
+ symbolKeepAspect: keepAspect,
39641
+ symbolRotate: symbolRotate
39514
39642
  });
39515
39643
 
39516
39644
  // Only visible series has each data be visual encoded
@@ -39524,12 +39652,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39524
39652
  var params = seriesModel.getDataParams(idx);
39525
39653
  hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
39526
39654
  hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
39655
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
39527
39656
  }
39528
39657
 
39529
39658
  if (data.hasItemOption) {
39530
39659
  var itemModel = data.getItemModel(idx);
39531
39660
  var itemSymbolType = itemModel.getShallow('symbol', true);
39532
39661
  var itemSymbolSize = itemModel.getShallow('symbolSize', true);
39662
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
39533
39663
  var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
39534
39664
 
39535
39665
  // If has item symbol
@@ -39540,6 +39670,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39540
39670
  // PENDING Transform symbolSize ?
39541
39671
  data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
39542
39672
  }
39673
+ if (itemSymbolRotate != null) {
39674
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
39675
+ }
39543
39676
  if (itemSymbolKeepAspect != null) {
39544
39677
  data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
39545
39678
  }
@@ -43415,6 +43548,7 @@ extendChartView({
43415
43548
 
43416
43549
  var drawBackground = seriesModel.get('showBackground', true);
43417
43550
  var backgroundModel = seriesModel.getModel('backgroundStyle');
43551
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
43418
43552
 
43419
43553
  var bgEls = [];
43420
43554
  var oldBgEls = this._backgroundEls || [];
@@ -43425,8 +43559,13 @@ extendChartView({
43425
43559
  var layout = getLayout[coord.type](data, dataIndex, itemModel);
43426
43560
 
43427
43561
  if (drawBackground) {
43428
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
43562
+ var bgLayout = getLayout[coord.type](data, dataIndex);
43563
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
43429
43564
  bgEl.useStyle(backgroundModel.getBarItemStyle());
43565
+ // Only cartesian2d support borderRadius.
43566
+ if (coord.type === 'cartesian2d') {
43567
+ bgEl.setShape('r', barBorderRadius);
43568
+ }
43430
43569
  bgEls[dataIndex] = bgEl;
43431
43570
  }
43432
43571
 
@@ -43463,9 +43602,14 @@ extendChartView({
43463
43602
  if (drawBackground) {
43464
43603
  var bgEl = oldBgEls[oldIndex];
43465
43604
  bgEl.useStyle(backgroundModel.getBarItemStyle());
43605
+ // Only cartesian2d support borderRadius.
43606
+ if (coord.type === 'cartesian2d') {
43607
+ bgEl.setShape('r', barBorderRadius);
43608
+ }
43466
43609
  bgEls[newIndex] = bgEl;
43467
43610
 
43468
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
43611
+ var bgLayout = getLayout[coord.type](data, newIndex);
43612
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
43469
43613
  updateProps(bgEl, { shape: shape }, animationModel, newIndex);
43470
43614
  }
43471
43615
 
@@ -43715,9 +43859,11 @@ function removeSector(dataIndex, animationModel, el) {
43715
43859
  }
43716
43860
 
43717
43861
  var getLayout = {
43862
+ // itemModel is only used to get borderWidth, which is not needed
43863
+ // when calculating bar background layout.
43718
43864
  cartesian2d: function (data, dataIndex, itemModel) {
43719
43865
  var layout = data.getItemLayout(dataIndex);
43720
- var fixedLineWidth = getLineWidth(itemModel, layout);
43866
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
43721
43867
 
43722
43868
  // fix layout with lineWidth
43723
43869
  var signX = layout.width > 0 ? 1 : -1;
@@ -44591,31 +44737,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
44591
44737
  var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
44592
44738
  this._updateLabel(data, idx, withAnimation);
44593
44739
 
44594
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
44740
+ this.highDownOnUpdate = !seriesModel.get('silent')
44595
44741
  ? function (fromState, toState) {
44742
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
44596
44743
  if (toState === 'emphasis') {
44597
44744
  labelLine.ignore = labelLine.hoverIgnore;
44598
44745
  labelText.ignore = labelText.hoverIgnore;
44599
44746
 
44600
44747
  // Sector may has animation of updating data. Force to move to the last frame
44601
44748
  // Or it may stopped on the wrong shape
44602
- sector.stopAnimation(true);
44603
- sector.animateTo({
44604
- shape: {
44605
- r: layout.r + seriesModel.get('hoverOffset')
44606
- }
44607
- }, 300, 'elasticOut');
44749
+ if (hasAnimation) {
44750
+ sector.stopAnimation(true);
44751
+ sector.animateTo({
44752
+ shape: {
44753
+ r: layout.r + seriesModel.get('hoverOffset')
44754
+ }
44755
+ }, 300, 'elasticOut');
44756
+ }
44608
44757
  }
44609
44758
  else {
44610
44759
  labelLine.ignore = labelLine.normalIgnore;
44611
44760
  labelText.ignore = labelText.normalIgnore;
44612
44761
 
44613
- sector.stopAnimation(true);
44614
- sector.animateTo({
44615
- shape: {
44616
- r: layout.r
44617
- }
44618
- }, 300, 'elasticOut');
44762
+ if (hasAnimation) {
44763
+ sector.stopAnimation(true);
44764
+ sector.animateTo({
44765
+ shape: {
44766
+ r: layout.r
44767
+ }
44768
+ }, 300, 'elasticOut');
44769
+ }
44619
44770
  }
44620
44771
  }
44621
44772
  : null;
@@ -49575,7 +49726,7 @@ extendComponentView({
49575
49726
  var dataModel = el.dataModel || seriesModel;
49576
49727
  var dataIndex = el.dataIndex;
49577
49728
  var dataType = el.dataType;
49578
- var data = dataModel.getData();
49729
+ var data = dataModel.getData(dataType);
49579
49730
 
49580
49731
  var tooltipModel = buildTooltipModel([
49581
49732
  data.getItemModel(dataIndex),
@@ -51920,12 +52071,12 @@ extendComponentView({
51920
52071
 
51921
52072
  if (link) {
51922
52073
  textEl.on('click', function () {
51923
- window.open(link, '_' + titleModel.get('target'));
52074
+ windowOpen(link, '_' + titleModel.get('target'));
51924
52075
  });
51925
52076
  }
51926
52077
  if (sublink) {
51927
52078
  subTextEl.on('click', function () {
51928
- window.open(sublink, '_' + titleModel.get('subtarget'));
52079
+ windowOpen(link, '_' + titleModel.get('subtarget'));
51929
52080
  });
51930
52081
  }
51931
52082
 
@@ -53415,9 +53566,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
53415
53566
  this.group.removeAll();
53416
53567
  };
53417
53568
 
53569
+ function isEffectObject(el) {
53570
+ return el.animators && el.animators.length > 0;
53571
+ }
53572
+
53418
53573
  lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
53419
53574
  function updateIncrementalAndHover(el) {
53420
- if (!el.isGroup) {
53575
+ if (!el.isGroup && !isEffectObject(el)) {
53421
53576
  el.incremental = el.useHoverLayer = true;
53422
53577
  }
53423
53578
  }
@@ -57925,7 +58080,7 @@ extendComponentView({
57925
58080
  var feature;
57926
58081
 
57927
58082
  // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
57928
- if (payload && payload.newTitle != null) {
58083
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
57929
58084
  featureOpt.title = payload.newTitle;
57930
58085
  }
57931
58086
 
@@ -58198,7 +58353,8 @@ var proto$2 = SaveAsImage.prototype;
58198
58353
  proto$2.onclick = function (ecModel, api) {
58199
58354
  var model = this.model;
58200
58355
  var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
58201
- var type = model.get('type', true) || 'png';
58356
+ var isSvg = api.getZr().painter.getType() === 'svg';
58357
+ var type = isSvg ? 'svg' : model.get('type', true) || 'png';
58202
58358
  var url = api.getConnectedDataURL({
58203
58359
  type: type,
58204
58360
  backgroundColor: model.get('backgroundColor', true)
@@ -58425,7 +58581,8 @@ proto$3.onclick = function (ecModel, api, type) {
58425
58581
  type: 'changeMagicType',
58426
58582
  currentType: type,
58427
58583
  newOption: newOption,
58428
- newTitle: newTitle
58584
+ newTitle: newTitle,
58585
+ featureName: 'magicType'
58429
58586
  });
58430
58587
  };
58431
58588
 
@@ -63954,11 +64111,16 @@ var SVGPainter = function (root, storage, opts, zrId) {
63954
64111
  this.storage = storage;
63955
64112
  this._opts = opts = extend({}, opts || {});
63956
64113
 
63957
- var svgRoot = createElement('svg');
63958
- svgRoot.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
63959
- svgRoot.setAttribute('version', '1.1');
63960
- svgRoot.setAttribute('baseProfile', 'full');
63961
- svgRoot.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
64114
+ var svgDom = createElement('svg');
64115
+ svgDom.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
64116
+ svgDom.setAttribute('version', '1.1');
64117
+ svgDom.setAttribute('baseProfile', 'full');
64118
+ svgDom.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
64119
+
64120
+ var bgRoot = createElement('g');
64121
+ svgDom.appendChild(bgRoot);
64122
+ var svgRoot = createElement('g');
64123
+ svgDom.appendChild(svgRoot);
63962
64124
 
63963
64125
  this.gradientManager = new GradientManager(zrId, svgRoot);
63964
64126
  this.clipPathManager = new ClippathManager(zrId, svgRoot);
@@ -63967,11 +64129,13 @@ var SVGPainter = function (root, storage, opts, zrId) {
63967
64129
  var viewport = document.createElement('div');
63968
64130
  viewport.style.cssText = 'overflow:hidden;position:relative';
63969
64131
 
64132
+ this._svgDom = svgDom;
63970
64133
  this._svgRoot = svgRoot;
64134
+ this._backgroundRoot = bgRoot;
63971
64135
  this._viewport = viewport;
63972
64136
 
63973
64137
  root.appendChild(viewport);
63974
- viewport.appendChild(svgRoot);
64138
+ viewport.appendChild(svgDom);
63975
64139
 
63976
64140
  this.resize(opts.width, opts.height);
63977
64141
 
@@ -63990,6 +64154,14 @@ SVGPainter.prototype = {
63990
64154
  return this._viewport;
63991
64155
  },
63992
64156
 
64157
+ getSvgDom: function () {
64158
+ return this._svgDom;
64159
+ },
64160
+
64161
+ getSvgRoot: function () {
64162
+ return this._svgRoot;
64163
+ },
64164
+
63993
64165
  getViewportRootOffset: function () {
63994
64166
  var viewportRoot = this.getViewportRoot();
63995
64167
  if (viewportRoot) {
@@ -64009,7 +64181,21 @@ SVGPainter.prototype = {
64009
64181
 
64010
64182
  setBackgroundColor: function (backgroundColor) {
64011
64183
  // TODO gradient
64012
- this._viewport.style.background = backgroundColor;
64184
+ // Insert a bg rect instead of setting background to viewport.
64185
+ // Otherwise, the exported SVG don't have background.
64186
+ if (this._backgroundRoot && this._backgroundNode) {
64187
+ this._backgroundRoot.removeChild(this._backgroundNode);
64188
+ }
64189
+
64190
+ var bgNode = createElement('rect');
64191
+ bgNode.setAttribute('width', this.getWidth());
64192
+ bgNode.setAttribute('height', this.getHeight());
64193
+ bgNode.setAttribute('x', 0);
64194
+ bgNode.setAttribute('y', 0);
64195
+ bgNode.setAttribute('id', 0);
64196
+ bgNode.style.fill = backgroundColor;
64197
+ this._backgroundRoot.appendChild(bgNode);
64198
+ this._backgroundNode = bgNode;
64013
64199
  },
64014
64200
 
64015
64201
  _paintList: function (list) {
@@ -64139,8 +64325,8 @@ SVGPainter.prototype = {
64139
64325
  },
64140
64326
 
64141
64327
  _getDefs: function (isForceCreating) {
64142
- var svgRoot = this._svgRoot;
64143
- var defs = this._svgRoot.getElementsByTagName('defs');
64328
+ var svgRoot = this._svgDom;
64329
+ var defs = svgRoot.getElementsByTagName('defs');
64144
64330
  if (defs.length === 0) {
64145
64331
  // Not exist
64146
64332
  if (isForceCreating) {
@@ -64197,11 +64383,16 @@ SVGPainter.prototype = {
64197
64383
  viewportStyle.width = width + 'px';
64198
64384
  viewportStyle.height = height + 'px';
64199
64385
 
64200
- var svgRoot = this._svgRoot;
64386
+ var svgRoot = this._svgDom;
64201
64387
  // Set width by 'svgRoot.width = width' is invalid
64202
64388
  svgRoot.setAttribute('width', width);
64203
64389
  svgRoot.setAttribute('height', height);
64204
64390
  }
64391
+
64392
+ if (this._backgroundNode) {
64393
+ this._backgroundNode.setAttribute('width', width);
64394
+ this._backgroundNode.setAttribute('height', height);
64395
+ }
64205
64396
  },
64206
64397
 
64207
64398
  /**
@@ -64243,10 +64434,13 @@ SVGPainter.prototype = {
64243
64434
  dispose: function () {
64244
64435
  this.root.innerHTML = '';
64245
64436
 
64246
- this._svgRoot =
64247
- this._viewport =
64248
- this.storage =
64249
- null;
64437
+ this._svgRoot
64438
+ = this._backgroundRoot
64439
+ = this._svgDom
64440
+ = this._backgroundNode
64441
+ = this._viewport
64442
+ = this.storage
64443
+ = null;
64250
64444
  },
64251
64445
 
64252
64446
  clear: function () {
@@ -64255,9 +64449,9 @@ SVGPainter.prototype = {
64255
64449
  }
64256
64450
  },
64257
64451
 
64258
- pathToDataUrl: function () {
64452
+ toDataURL: function () {
64259
64453
  this.refresh();
64260
- var html = this._svgRoot.outerHTML;
64454
+ var html = encodeURIComponent(this._svgDom.outerHTML.replace(/></g, '>\n\r<'));
64261
64455
  return 'data:image/svg+xml;charset=UTF-8,' + html;
64262
64456
  }
64263
64457
  };
@@ -64273,7 +64467,7 @@ function createMethodNotSupport$1(method) {
64273
64467
  each$1([
64274
64468
  'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer',
64275
64469
  'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer',
64276
- 'toDataURL', 'pathToImage'
64470
+ 'pathToImage'
64277
64471
  ], function (name) {
64278
64472
  SVGPainter.prototype[name] = createMethodNotSupport$1(name);
64279
64473
  });