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
  }
@@ -25703,6 +25742,32 @@ var lang = {
25703
25742
  lang: ['Right Click to Save Image']
25704
25743
  }
25705
25744
  },
25745
+ series: {
25746
+ typeNames: {
25747
+ pie: 'Pie chart',
25748
+ bar: 'Bar chart',
25749
+ line: 'Line chart',
25750
+ scatter: 'Scatter plot',
25751
+ effectScatter: 'Ripple scatter plot',
25752
+ radar: 'Radar chart',
25753
+ tree: 'Tree',
25754
+ treemap: 'Treemap',
25755
+ boxplot: 'Boxplot',
25756
+ candlestick: 'Candlestick',
25757
+ k: 'K line chart',
25758
+ heatmap: 'Heat map',
25759
+ map: 'Map',
25760
+ parallel: 'Parallel coordinate map',
25761
+ lines: 'Line graph',
25762
+ graph: 'Relationship graph',
25763
+ sankey: 'Sankey diagram',
25764
+ funnel: 'Funnel chart',
25765
+ gauge: 'Guage',
25766
+ pictorialBar: 'Pictorial bar',
25767
+ themeRiver: 'Theme River Map',
25768
+ sunburst: 'Sunburst'
25769
+ }
25770
+ },
25706
25771
  aria: {
25707
25772
  general: {
25708
25773
  withTitle: 'This is a chart about "{title}"',
@@ -25935,11 +26000,16 @@ var loadingDefault = function (api, opts) {
25935
26000
  opts = opts || {};
25936
26001
  defaults(opts, {
25937
26002
  text: 'loading',
25938
- color: '#c23531',
25939
26003
  textColor: '#000',
26004
+ fontSize: '12px',
25940
26005
  maskColor: 'rgba(255, 255, 255, 0.8)',
26006
+ showSpinner: true,
26007
+ color: '#c23531',
26008
+ spinnerRadius: 10,
26009
+ lineWidth: 5,
25941
26010
  zlevel: 0
25942
26011
  });
26012
+ var group = new Group();
25943
26013
  var mask = new Rect({
25944
26014
  style: {
25945
26015
  fill: opts.maskColor
@@ -25947,24 +26017,13 @@ var loadingDefault = function (api, opts) {
25947
26017
  zlevel: opts.zlevel,
25948
26018
  z: 10000
25949
26019
  });
25950
- var arc = new Arc({
25951
- shape: {
25952
- startAngle: -PI$1 / 2,
25953
- endAngle: -PI$1 / 2 + 0.1,
25954
- r: 10
25955
- },
25956
- style: {
25957
- stroke: opts.color,
25958
- lineCap: 'round',
25959
- lineWidth: 5
25960
- },
25961
- zlevel: opts.zlevel,
25962
- z: 10001
25963
- });
26020
+ group.add(mask);
26021
+ var font = opts.fontSize + ' sans-serif';
25964
26022
  var labelRect = new Rect({
25965
26023
  style: {
25966
26024
  fill: 'none',
25967
26025
  text: opts.text,
26026
+ font: font,
25968
26027
  textPosition: 'right',
25969
26028
  textDistance: 10,
25970
26029
  textFill: opts.textColor
@@ -25972,32 +26031,49 @@ var loadingDefault = function (api, opts) {
25972
26031
  zlevel: opts.zlevel,
25973
26032
  z: 10001
25974
26033
  });
25975
-
25976
- arc.animateShape(true)
25977
- .when(1000, {
25978
- endAngle: PI$1 * 3 / 2
25979
- })
25980
- .start('circularInOut');
25981
- arc.animateShape(true)
25982
- .when(1000, {
25983
- startAngle: PI$1 * 3 / 2
25984
- })
25985
- .delay(300)
25986
- .start('circularInOut');
25987
-
25988
- var group = new Group();
25989
- group.add(arc);
25990
26034
  group.add(labelRect);
25991
- 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
+ }
25992
26063
  // Inject resize
25993
26064
  group.resize = function () {
25994
- 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);
25995
26072
  var cy = api.getHeight() / 2;
25996
- arc.setShape({
26073
+ opts.showSpinner && arc.setShape({
25997
26074
  cx: cx,
25998
26075
  cy: cy
25999
26076
  });
26000
- var r = arc.shape.r;
26001
26077
  labelRect.setShape({
26002
26078
  x: cx - r,
26003
26079
  y: cy - r,
@@ -27653,10 +27729,10 @@ var isFunction = isFunction$1;
27653
27729
  var isObject = isObject$1;
27654
27730
  var parseClassType = ComponentModel.parseClassType;
27655
27731
 
27656
- var version = '4.7.0';
27732
+ var version = '4.8.0';
27657
27733
 
27658
27734
  var dependencies = {
27659
- zrender: '4.3.0'
27735
+ zrender: '4.3.1'
27660
27736
  };
27661
27737
 
27662
27738
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -28075,7 +28151,7 @@ echartsProto.getRenderedCanvas = function (opts) {
28075
28151
  * Get svg data url
28076
28152
  * @return {string}
28077
28153
  */
28078
- echartsProto.getSvgDataUrl = function () {
28154
+ echartsProto.getSvgDataURL = function () {
28079
28155
  if (!env$1.svgSupported) {
28080
28156
  return;
28081
28157
  }
@@ -28087,7 +28163,7 @@ echartsProto.getSvgDataUrl = function () {
28087
28163
  el.stopAnimation(true);
28088
28164
  });
28089
28165
 
28090
- return zr.painter.pathToDataUrl();
28166
+ return zr.painter.toDataURL();
28091
28167
  };
28092
28168
 
28093
28169
  /**
@@ -28123,7 +28199,7 @@ echartsProto.getDataURL = function (opts) {
28123
28199
  });
28124
28200
 
28125
28201
  var url = this._zr.painter.getType() === 'svg'
28126
- ? this.getSvgDataUrl()
28202
+ ? this.getSvgDataURL()
28127
28203
  : this.getRenderedCanvas(opts).toDataURL(
28128
28204
  'image/' + (opts && opts.type || 'png')
28129
28205
  );
@@ -28152,6 +28228,7 @@ echartsProto.getConnectedDataURL = function (opts) {
28152
28228
  if (!env$1.canvasSupported) {
28153
28229
  return;
28154
28230
  }
28231
+ var isSvg = opts.type === 'svg';
28155
28232
  var groupId = this.group;
28156
28233
  var mathMin = Math.min;
28157
28234
  var mathMax = Math.max;
@@ -28166,9 +28243,9 @@ echartsProto.getConnectedDataURL = function (opts) {
28166
28243
 
28167
28244
  each$1(instances, function (chart, id) {
28168
28245
  if (chart.group === groupId) {
28169
- var canvas = chart.getRenderedCanvas(
28170
- clone(opts)
28171
- );
28246
+ var canvas = isSvg
28247
+ ? chart.getZr().painter.getSvgDom().innerHTML
28248
+ : chart.getRenderedCanvas(clone(opts));
28172
28249
  var boundingRect = chart.getDom().getBoundingClientRect();
28173
28250
  left = mathMin(boundingRect.left, left);
28174
28251
  top = mathMin(boundingRect.top, top);
@@ -28189,38 +28266,61 @@ echartsProto.getConnectedDataURL = function (opts) {
28189
28266
  var width = right - left;
28190
28267
  var height = bottom - top;
28191
28268
  var targetCanvas = createCanvas();
28192
- targetCanvas.width = width;
28193
- targetCanvas.height = height;
28194
- 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
+ });
28195
28276
 
28196
- // Background between the charts
28197
- if (opts.connectedBackgroundColor) {
28198
- zr.add(new Rect({
28199
- shape: {
28200
- x: 0,
28201
- y: 0,
28202
- width: width,
28203
- height: height
28204
- },
28205
- style: {
28206
- fill: opts.connectedBackgroundColor
28207
- }
28208
- }));
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();
28209
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
+ }
28210
28309
 
28211
- each(canvasList, function (item) {
28212
- var img = new ZImage({
28213
- style: {
28214
- x: item.left * dpr - left,
28215
- y: item.top * dpr - top,
28216
- image: item.dom
28217
- }
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);
28218
28319
  });
28219
- zr.add(img);
28220
- });
28221
- zr.refreshImmediately();
28222
28320
 
28223
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
28321
+ zr.refreshImmediately();
28322
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
28323
+ }
28224
28324
  }
28225
28325
  else {
28226
28326
  return this.getDataURL(opts);
@@ -34628,9 +34728,11 @@ var largeLayout = {
34628
34728
 
34629
34729
  coord = cartesian.dataToPoint(valuePair, null, coord);
34630
34730
  // Data index might not be in order, depends on `progressiveChunkMode`.
34631
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
34731
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
34732
+ ? coordLayout.x + coordLayout.width : coord[0];
34632
34733
  largePoints[pointsOffset++] = coord[0];
34633
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
34734
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
34735
+ ? coord[1] : coordLayout.y + coordLayout.height;
34634
34736
  largePoints[pointsOffset++] = coord[1];
34635
34737
  largeDataIndices[idxOffset++] = dataIndex;
34636
34738
  }
@@ -35120,8 +35222,6 @@ function getScaleExtent(scale, model) {
35120
35222
 
35121
35223
  var min = model.getMin();
35122
35224
  var max = model.getMax();
35123
- var fixMin = min != null;
35124
- var fixMax = max != null;
35125
35225
  var originalExtent = scale.getExtent();
35126
35226
 
35127
35227
  var axisDataLen;
@@ -35165,17 +35265,6 @@ function getScaleExtent(scale, model) {
35165
35265
  // (2) When `needCrossZero` and all data is positive/negative, should it be ensured
35166
35266
  // that the results processed by boundaryGap are positive/negative?
35167
35267
 
35168
- if (min == null) {
35169
- min = scaleType === 'ordinal'
35170
- ? (axisDataLen ? 0 : NaN)
35171
- : originalExtent[0] - boundaryGap[0] * span;
35172
- }
35173
- if (max == null) {
35174
- max = scaleType === 'ordinal'
35175
- ? (axisDataLen ? axisDataLen - 1 : NaN)
35176
- : originalExtent[1] + boundaryGap[1] * span;
35177
- }
35178
-
35179
35268
  if (min === 'dataMin') {
35180
35269
  min = originalExtent[0];
35181
35270
  }
@@ -35196,6 +35285,20 @@ function getScaleExtent(scale, model) {
35196
35285
  });
35197
35286
  }
35198
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
+
35199
35302
  (min == null || !isFinite(min)) && (min = NaN);
35200
35303
  (max == null || !isFinite(max)) && (max = NaN);
35201
35304
 
@@ -35246,7 +35349,13 @@ function getScaleExtent(scale, model) {
35246
35349
  }
35247
35350
  }
35248
35351
 
35249
- 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
+ };
35250
35359
  }
35251
35360
 
35252
35361
  function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -35285,9 +35394,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
35285
35394
  }
35286
35395
 
35287
35396
  function niceScaleExtent(scale, model) {
35288
- var extent = getScaleExtent(scale, model);
35289
- var fixMin = model.getMin() != null;
35290
- var fixMax = model.getMax() != null;
35397
+ var extentInfo = getScaleExtent(scale, model);
35398
+ var extent = extentInfo.extent;
35399
+
35291
35400
  var splitNumber = model.get('splitNumber');
35292
35401
 
35293
35402
  if (scale.type === 'log') {
@@ -35298,8 +35407,8 @@ function niceScaleExtent(scale, model) {
35298
35407
  scale.setExtent(extent[0], extent[1]);
35299
35408
  scale.niceExtent({
35300
35409
  splitNumber: splitNumber,
35301
- fixMin: fixMin,
35302
- fixMax: fixMax,
35410
+ fixMin: extentInfo.fixMin,
35411
+ fixMax: extentInfo.fixMax,
35303
35412
  minInterval: (scaleType === 'interval' || scaleType === 'time')
35304
35413
  ? model.get('minInterval') : null,
35305
35414
  maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -36332,9 +36441,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
36332
36441
  /**
36333
36442
  * @alias module:echarts/coord/geo/parseGeoJson
36334
36443
  * @param {Object} geoJson
36444
+ * @param {string} nameProperty
36335
36445
  * @return {module:zrender/container/Group}
36336
36446
  */
36337
- var parseGeoJSON = function (geoJson) {
36447
+ var parseGeoJSON = function (geoJson, nameProperty) {
36338
36448
 
36339
36449
  decode(geoJson);
36340
36450
 
@@ -36372,7 +36482,7 @@ var parseGeoJSON = function (geoJson) {
36372
36482
  }
36373
36483
 
36374
36484
  var region = new Region(
36375
- properties.name,
36485
+ properties[nameProperty || 'name'],
36376
36486
  geometries,
36377
36487
  properties.cp
36378
36488
  );
@@ -37569,7 +37679,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37569
37679
 
37570
37680
  var itemStyle = seriesScope && seriesScope.itemStyle;
37571
37681
  var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
37572
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
37573
37682
  var symbolOffset = seriesScope && seriesScope.symbolOffset;
37574
37683
  var labelModel = seriesScope && seriesScope.labelModel;
37575
37684
  var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -37585,7 +37694,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37585
37694
  itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
37586
37695
  hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
37587
37696
 
37588
- symbolRotate = itemModel.getShallow('symbolRotate');
37589
37697
  symbolOffset = itemModel.getShallow('symbolOffset');
37590
37698
 
37591
37699
  labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -37599,6 +37707,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37599
37707
 
37600
37708
  var elStyle = symbolPath.style;
37601
37709
 
37710
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
37711
+
37602
37712
  symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
37603
37713
 
37604
37714
  if (symbolOffset) {
@@ -38654,6 +38764,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
38654
38764
  width += lineWidth;
38655
38765
  height += lineWidth;
38656
38766
 
38767
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
38768
+ x = Math.floor(x);
38769
+ width = Math.round(width);
38770
+
38657
38771
  var clipPath = new Rect({
38658
38772
  shape: {
38659
38773
  x: x,
@@ -38751,6 +38865,26 @@ function isPointsSame(points1, points2) {
38751
38865
  return true;
38752
38866
  }
38753
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
+
38754
38888
  function getSmooth(smooth) {
38755
38889
  return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
38756
38890
  }
@@ -39363,6 +39497,24 @@ Chart.extend({
39363
39497
  next = turnPointsIntoStep(diff.next, coordSys, step);
39364
39498
  stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
39365
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
+
39366
39518
  // `diff.current` is subset of `current` (which should be ensured by
39367
39519
  // turnPointsIntoStep), so points in `__points` can be updated when
39368
39520
  // points in `current` are update during animation.
@@ -39469,13 +39621,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39469
39621
  var symbolType = seriesModel.get('symbol');
39470
39622
  var symbolSize = seriesModel.get('symbolSize');
39471
39623
  var keepAspect = seriesModel.get('symbolKeepAspect');
39624
+ var symbolRotate = seriesModel.get('symbolRotate');
39472
39625
 
39473
39626
  var hasSymbolTypeCallback = isFunction$1(symbolType);
39474
39627
  var hasSymbolSizeCallback = isFunction$1(symbolSize);
39475
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
39628
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
39629
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
39476
39630
  var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
39477
39631
  var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
39478
-
39479
39632
  data.setVisual({
39480
39633
  legendSymbol: legendSymbol || seriesSymbol,
39481
39634
  // If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -39484,7 +39637,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39484
39637
  // some cases but generally it is not recommanded.
39485
39638
  symbol: seriesSymbol,
39486
39639
  symbolSize: seriesSymbolSize,
39487
- symbolKeepAspect: keepAspect
39640
+ symbolKeepAspect: keepAspect,
39641
+ symbolRotate: symbolRotate
39488
39642
  });
39489
39643
 
39490
39644
  // Only visible series has each data be visual encoded
@@ -39498,12 +39652,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39498
39652
  var params = seriesModel.getDataParams(idx);
39499
39653
  hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
39500
39654
  hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
39655
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
39501
39656
  }
39502
39657
 
39503
39658
  if (data.hasItemOption) {
39504
39659
  var itemModel = data.getItemModel(idx);
39505
39660
  var itemSymbolType = itemModel.getShallow('symbol', true);
39506
39661
  var itemSymbolSize = itemModel.getShallow('symbolSize', true);
39662
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
39507
39663
  var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
39508
39664
 
39509
39665
  // If has item symbol
@@ -39514,6 +39670,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39514
39670
  // PENDING Transform symbolSize ?
39515
39671
  data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
39516
39672
  }
39673
+ if (itemSymbolRotate != null) {
39674
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
39675
+ }
39517
39676
  if (itemSymbolKeepAspect != null) {
39518
39677
  data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
39519
39678
  }
@@ -43389,6 +43548,7 @@ extendChartView({
43389
43548
 
43390
43549
  var drawBackground = seriesModel.get('showBackground', true);
43391
43550
  var backgroundModel = seriesModel.getModel('backgroundStyle');
43551
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
43392
43552
 
43393
43553
  var bgEls = [];
43394
43554
  var oldBgEls = this._backgroundEls || [];
@@ -43399,8 +43559,13 @@ extendChartView({
43399
43559
  var layout = getLayout[coord.type](data, dataIndex, itemModel);
43400
43560
 
43401
43561
  if (drawBackground) {
43402
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
43562
+ var bgLayout = getLayout[coord.type](data, dataIndex);
43563
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
43403
43564
  bgEl.useStyle(backgroundModel.getBarItemStyle());
43565
+ // Only cartesian2d support borderRadius.
43566
+ if (coord.type === 'cartesian2d') {
43567
+ bgEl.setShape('r', barBorderRadius);
43568
+ }
43404
43569
  bgEls[dataIndex] = bgEl;
43405
43570
  }
43406
43571
 
@@ -43437,9 +43602,14 @@ extendChartView({
43437
43602
  if (drawBackground) {
43438
43603
  var bgEl = oldBgEls[oldIndex];
43439
43604
  bgEl.useStyle(backgroundModel.getBarItemStyle());
43605
+ // Only cartesian2d support borderRadius.
43606
+ if (coord.type === 'cartesian2d') {
43607
+ bgEl.setShape('r', barBorderRadius);
43608
+ }
43440
43609
  bgEls[newIndex] = bgEl;
43441
43610
 
43442
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
43611
+ var bgLayout = getLayout[coord.type](data, newIndex);
43612
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
43443
43613
  updateProps(bgEl, { shape: shape }, animationModel, newIndex);
43444
43614
  }
43445
43615
 
@@ -43689,9 +43859,11 @@ function removeSector(dataIndex, animationModel, el) {
43689
43859
  }
43690
43860
 
43691
43861
  var getLayout = {
43862
+ // itemModel is only used to get borderWidth, which is not needed
43863
+ // when calculating bar background layout.
43692
43864
  cartesian2d: function (data, dataIndex, itemModel) {
43693
43865
  var layout = data.getItemLayout(dataIndex);
43694
- var fixedLineWidth = getLineWidth(itemModel, layout);
43866
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
43695
43867
 
43696
43868
  // fix layout with lineWidth
43697
43869
  var signX = layout.width > 0 ? 1 : -1;
@@ -44565,31 +44737,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
44565
44737
  var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
44566
44738
  this._updateLabel(data, idx, withAnimation);
44567
44739
 
44568
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
44740
+ this.highDownOnUpdate = !seriesModel.get('silent')
44569
44741
  ? function (fromState, toState) {
44742
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
44570
44743
  if (toState === 'emphasis') {
44571
44744
  labelLine.ignore = labelLine.hoverIgnore;
44572
44745
  labelText.ignore = labelText.hoverIgnore;
44573
44746
 
44574
44747
  // Sector may has animation of updating data. Force to move to the last frame
44575
44748
  // Or it may stopped on the wrong shape
44576
- sector.stopAnimation(true);
44577
- sector.animateTo({
44578
- shape: {
44579
- r: layout.r + seriesModel.get('hoverOffset')
44580
- }
44581
- }, 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
+ }
44582
44757
  }
44583
44758
  else {
44584
44759
  labelLine.ignore = labelLine.normalIgnore;
44585
44760
  labelText.ignore = labelText.normalIgnore;
44586
44761
 
44587
- sector.stopAnimation(true);
44588
- sector.animateTo({
44589
- shape: {
44590
- r: layout.r
44591
- }
44592
- }, 300, 'elasticOut');
44762
+ if (hasAnimation) {
44763
+ sector.stopAnimation(true);
44764
+ sector.animateTo({
44765
+ shape: {
44766
+ r: layout.r
44767
+ }
44768
+ }, 300, 'elasticOut');
44769
+ }
44593
44770
  }
44594
44771
  }
44595
44772
  : null;
@@ -49549,7 +49726,7 @@ extendComponentView({
49549
49726
  var dataModel = el.dataModel || seriesModel;
49550
49727
  var dataIndex = el.dataIndex;
49551
49728
  var dataType = el.dataType;
49552
- var data = dataModel.getData();
49729
+ var data = dataModel.getData(dataType);
49553
49730
 
49554
49731
  var tooltipModel = buildTooltipModel([
49555
49732
  data.getItemModel(dataIndex),
@@ -51894,12 +52071,12 @@ extendComponentView({
51894
52071
 
51895
52072
  if (link) {
51896
52073
  textEl.on('click', function () {
51897
- window.open(link, '_' + titleModel.get('target'));
52074
+ windowOpen(link, '_' + titleModel.get('target'));
51898
52075
  });
51899
52076
  }
51900
52077
  if (sublink) {
51901
52078
  subTextEl.on('click', function () {
51902
- window.open(sublink, '_' + titleModel.get('subtarget'));
52079
+ windowOpen(link, '_' + titleModel.get('subtarget'));
51903
52080
  });
51904
52081
  }
51905
52082
 
@@ -53389,9 +53566,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
53389
53566
  this.group.removeAll();
53390
53567
  };
53391
53568
 
53569
+ function isEffectObject(el) {
53570
+ return el.animators && el.animators.length > 0;
53571
+ }
53572
+
53392
53573
  lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
53393
53574
  function updateIncrementalAndHover(el) {
53394
- if (!el.isGroup) {
53575
+ if (!el.isGroup && !isEffectObject(el)) {
53395
53576
  el.incremental = el.useHoverLayer = true;
53396
53577
  }
53397
53578
  }
@@ -57899,7 +58080,7 @@ extendComponentView({
57899
58080
  var feature;
57900
58081
 
57901
58082
  // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
57902
- if (payload && payload.newTitle != null) {
58083
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
57903
58084
  featureOpt.title = payload.newTitle;
57904
58085
  }
57905
58086
 
@@ -58172,7 +58353,8 @@ var proto$2 = SaveAsImage.prototype;
58172
58353
  proto$2.onclick = function (ecModel, api) {
58173
58354
  var model = this.model;
58174
58355
  var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
58175
- 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';
58176
58358
  var url = api.getConnectedDataURL({
58177
58359
  type: type,
58178
58360
  backgroundColor: model.get('backgroundColor', true)
@@ -58399,7 +58581,8 @@ proto$3.onclick = function (ecModel, api, type) {
58399
58581
  type: 'changeMagicType',
58400
58582
  currentType: type,
58401
58583
  newOption: newOption,
58402
- newTitle: newTitle
58584
+ newTitle: newTitle,
58585
+ featureName: 'magicType'
58403
58586
  });
58404
58587
  };
58405
58588
 
@@ -63928,11 +64111,16 @@ var SVGPainter = function (root, storage, opts, zrId) {
63928
64111
  this.storage = storage;
63929
64112
  this._opts = opts = extend({}, opts || {});
63930
64113
 
63931
- var svgRoot = createElement('svg');
63932
- svgRoot.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
63933
- svgRoot.setAttribute('version', '1.1');
63934
- svgRoot.setAttribute('baseProfile', 'full');
63935
- 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);
63936
64124
 
63937
64125
  this.gradientManager = new GradientManager(zrId, svgRoot);
63938
64126
  this.clipPathManager = new ClippathManager(zrId, svgRoot);
@@ -63941,11 +64129,13 @@ var SVGPainter = function (root, storage, opts, zrId) {
63941
64129
  var viewport = document.createElement('div');
63942
64130
  viewport.style.cssText = 'overflow:hidden;position:relative';
63943
64131
 
64132
+ this._svgDom = svgDom;
63944
64133
  this._svgRoot = svgRoot;
64134
+ this._backgroundRoot = bgRoot;
63945
64135
  this._viewport = viewport;
63946
64136
 
63947
64137
  root.appendChild(viewport);
63948
- viewport.appendChild(svgRoot);
64138
+ viewport.appendChild(svgDom);
63949
64139
 
63950
64140
  this.resize(opts.width, opts.height);
63951
64141
 
@@ -63964,6 +64154,14 @@ SVGPainter.prototype = {
63964
64154
  return this._viewport;
63965
64155
  },
63966
64156
 
64157
+ getSvgDom: function () {
64158
+ return this._svgDom;
64159
+ },
64160
+
64161
+ getSvgRoot: function () {
64162
+ return this._svgRoot;
64163
+ },
64164
+
63967
64165
  getViewportRootOffset: function () {
63968
64166
  var viewportRoot = this.getViewportRoot();
63969
64167
  if (viewportRoot) {
@@ -63983,7 +64181,21 @@ SVGPainter.prototype = {
63983
64181
 
63984
64182
  setBackgroundColor: function (backgroundColor) {
63985
64183
  // TODO gradient
63986
- 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;
63987
64199
  },
63988
64200
 
63989
64201
  _paintList: function (list) {
@@ -64113,8 +64325,8 @@ SVGPainter.prototype = {
64113
64325
  },
64114
64326
 
64115
64327
  _getDefs: function (isForceCreating) {
64116
- var svgRoot = this._svgRoot;
64117
- var defs = this._svgRoot.getElementsByTagName('defs');
64328
+ var svgRoot = this._svgDom;
64329
+ var defs = svgRoot.getElementsByTagName('defs');
64118
64330
  if (defs.length === 0) {
64119
64331
  // Not exist
64120
64332
  if (isForceCreating) {
@@ -64171,11 +64383,16 @@ SVGPainter.prototype = {
64171
64383
  viewportStyle.width = width + 'px';
64172
64384
  viewportStyle.height = height + 'px';
64173
64385
 
64174
- var svgRoot = this._svgRoot;
64386
+ var svgRoot = this._svgDom;
64175
64387
  // Set width by 'svgRoot.width = width' is invalid
64176
64388
  svgRoot.setAttribute('width', width);
64177
64389
  svgRoot.setAttribute('height', height);
64178
64390
  }
64391
+
64392
+ if (this._backgroundNode) {
64393
+ this._backgroundNode.setAttribute('width', width);
64394
+ this._backgroundNode.setAttribute('height', height);
64395
+ }
64179
64396
  },
64180
64397
 
64181
64398
  /**
@@ -64217,10 +64434,13 @@ SVGPainter.prototype = {
64217
64434
  dispose: function () {
64218
64435
  this.root.innerHTML = '';
64219
64436
 
64220
- this._svgRoot =
64221
- this._viewport =
64222
- this.storage =
64223
- null;
64437
+ this._svgRoot
64438
+ = this._backgroundRoot
64439
+ = this._svgDom
64440
+ = this._backgroundNode
64441
+ = this._viewport
64442
+ = this.storage
64443
+ = null;
64224
64444
  },
64225
64445
 
64226
64446
  clear: function () {
@@ -64229,9 +64449,9 @@ SVGPainter.prototype = {
64229
64449
  }
64230
64450
  },
64231
64451
 
64232
- pathToDataUrl: function () {
64452
+ toDataURL: function () {
64233
64453
  this.refresh();
64234
- var html = this._svgRoot.outerHTML;
64454
+ var html = encodeURIComponent(this._svgDom.outerHTML.replace(/></g, '>\n\r<'));
64235
64455
  return 'data:image/svg+xml;charset=UTF-8,' + html;
64236
64456
  }
64237
64457
  };
@@ -64247,7 +64467,7 @@ function createMethodNotSupport$1(method) {
64247
64467
  each$1([
64248
64468
  'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer',
64249
64469
  'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer',
64250
- 'toDataURL', 'pathToImage'
64470
+ 'pathToImage'
64251
64471
  ], function (name) {
64252
64472
  SVGPainter.prototype[name] = createMethodNotSupport$1(name);
64253
64473
  });