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
package/dist/echarts.js CHANGED
@@ -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
@@ -17838,11 +17857,13 @@ function getHighlightDigit(highlightKey) {
17838
17857
  * @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
17839
17858
  * @param {string|Function} [opt.defaultText]
17840
17859
  * @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
17841
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17842
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
17843
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17844
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
17845
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
17860
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17861
+ * @param {number} [opt.labelDataIndex] Fetch text by
17862
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17863
+ * @param {number} [opt.labelDimIndex] Fetch text by
17864
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17865
+ * @param {string} [opt.labelProp] Fetch text by
17866
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
17846
17867
  * @param {Object} [normalSpecified]
17847
17868
  * @param {Object} [emphasisSpecified]
17848
17869
  */
@@ -17856,6 +17877,7 @@ function setLabelStyle(
17856
17877
  var labelFetcher = opt.labelFetcher;
17857
17878
  var labelDataIndex = opt.labelDataIndex;
17858
17879
  var labelDimIndex = opt.labelDimIndex;
17880
+ var labelProp = opt.labelProp;
17859
17881
 
17860
17882
  // This scenario, `label.normal.show = true; label.emphasis.show = false`,
17861
17883
  // is not supported util someone requests.
@@ -17869,7 +17891,7 @@ function setLabelStyle(
17869
17891
  var baseText;
17870
17892
  if (showNormal || showEmphasis) {
17871
17893
  if (labelFetcher) {
17872
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
17894
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
17873
17895
  }
17874
17896
  if (baseText == null) {
17875
17897
  baseText = isFunction$1(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -17879,7 +17901,7 @@ function setLabelStyle(
17879
17901
  var emphasisStyleText = showEmphasis
17880
17902
  ? retrieve2(
17881
17903
  labelFetcher
17882
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
17904
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
17883
17905
  : null,
17884
17906
  baseText
17885
17907
  )
@@ -19790,7 +19812,7 @@ var number = (Object.freeze || Object)({
19790
19812
  // import Text from 'zrender/src/graphic/Text';
19791
19813
 
19792
19814
  /**
19793
- * 每三位默认加,格式化
19815
+ * add commas after every three numbers
19794
19816
  * @param {string|number} x
19795
19817
  * @return {string}
19796
19818
  */
@@ -20043,6 +20065,22 @@ function getTextRect(
20043
20065
  );
20044
20066
  }
20045
20067
 
20068
+ /**
20069
+ * open new tab
20070
+ * @param {string} link url
20071
+ * @param {string} target blank or self
20072
+ */
20073
+ function windowOpen(link, target) {
20074
+ if (target === '_blank' || target === 'blank') {
20075
+ var blank = window.open();
20076
+ blank.opener = null;
20077
+ blank.location = link;
20078
+ }
20079
+ else {
20080
+ window.open(link, target);
20081
+ }
20082
+ }
20083
+
20046
20084
 
20047
20085
  var format = (Object.freeze || Object)({
20048
20086
  addCommas: addCommas,
@@ -20056,7 +20094,8 @@ var format = (Object.freeze || Object)({
20056
20094
  capitalFirst: capitalFirst,
20057
20095
  truncateText: truncateText$1,
20058
20096
  getTextBoundingRect: getTextBoundingRect,
20059
- getTextRect: getTextRect
20097
+ getTextRect: getTextRect,
20098
+ windowOpen: windowOpen
20060
20099
  });
20061
20100
 
20062
20101
  /*
@@ -25060,7 +25099,7 @@ function dataTaskReset(context) {
25060
25099
 
25061
25100
  function dataTaskProgress(param, context) {
25062
25101
  // Avoid repead cloneShallow when data just created in reset.
25063
- if (param.end > context.outputData.count()) {
25102
+ if (context.outputData && param.end > context.outputData.count()) {
25064
25103
  context.model.getRawData().cloneShallow(context.outputData);
25065
25104
  }
25066
25105
  }
@@ -26040,11 +26079,16 @@ var loadingDefault = function (api, opts) {
26040
26079
  opts = opts || {};
26041
26080
  defaults(opts, {
26042
26081
  text: 'loading',
26043
- color: '#c23531',
26044
26082
  textColor: '#000',
26083
+ fontSize: '12px',
26045
26084
  maskColor: 'rgba(255, 255, 255, 0.8)',
26085
+ showSpinner: true,
26086
+ color: '#c23531',
26087
+ spinnerRadius: 10,
26088
+ lineWidth: 5,
26046
26089
  zlevel: 0
26047
26090
  });
26091
+ var group = new Group();
26048
26092
  var mask = new Rect({
26049
26093
  style: {
26050
26094
  fill: opts.maskColor
@@ -26052,24 +26096,13 @@ var loadingDefault = function (api, opts) {
26052
26096
  zlevel: opts.zlevel,
26053
26097
  z: 10000
26054
26098
  });
26055
- var arc = new Arc({
26056
- shape: {
26057
- startAngle: -PI$1 / 2,
26058
- endAngle: -PI$1 / 2 + 0.1,
26059
- r: 10
26060
- },
26061
- style: {
26062
- stroke: opts.color,
26063
- lineCap: 'round',
26064
- lineWidth: 5
26065
- },
26066
- zlevel: opts.zlevel,
26067
- z: 10001
26068
- });
26099
+ group.add(mask);
26100
+ var font = opts.fontSize + ' sans-serif';
26069
26101
  var labelRect = new Rect({
26070
26102
  style: {
26071
26103
  fill: 'none',
26072
26104
  text: opts.text,
26105
+ font: font,
26073
26106
  textPosition: 'right',
26074
26107
  textDistance: 10,
26075
26108
  textFill: opts.textColor
@@ -26077,32 +26110,49 @@ var loadingDefault = function (api, opts) {
26077
26110
  zlevel: opts.zlevel,
26078
26111
  z: 10001
26079
26112
  });
26080
-
26081
- arc.animateShape(true)
26082
- .when(1000, {
26083
- endAngle: PI$1 * 3 / 2
26084
- })
26085
- .start('circularInOut');
26086
- arc.animateShape(true)
26087
- .when(1000, {
26088
- startAngle: PI$1 * 3 / 2
26089
- })
26090
- .delay(300)
26091
- .start('circularInOut');
26092
-
26093
- var group = new Group();
26094
- group.add(arc);
26095
26113
  group.add(labelRect);
26096
- group.add(mask);
26114
+ if (opts.showSpinner) {
26115
+ var arc = new Arc({
26116
+ shape: {
26117
+ startAngle: -PI$1 / 2,
26118
+ endAngle: -PI$1 / 2 + 0.1,
26119
+ r: opts.spinnerRadius
26120
+ },
26121
+ style: {
26122
+ stroke: opts.color,
26123
+ lineCap: 'round',
26124
+ lineWidth: opts.lineWidth
26125
+ },
26126
+ zlevel: opts.zlevel,
26127
+ z: 10001
26128
+ });
26129
+ arc.animateShape(true)
26130
+ .when(1000, {
26131
+ endAngle: PI$1 * 3 / 2
26132
+ })
26133
+ .start('circularInOut');
26134
+ arc.animateShape(true)
26135
+ .when(1000, {
26136
+ startAngle: PI$1 * 3 / 2
26137
+ })
26138
+ .delay(300)
26139
+ .start('circularInOut');
26140
+ group.add(arc);
26141
+ }
26097
26142
  // Inject resize
26098
26143
  group.resize = function () {
26099
- var cx = api.getWidth() / 2;
26144
+ var textWidth = getWidth(opts.text, font);
26145
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
26146
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
26147
+ // textDistance needs to be calculated when both animation and text exist
26148
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
26149
+ // only show the text
26150
+ - (opts.showSpinner ? 0 : textWidth / 2);
26100
26151
  var cy = api.getHeight() / 2;
26101
- arc.setShape({
26152
+ opts.showSpinner && arc.setShape({
26102
26153
  cx: cx,
26103
26154
  cy: cy
26104
26155
  });
26105
- var r = arc.shape.r;
26106
26156
  labelRect.setShape({
26107
26157
  x: cx - r,
26108
26158
  y: cy - r,
@@ -27762,10 +27812,10 @@ var isFunction = isFunction$1;
27762
27812
  var isObject = isObject$1;
27763
27813
  var parseClassType = ComponentModel.parseClassType;
27764
27814
 
27765
- var version = '4.7.0';
27815
+ var version = '4.8.0';
27766
27816
 
27767
27817
  var dependencies = {
27768
- zrender: '4.3.0'
27818
+ zrender: '4.3.1'
27769
27819
  };
27770
27820
 
27771
27821
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -28184,7 +28234,7 @@ echartsProto.getRenderedCanvas = function (opts) {
28184
28234
  * Get svg data url
28185
28235
  * @return {string}
28186
28236
  */
28187
- echartsProto.getSvgDataUrl = function () {
28237
+ echartsProto.getSvgDataURL = function () {
28188
28238
  if (!env$1.svgSupported) {
28189
28239
  return;
28190
28240
  }
@@ -28196,7 +28246,7 @@ echartsProto.getSvgDataUrl = function () {
28196
28246
  el.stopAnimation(true);
28197
28247
  });
28198
28248
 
28199
- return zr.painter.pathToDataUrl();
28249
+ return zr.painter.toDataURL();
28200
28250
  };
28201
28251
 
28202
28252
  /**
@@ -28232,7 +28282,7 @@ echartsProto.getDataURL = function (opts) {
28232
28282
  });
28233
28283
 
28234
28284
  var url = this._zr.painter.getType() === 'svg'
28235
- ? this.getSvgDataUrl()
28285
+ ? this.getSvgDataURL()
28236
28286
  : this.getRenderedCanvas(opts).toDataURL(
28237
28287
  'image/' + (opts && opts.type || 'png')
28238
28288
  );
@@ -28261,6 +28311,7 @@ echartsProto.getConnectedDataURL = function (opts) {
28261
28311
  if (!env$1.canvasSupported) {
28262
28312
  return;
28263
28313
  }
28314
+ var isSvg = opts.type === 'svg';
28264
28315
  var groupId = this.group;
28265
28316
  var mathMin = Math.min;
28266
28317
  var mathMax = Math.max;
@@ -28275,9 +28326,9 @@ echartsProto.getConnectedDataURL = function (opts) {
28275
28326
 
28276
28327
  each$1(instances, function (chart, id) {
28277
28328
  if (chart.group === groupId) {
28278
- var canvas = chart.getRenderedCanvas(
28279
- clone(opts)
28280
- );
28329
+ var canvas = isSvg
28330
+ ? chart.getZr().painter.getSvgDom().innerHTML
28331
+ : chart.getRenderedCanvas(clone(opts));
28281
28332
  var boundingRect = chart.getDom().getBoundingClientRect();
28282
28333
  left = mathMin(boundingRect.left, left);
28283
28334
  top = mathMin(boundingRect.top, top);
@@ -28298,38 +28349,61 @@ echartsProto.getConnectedDataURL = function (opts) {
28298
28349
  var width = right - left;
28299
28350
  var height = bottom - top;
28300
28351
  var targetCanvas = createCanvas();
28301
- targetCanvas.width = width;
28302
- targetCanvas.height = height;
28303
- var zr = init$1(targetCanvas);
28352
+ var zr = init$1(targetCanvas, {
28353
+ renderer: isSvg ? 'svg' : 'canvas'
28354
+ });
28355
+ zr.resize({
28356
+ width: width,
28357
+ height: height
28358
+ });
28304
28359
 
28305
- // Background between the charts
28306
- if (opts.connectedBackgroundColor) {
28307
- zr.add(new Rect({
28308
- shape: {
28309
- x: 0,
28310
- y: 0,
28311
- width: width,
28312
- height: height
28313
- },
28314
- style: {
28315
- fill: opts.connectedBackgroundColor
28316
- }
28317
- }));
28360
+ if (isSvg) {
28361
+ var content = '';
28362
+ each(canvasList, function (item) {
28363
+ var x = item.left - left;
28364
+ var y = item.top - top;
28365
+ content += '<g transform="translate(' + x + ','
28366
+ + y + ')">' + item.dom + '</g>';
28367
+ });
28368
+ zr.painter.getSvgRoot().innerHTML = content;
28369
+
28370
+ if (opts.connectedBackgroundColor) {
28371
+ zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
28372
+ }
28373
+
28374
+ zr.refreshImmediately();
28375
+ return zr.painter.toDataURL();
28318
28376
  }
28377
+ else {
28378
+ // Background between the charts
28379
+ if (opts.connectedBackgroundColor) {
28380
+ zr.add(new Rect({
28381
+ shape: {
28382
+ x: 0,
28383
+ y: 0,
28384
+ width: width,
28385
+ height: height
28386
+ },
28387
+ style: {
28388
+ fill: opts.connectedBackgroundColor
28389
+ }
28390
+ }));
28391
+ }
28319
28392
 
28320
- each(canvasList, function (item) {
28321
- var img = new ZImage({
28322
- style: {
28323
- x: item.left * dpr - left,
28324
- y: item.top * dpr - top,
28325
- image: item.dom
28326
- }
28393
+ each(canvasList, function (item) {
28394
+ var img = new ZImage({
28395
+ style: {
28396
+ x: item.left * dpr - left,
28397
+ y: item.top * dpr - top,
28398
+ image: item.dom
28399
+ }
28400
+ });
28401
+ zr.add(img);
28327
28402
  });
28328
- zr.add(img);
28329
- });
28330
- zr.refreshImmediately();
28331
28403
 
28332
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
28404
+ zr.refreshImmediately();
28405
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
28406
+ }
28333
28407
  }
28334
28408
  else {
28335
28409
  return this.getDataURL(opts);
@@ -34764,9 +34838,11 @@ var largeLayout = {
34764
34838
 
34765
34839
  coord = cartesian.dataToPoint(valuePair, null, coord);
34766
34840
  // Data index might not be in order, depends on `progressiveChunkMode`.
34767
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
34841
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
34842
+ ? coordLayout.x + coordLayout.width : coord[0];
34768
34843
  largePoints[pointsOffset++] = coord[0];
34769
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
34844
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
34845
+ ? coord[1] : coordLayout.y + coordLayout.height;
34770
34846
  largePoints[pointsOffset++] = coord[1];
34771
34847
  largeDataIndices[idxOffset++] = dataIndex;
34772
34848
  }
@@ -35256,8 +35332,6 @@ function getScaleExtent(scale, model) {
35256
35332
 
35257
35333
  var min = model.getMin();
35258
35334
  var max = model.getMax();
35259
- var fixMin = min != null;
35260
- var fixMax = max != null;
35261
35335
  var originalExtent = scale.getExtent();
35262
35336
 
35263
35337
  var axisDataLen;
@@ -35301,17 +35375,6 @@ function getScaleExtent(scale, model) {
35301
35375
  // (2) When `needCrossZero` and all data is positive/negative, should it be ensured
35302
35376
  // that the results processed by boundaryGap are positive/negative?
35303
35377
 
35304
- if (min == null) {
35305
- min = scaleType === 'ordinal'
35306
- ? (axisDataLen ? 0 : NaN)
35307
- : originalExtent[0] - boundaryGap[0] * span;
35308
- }
35309
- if (max == null) {
35310
- max = scaleType === 'ordinal'
35311
- ? (axisDataLen ? axisDataLen - 1 : NaN)
35312
- : originalExtent[1] + boundaryGap[1] * span;
35313
- }
35314
-
35315
35378
  if (min === 'dataMin') {
35316
35379
  min = originalExtent[0];
35317
35380
  }
@@ -35332,6 +35395,20 @@ function getScaleExtent(scale, model) {
35332
35395
  });
35333
35396
  }
35334
35397
 
35398
+ var fixMin = min != null;
35399
+ var fixMax = max != null;
35400
+
35401
+ if (min == null) {
35402
+ min = scaleType === 'ordinal'
35403
+ ? (axisDataLen ? 0 : NaN)
35404
+ : originalExtent[0] - boundaryGap[0] * span;
35405
+ }
35406
+ if (max == null) {
35407
+ max = scaleType === 'ordinal'
35408
+ ? (axisDataLen ? axisDataLen - 1 : NaN)
35409
+ : originalExtent[1] + boundaryGap[1] * span;
35410
+ }
35411
+
35335
35412
  (min == null || !isFinite(min)) && (min = NaN);
35336
35413
  (max == null || !isFinite(max)) && (max = NaN);
35337
35414
 
@@ -35382,7 +35459,13 @@ function getScaleExtent(scale, model) {
35382
35459
  }
35383
35460
  }
35384
35461
 
35385
- return [min, max];
35462
+ return {
35463
+ extent: [min, max],
35464
+ // "fix" means "fixed", the value should not be
35465
+ // changed in the subsequent steps.
35466
+ fixMin: fixMin,
35467
+ fixMax: fixMax
35468
+ };
35386
35469
  }
35387
35470
 
35388
35471
  function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -35421,9 +35504,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
35421
35504
  }
35422
35505
 
35423
35506
  function niceScaleExtent(scale, model) {
35424
- var extent = getScaleExtent(scale, model);
35425
- var fixMin = model.getMin() != null;
35426
- var fixMax = model.getMax() != null;
35507
+ var extentInfo = getScaleExtent(scale, model);
35508
+ var extent = extentInfo.extent;
35509
+
35427
35510
  var splitNumber = model.get('splitNumber');
35428
35511
 
35429
35512
  if (scale.type === 'log') {
@@ -35434,8 +35517,8 @@ function niceScaleExtent(scale, model) {
35434
35517
  scale.setExtent(extent[0], extent[1]);
35435
35518
  scale.niceExtent({
35436
35519
  splitNumber: splitNumber,
35437
- fixMin: fixMin,
35438
- fixMax: fixMax,
35520
+ fixMin: extentInfo.fixMin,
35521
+ fixMax: extentInfo.fixMax,
35439
35522
  minInterval: (scaleType === 'interval' || scaleType === 'time')
35440
35523
  ? model.get('minInterval') : null,
35441
35524
  maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -36468,9 +36551,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
36468
36551
  /**
36469
36552
  * @alias module:echarts/coord/geo/parseGeoJson
36470
36553
  * @param {Object} geoJson
36554
+ * @param {string} nameProperty
36471
36555
  * @return {module:zrender/container/Group}
36472
36556
  */
36473
- var parseGeoJson$1 = function (geoJson) {
36557
+ var parseGeoJson$1 = function (geoJson, nameProperty) {
36474
36558
 
36475
36559
  decode(geoJson);
36476
36560
 
@@ -36508,7 +36592,7 @@ var parseGeoJson$1 = function (geoJson) {
36508
36592
  }
36509
36593
 
36510
36594
  var region = new Region(
36511
- properties.name,
36595
+ properties[nameProperty || 'name'],
36512
36596
  geometries,
36513
36597
  properties.cp
36514
36598
  );
@@ -37705,7 +37789,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37705
37789
 
37706
37790
  var itemStyle = seriesScope && seriesScope.itemStyle;
37707
37791
  var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
37708
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
37709
37792
  var symbolOffset = seriesScope && seriesScope.symbolOffset;
37710
37793
  var labelModel = seriesScope && seriesScope.labelModel;
37711
37794
  var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -37721,7 +37804,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37721
37804
  itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
37722
37805
  hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
37723
37806
 
37724
- symbolRotate = itemModel.getShallow('symbolRotate');
37725
37807
  symbolOffset = itemModel.getShallow('symbolOffset');
37726
37808
 
37727
37809
  labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -37735,6 +37817,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37735
37817
 
37736
37818
  var elStyle = symbolPath.style;
37737
37819
 
37820
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
37821
+
37738
37822
  symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
37739
37823
 
37740
37824
  if (symbolOffset) {
@@ -38790,6 +38874,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
38790
38874
  width += lineWidth;
38791
38875
  height += lineWidth;
38792
38876
 
38877
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
38878
+ x = Math.floor(x);
38879
+ width = Math.round(width);
38880
+
38793
38881
  var clipPath = new Rect({
38794
38882
  shape: {
38795
38883
  x: x,
@@ -38887,6 +38975,26 @@ function isPointsSame(points1, points2) {
38887
38975
  return true;
38888
38976
  }
38889
38977
 
38978
+ function getBoundingDiff(points1, points2) {
38979
+ var min1 = [];
38980
+ var max1 = [];
38981
+
38982
+ var min2 = [];
38983
+ var max2 = [];
38984
+
38985
+ fromPoints(points1, min1, max1);
38986
+ fromPoints(points2, min2, max2);
38987
+
38988
+ // Get a max value from each corner of two boundings.
38989
+ return Math.max(
38990
+ Math.abs(min1[0] - min2[0]),
38991
+ Math.abs(min1[1] - min2[1]),
38992
+
38993
+ Math.abs(max1[0] - max2[0]),
38994
+ Math.abs(max1[1] - max2[1])
38995
+ );
38996
+ }
38997
+
38890
38998
  function getSmooth(smooth) {
38891
38999
  return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
38892
39000
  }
@@ -39499,6 +39607,24 @@ Chart.extend({
39499
39607
  next = turnPointsIntoStep(diff.next, coordSys, step);
39500
39608
  stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
39501
39609
  }
39610
+ // Don't apply animation if diff is large.
39611
+ // For better result and avoid memory explosion problems like
39612
+ // https://github.com/apache/incubator-echarts/issues/12229
39613
+ if (getBoundingDiff(current, next) > 3000
39614
+ || (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
39615
+ ) {
39616
+ polyline.setShape({
39617
+ points: next
39618
+ });
39619
+ if (polygon) {
39620
+ polygon.setShape({
39621
+ points: next,
39622
+ stackedOnPoints: stackedOnNext
39623
+ });
39624
+ }
39625
+ return;
39626
+ }
39627
+
39502
39628
  // `diff.current` is subset of `current` (which should be ensured by
39503
39629
  // turnPointsIntoStep), so points in `__points` can be updated when
39504
39630
  // points in `current` are update during animation.
@@ -39605,13 +39731,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39605
39731
  var symbolType = seriesModel.get('symbol');
39606
39732
  var symbolSize = seriesModel.get('symbolSize');
39607
39733
  var keepAspect = seriesModel.get('symbolKeepAspect');
39734
+ var symbolRotate = seriesModel.get('symbolRotate');
39608
39735
 
39609
39736
  var hasSymbolTypeCallback = isFunction$1(symbolType);
39610
39737
  var hasSymbolSizeCallback = isFunction$1(symbolSize);
39611
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
39738
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
39739
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
39612
39740
  var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
39613
39741
  var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
39614
-
39615
39742
  data.setVisual({
39616
39743
  legendSymbol: legendSymbol || seriesSymbol,
39617
39744
  // If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -39620,7 +39747,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39620
39747
  // some cases but generally it is not recommanded.
39621
39748
  symbol: seriesSymbol,
39622
39749
  symbolSize: seriesSymbolSize,
39623
- symbolKeepAspect: keepAspect
39750
+ symbolKeepAspect: keepAspect,
39751
+ symbolRotate: symbolRotate
39624
39752
  });
39625
39753
 
39626
39754
  // Only visible series has each data be visual encoded
@@ -39634,12 +39762,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39634
39762
  var params = seriesModel.getDataParams(idx);
39635
39763
  hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
39636
39764
  hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
39765
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
39637
39766
  }
39638
39767
 
39639
39768
  if (data.hasItemOption) {
39640
39769
  var itemModel = data.getItemModel(idx);
39641
39770
  var itemSymbolType = itemModel.getShallow('symbol', true);
39642
39771
  var itemSymbolSize = itemModel.getShallow('symbolSize', true);
39772
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
39643
39773
  var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
39644
39774
 
39645
39775
  // If has item symbol
@@ -39650,6 +39780,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39650
39780
  // PENDING Transform symbolSize ?
39651
39781
  data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
39652
39782
  }
39783
+ if (itemSymbolRotate != null) {
39784
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
39785
+ }
39653
39786
  if (itemSymbolKeepAspect != null) {
39654
39787
  data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
39655
39788
  }
@@ -43525,6 +43658,7 @@ extendChartView({
43525
43658
 
43526
43659
  var drawBackground = seriesModel.get('showBackground', true);
43527
43660
  var backgroundModel = seriesModel.getModel('backgroundStyle');
43661
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
43528
43662
 
43529
43663
  var bgEls = [];
43530
43664
  var oldBgEls = this._backgroundEls || [];
@@ -43535,8 +43669,13 @@ extendChartView({
43535
43669
  var layout = getLayout[coord.type](data, dataIndex, itemModel);
43536
43670
 
43537
43671
  if (drawBackground) {
43538
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
43672
+ var bgLayout = getLayout[coord.type](data, dataIndex);
43673
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
43539
43674
  bgEl.useStyle(backgroundModel.getBarItemStyle());
43675
+ // Only cartesian2d support borderRadius.
43676
+ if (coord.type === 'cartesian2d') {
43677
+ bgEl.setShape('r', barBorderRadius);
43678
+ }
43540
43679
  bgEls[dataIndex] = bgEl;
43541
43680
  }
43542
43681
 
@@ -43573,9 +43712,14 @@ extendChartView({
43573
43712
  if (drawBackground) {
43574
43713
  var bgEl = oldBgEls[oldIndex];
43575
43714
  bgEl.useStyle(backgroundModel.getBarItemStyle());
43715
+ // Only cartesian2d support borderRadius.
43716
+ if (coord.type === 'cartesian2d') {
43717
+ bgEl.setShape('r', barBorderRadius);
43718
+ }
43576
43719
  bgEls[newIndex] = bgEl;
43577
43720
 
43578
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
43721
+ var bgLayout = getLayout[coord.type](data, newIndex);
43722
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
43579
43723
  updateProps(bgEl, { shape: shape }, animationModel, newIndex);
43580
43724
  }
43581
43725
 
@@ -43825,9 +43969,11 @@ function removeSector(dataIndex, animationModel, el) {
43825
43969
  }
43826
43970
 
43827
43971
  var getLayout = {
43972
+ // itemModel is only used to get borderWidth, which is not needed
43973
+ // when calculating bar background layout.
43828
43974
  cartesian2d: function (data, dataIndex, itemModel) {
43829
43975
  var layout = data.getItemLayout(dataIndex);
43830
- var fixedLineWidth = getLineWidth(itemModel, layout);
43976
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
43831
43977
 
43832
43978
  // fix layout with lineWidth
43833
43979
  var signX = layout.width > 0 ? 1 : -1;
@@ -44701,31 +44847,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
44701
44847
  var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
44702
44848
  this._updateLabel(data, idx, withAnimation);
44703
44849
 
44704
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
44850
+ this.highDownOnUpdate = !seriesModel.get('silent')
44705
44851
  ? function (fromState, toState) {
44852
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
44706
44853
  if (toState === 'emphasis') {
44707
44854
  labelLine.ignore = labelLine.hoverIgnore;
44708
44855
  labelText.ignore = labelText.hoverIgnore;
44709
44856
 
44710
44857
  // Sector may has animation of updating data. Force to move to the last frame
44711
44858
  // Or it may stopped on the wrong shape
44712
- sector.stopAnimation(true);
44713
- sector.animateTo({
44714
- shape: {
44715
- r: layout.r + seriesModel.get('hoverOffset')
44716
- }
44717
- }, 300, 'elasticOut');
44859
+ if (hasAnimation) {
44860
+ sector.stopAnimation(true);
44861
+ sector.animateTo({
44862
+ shape: {
44863
+ r: layout.r + seriesModel.get('hoverOffset')
44864
+ }
44865
+ }, 300, 'elasticOut');
44866
+ }
44718
44867
  }
44719
44868
  else {
44720
44869
  labelLine.ignore = labelLine.normalIgnore;
44721
44870
  labelText.ignore = labelText.normalIgnore;
44722
44871
 
44723
- sector.stopAnimation(true);
44724
- sector.animateTo({
44725
- shape: {
44726
- r: layout.r
44727
- }
44728
- }, 300, 'elasticOut');
44872
+ if (hasAnimation) {
44873
+ sector.stopAnimation(true);
44874
+ sector.animateTo({
44875
+ shape: {
44876
+ r: layout.r
44877
+ }
44878
+ }, 300, 'elasticOut');
44879
+ }
44729
44880
  }
44730
44881
  }
44731
44882
  : null;
@@ -46478,7 +46629,7 @@ Radar.prototype.update = function (ecModel, api) {
46478
46629
  }
46479
46630
  // Force all the axis fixing the maxSplitNumber.
46480
46631
  each$1(indicatorAxes, function (indicatorAxis, idx) {
46481
- var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
46632
+ var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
46482
46633
  niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
46483
46634
 
46484
46635
  var axisModel = indicatorAxis.model;
@@ -47598,9 +47749,10 @@ var geoJSONLoader = {
47598
47749
  /**
47599
47750
  * @param {string} mapName
47600
47751
  * @param {Object} mapRecord {specialAreas, geoJSON}
47752
+ * @param {string} nameProperty
47601
47753
  * @return {Object} {regions, boundingRect}
47602
47754
  */
47603
- load: function (mapName, mapRecord) {
47755
+ load: function (mapName, mapRecord, nameProperty) {
47604
47756
 
47605
47757
  var parsed = inner$7(mapRecord).parsed;
47606
47758
 
@@ -47614,7 +47766,7 @@ var geoJSONLoader = {
47614
47766
 
47615
47767
  // https://jsperf.com/try-catch-performance-overhead
47616
47768
  try {
47617
- regions = geoJSON ? parseGeoJson$1(geoJSON) : [];
47769
+ regions = geoJSON ? parseGeoJson$1(geoJSON, nameProperty) : [];
47618
47770
  }
47619
47771
  catch (e) {
47620
47772
  throw new Error('Invalid geoJson format\n' + e.message);
@@ -47822,9 +47974,10 @@ var geoSourceManager = {
47822
47974
  /**
47823
47975
  * @param {string} mapName
47824
47976
  * @param {Object} nameMap
47977
+ * @param {string} nameProperty
47825
47978
  * @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
47826
47979
  */
47827
- load: function (mapName, nameMap) {
47980
+ load: function (mapName, nameMap, nameProperty) {
47828
47981
  var regions = [];
47829
47982
  var regionsMap = createHashMap();
47830
47983
  var nameCoordMap = createHashMap();
@@ -47832,7 +47985,7 @@ var geoSourceManager = {
47832
47985
  var mapRecords = retrieveMap(mapName);
47833
47986
 
47834
47987
  each$1(mapRecords, function (record) {
47835
- var singleSource = loaders[record.type].load(mapName, record);
47988
+ var singleSource = loaders[record.type].load(mapName, record, nameProperty);
47836
47989
 
47837
47990
  each$1(singleSource.regions, function (region) {
47838
47991
  var regionName = region.name;
@@ -47971,7 +48124,7 @@ var MapSeries = SeriesModel.extend({
47971
48124
  });
47972
48125
  }
47973
48126
 
47974
- var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap);
48127
+ var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty);
47975
48128
  each$1(geoSource.regions, function (region) {
47976
48129
  var name = region.name;
47977
48130
  if (!dataNameMap.get(name)) {
@@ -48161,7 +48314,8 @@ var MapSeries = SeriesModel.extend({
48161
48314
  itemStyle: {
48162
48315
  areaColor: 'rgba(255,215,0,0.8)'
48163
48316
  }
48164
- }
48317
+ },
48318
+ nameProperty: 'name'
48165
48319
  }
48166
48320
 
48167
48321
  });
@@ -48771,9 +48925,25 @@ MapDraw.prototype = {
48771
48925
  var group = this.group;
48772
48926
 
48773
48927
  var transformInfo = geo.getTransformInfo();
48774
- group.transform = transformInfo.roamTransform;
48775
- group.decomposeTransform();
48776
- group.dirty();
48928
+ // No animation when first draw or in action
48929
+ var isFirstDraw = !regionsGroup.childAt(0) || payload;
48930
+ var targetScale;
48931
+ if (isFirstDraw) {
48932
+ group.transform = transformInfo.roamTransform;
48933
+ group.decomposeTransform();
48934
+ group.dirty();
48935
+ }
48936
+ else {
48937
+ var target = new Transformable();
48938
+ target.transform = transformInfo.roamTransform;
48939
+ target.decomposeTransform();
48940
+ var props = {
48941
+ scale: target.scale,
48942
+ position: target.position
48943
+ };
48944
+ targetScale = target.scale;
48945
+ updateProps(group, props, mapOrGeoModel);
48946
+ }
48777
48947
 
48778
48948
  var scale = transformInfo.rawScale;
48779
48949
  var position = transformInfo.rawPosition;
@@ -48915,6 +49085,12 @@ MapDraw.prototype = {
48915
49085
  }
48916
49086
  );
48917
49087
 
49088
+ if (!isFirstDraw) {
49089
+ // Text animation
49090
+ var textScale = [1 / targetScale[0], 1 / targetScale[1]];
49091
+ updateProps(textEl, { scale: textScale }, mapOrGeoModel);
49092
+ }
49093
+
48918
49094
  regionGroup.add(textEl);
48919
49095
  }
48920
49096
 
@@ -50822,11 +50998,14 @@ TreeNode.prototype = {
50822
50998
  var hostTree = this.hostTree;
50823
50999
  var itemModel = hostTree.data.getItemModel(this.dataIndex);
50824
51000
  var levelModel = this.getLevelModel();
50825
- var leavesModel;
50826
- if (!levelModel && (this.children.length === 0 || (this.children.length !== 0 && this.isExpand === false))) {
50827
- leavesModel = this.getLeavesModel();
51001
+
51002
+ // FIXME: refactor levelModel to "beforeLink", and remove levelModel here.
51003
+ if (levelModel) {
51004
+ return itemModel.getModel(path, levelModel.getModel(path));
51005
+ }
51006
+ else {
51007
+ return itemModel.getModel(path);
50828
51008
  }
50829
- return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
50830
51009
  },
50831
51010
 
50832
51011
  /**
@@ -50836,13 +51015,6 @@ TreeNode.prototype = {
50836
51015
  return (this.hostTree.levelModels || [])[this.depth];
50837
51016
  },
50838
51017
 
50839
- /**
50840
- * @return {module:echarts/model/Model}
50841
- */
50842
- getLeavesModel: function () {
50843
- return this.hostTree.leavesModel;
50844
- },
50845
-
50846
51018
  /**
50847
51019
  * @example
50848
51020
  * setItemVisual('color', color);
@@ -50913,9 +51085,8 @@ TreeNode.prototype = {
50913
51085
  * @alias module:echarts/data/Tree
50914
51086
  * @param {module:echarts/model/Model} hostModel
50915
51087
  * @param {Array.<Object>} levelOptions
50916
- * @param {Object} leavesOption
50917
51088
  */
50918
- function Tree(hostModel, levelOptions, leavesOption) {
51089
+ function Tree(hostModel, levelOptions) {
50919
51090
  /**
50920
51091
  * @type {module:echarts/data/Tree~TreeNode}
50921
51092
  * @readOnly
@@ -50951,7 +51122,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
50951
51122
  return new Model(levelDefine, hostModel, hostModel.ecModel);
50952
51123
  });
50953
51124
 
50954
- this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
50955
51125
  }
50956
51126
 
50957
51127
  Tree.prototype = {
@@ -51043,12 +51213,11 @@ Tree.prototype = {
51043
51213
  * @param {module:echarts/model/Model} hostModel
51044
51214
  * @param {Object} treeOptions
51045
51215
  * @param {Array.<Object>} treeOptions.levels
51046
- * @param {Array.<Object>} treeOptions.leaves
51047
51216
  * @return module:echarts/data/Tree
51048
51217
  */
51049
51218
  Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
51050
51219
 
51051
- var tree = new Tree(hostModel, treeOptions.levels, treeOptions.leaves);
51220
+ var tree = new Tree(hostModel, treeOptions && treeOptions.levels);
51052
51221
  var listData = [];
51053
51222
  var dimMax = 1;
51054
51223
 
@@ -51085,6 +51254,8 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
51085
51254
  var list = new List(dimensionsInfo, hostModel);
51086
51255
  list.initData(listData);
51087
51256
 
51257
+ beforeLink && beforeLink(list);
51258
+
51088
51259
  linkList({
51089
51260
  mainData: list,
51090
51261
  struct: tree,
@@ -51093,8 +51264,6 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
51093
51264
 
51094
51265
  tree.update();
51095
51266
 
51096
- beforeLink && beforeLink(list);
51097
-
51098
51267
  return tree;
51099
51268
  };
51100
51269
 
@@ -51154,17 +51323,13 @@ SeriesModel.extend({
51154
51323
  var root = {name: option.name, children: option.data};
51155
51324
 
51156
51325
  var leaves = option.leaves || {};
51326
+ var leavesModel = new Model(leaves, this, this.ecModel);
51157
51327
 
51158
- var treeOption = {};
51159
-
51160
- treeOption.leaves = leaves;
51161
-
51162
- var tree = Tree.createTree(root, this, treeOption, beforeLink);
51328
+ var tree = Tree.createTree(root, this, {}, beforeLink);
51163
51329
 
51164
51330
  function beforeLink(nodeData) {
51165
51331
  nodeData.wrapMethod('getItemModel', function (model, idx) {
51166
51332
  var node = tree.getNodeByDataIndex(idx);
51167
- var leavesModel = node.getLeavesModel();
51168
51333
  if (!node.children.length || !node.isExpand) {
51169
51334
  model.parentModel = leavesModel;
51170
51335
  }
@@ -52779,15 +52944,25 @@ SeriesModel.extend({
52779
52944
  var levels = option.levels || [];
52780
52945
 
52781
52946
  levels = option.levels = setDefault(levels, ecModel);
52782
-
52783
- var treeOption = {};
52784
-
52785
- treeOption.levels = levels;
52947
+ var levelModels = map(levels || [], function (levelDefine) {
52948
+ return new Model(levelDefine, this, ecModel);
52949
+ }, this);
52786
52950
 
52787
52951
  // Make sure always a new tree is created when setOption,
52788
52952
  // in TreemapView, we check whether oldTree === newTree
52789
52953
  // to choose mappings approach among old shapes and new shapes.
52790
- return Tree.createTree(root, this, treeOption).data;
52954
+ var tree = Tree.createTree(root, this, null, beforeLink);
52955
+
52956
+ function beforeLink(nodeData) {
52957
+ nodeData.wrapMethod('getItemModel', function (model, idx) {
52958
+ var node = tree.getNodeByDataIndex(idx);
52959
+ var levelModel = levelModels[node.depth];
52960
+ levelModel && (model.parentModel = levelModel);
52961
+ return model;
52962
+ });
52963
+ }
52964
+
52965
+ return tree.data;
52791
52966
  },
52792
52967
 
52793
52968
  optionUpdated: function () {
@@ -53798,7 +53973,7 @@ extendChartView({
53798
53973
  var itemModel = node.hostTree.data.getItemModel(node.dataIndex);
53799
53974
  var link = itemModel.get('link', true);
53800
53975
  var linkTarget = itemModel.get('target', true) || 'blank';
53801
- link && window.open(link, linkTarget);
53976
+ link && windowOpen(link, linkTarget);
53802
53977
  }
53803
53978
  }
53804
53979
 
@@ -53988,7 +54163,7 @@ function renderNode(
53988
54163
 
53989
54164
  // Background
53990
54165
  var bg = giveGraphic('background', Rect$1, depth, Z_BG);
53991
- bg && renderBackground(group, bg, isParent && thisLayout.upperHeight);
54166
+ bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight);
53992
54167
 
53993
54168
  // No children, render content.
53994
54169
  if (isParent) {
@@ -54109,16 +54284,7 @@ function renderNode(
54109
54284
  }
54110
54285
 
54111
54286
  function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
54112
- var text = retrieve(
54113
- seriesModel.getFormattedLabel(
54114
- thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'
54115
- ),
54116
- nodeModel.get('name')
54117
- );
54118
- if (!upperLabelRect && thisLayout.isLeafRoot) {
54119
- var iconChar = seriesModel.get('drillDownIcon', true);
54120
- text = iconChar ? iconChar + ' ' + text : text;
54121
- }
54287
+ var defaultText = nodeModel.get('name');
54122
54288
 
54123
54289
  var normalLabelModel = nodeModel.getModel(
54124
54290
  upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL
@@ -54132,12 +54298,18 @@ function renderNode(
54132
54298
  setLabelStyle(
54133
54299
  normalStyle, emphasisStyle, normalLabelModel, emphasisLabelModel,
54134
54300
  {
54135
- defaultText: isShow ? text : null,
54301
+ defaultText: isShow ? defaultText : null,
54136
54302
  autoColor: visualColor,
54137
- isRectText: true
54303
+ isRectText: true,
54304
+ labelFetcher: seriesModel,
54305
+ labelDataIndex: thisNode.dataIndex,
54306
+ labelProp: upperLabelRect ? 'upperLabel' : 'label'
54138
54307
  }
54139
54308
  );
54140
54309
 
54310
+ addDrillDownIcon(normalStyle, upperLabelRect, thisLayout);
54311
+ addDrillDownIcon(emphasisStyle, upperLabelRect, thisLayout);
54312
+
54141
54313
  upperLabelRect && (normalStyle.textRect = clone(upperLabelRect));
54142
54314
 
54143
54315
  normalStyle.truncate = (isShow && normalLabelModel.get('ellipsis'))
@@ -54149,6 +54321,14 @@ function renderNode(
54149
54321
  : null;
54150
54322
  }
54151
54323
 
54324
+ function addDrillDownIcon(style, upperLabelRect, thisLayout) {
54325
+ var text = style.text;
54326
+ if (!upperLabelRect && thisLayout.isLeafRoot && text != null) {
54327
+ var iconChar = seriesModel.get('drillDownIcon', true);
54328
+ style.text = iconChar ? iconChar + ' ' + text : text;
54329
+ }
54330
+ }
54331
+
54152
54332
  function giveGraphic(storageName, Ctor, depth, z) {
54153
54333
  var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];
54154
54334
  var lasts = lastsForAnimation[storageName];
@@ -57319,9 +57499,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
57319
57499
  this.group.removeAll();
57320
57500
  };
57321
57501
 
57502
+ function isEffectObject(el) {
57503
+ return el.animators && el.animators.length > 0;
57504
+ }
57505
+
57322
57506
  lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
57323
57507
  function updateIncrementalAndHover(el) {
57324
- if (!el.isGroup) {
57508
+ if (!el.isGroup && !isEffectObject(el)) {
57325
57509
  el.incremental = el.useHoverLayer = true;
57326
57510
  }
57327
57511
  }
@@ -64371,7 +64555,13 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
64371
64555
  each$1(nodes, function (node) {
64372
64556
  if (node.outEdges.length) {
64373
64557
  var y = sum(node.outEdges, weightedTarget, orient)
64374
- / sum(node.outEdges, getEdgeValue, orient);
64558
+ / sum(node.outEdges, getEdgeValue, orient);
64559
+
64560
+ if (isNaN(y)) {
64561
+ var len = node.outEdges.length;
64562
+ y = len ? sum(node.outEdges, centerTarget, orient) / len : 0;
64563
+ }
64564
+
64375
64565
  if (orient === 'vertical') {
64376
64566
  var nodeX = node.getLayout().x + (y - center$1(node, orient)) * alpha;
64377
64567
  node.setLayout({x: nodeX}, true);
@@ -64388,10 +64578,16 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
64388
64578
  function weightedTarget(edge, orient) {
64389
64579
  return center$1(edge.node2, orient) * edge.getValue();
64390
64580
  }
64581
+ function centerTarget(edge, orient) {
64582
+ return center$1(edge.node2, orient);
64583
+ }
64391
64584
 
64392
64585
  function weightedSource(edge, orient) {
64393
64586
  return center$1(edge.node1, orient) * edge.getValue();
64394
64587
  }
64588
+ function centerSource(edge, orient) {
64589
+ return center$1(edge.node1, orient);
64590
+ }
64395
64591
 
64396
64592
  function center$1(node, orient) {
64397
64593
  return orient === 'vertical'
@@ -64427,8 +64623,15 @@ function relaxLeftToRight(nodesByBreadth, alpha, orient) {
64427
64623
  each$1(nodesByBreadth, function (nodes) {
64428
64624
  each$1(nodes, function (node) {
64429
64625
  if (node.inEdges.length) {
64626
+
64430
64627
  var y = sum(node.inEdges, weightedSource, orient)
64431
- / sum(node.inEdges, getEdgeValue, orient);
64628
+ / sum(node.inEdges, getEdgeValue, orient);
64629
+
64630
+ if (isNaN(y)) {
64631
+ var len = node.inEdges.length;
64632
+ y = len ? sum(node.inEdges, centerSource, orient) / len : 0;
64633
+ }
64634
+
64432
64635
  if (orient === 'vertical') {
64433
64636
  var nodeX = node.getLayout().x + (y - center$1(node, orient)) * alpha;
64434
64637
  node.setLayout({x: nodeX}, true);
@@ -66268,7 +66471,8 @@ effectSymbolProto.updateData = function (data, idx) {
66268
66471
  pos[0] = parsePercent$1(symbolOffset[0], symbolSize[0]);
66269
66472
  pos[1] = parsePercent$1(symbolOffset[1], symbolSize[1]);
66270
66473
  }
66271
- rippleGroup.rotation = (itemModel.getShallow('symbolRotate') || 0) * Math.PI / 180 || 0;
66474
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
66475
+ rippleGroup.rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
66272
66476
 
66273
66477
  var effectCfg = {};
66274
66478
 
@@ -68186,8 +68390,8 @@ extendChartView({
68186
68390
 
68187
68391
  rect = new Rect({
68188
68392
  shape: {
68189
- x: Math.floor(point[0] - width / 2),
68190
- y: Math.floor(point[1] - height / 2),
68393
+ x: Math.floor(Math.round(point[0]) - width / 2),
68394
+ y: Math.floor(Math.round(point[1]) - height / 2),
68191
68395
  width: Math.ceil(width),
68192
68396
  height: Math.ceil(height)
68193
68397
  },
@@ -72664,8 +72868,7 @@ SeriesModel.extend({
72664
72868
  align: 'center',
72665
72869
  position: 'inside',
72666
72870
  distance: 5,
72667
- silent: true,
72668
- emphasis: {}
72871
+ silent: true
72669
72872
  },
72670
72873
  itemStyle: {
72671
72874
  borderWidth: 1,
@@ -72675,13 +72878,19 @@ SeriesModel.extend({
72675
72878
  shadowColor: 'rgba(0, 0, 0, 0.2)',
72676
72879
  shadowOffsetX: 0,
72677
72880
  shadowOffsetY: 0,
72678
- opacity: 1,
72679
- emphasis: {},
72680
- highlight: {
72881
+ opacity: 1
72882
+ },
72883
+ highlight: {
72884
+ itemStyle: {
72681
72885
  opacity: 1
72886
+ }
72887
+ },
72888
+ downplay: {
72889
+ itemStyle: {
72890
+ opacity: 0.5
72682
72891
  },
72683
- downplay: {
72684
- opacity: 0.9
72892
+ label: {
72893
+ opacity: 0.6
72685
72894
  }
72686
72895
  },
72687
72896
 
@@ -72927,6 +73136,8 @@ SunburstPieceProto.updateData = function (
72927
73136
 
72928
73137
  this._seriesModel = seriesModel || this._seriesModel;
72929
73138
  this._ecModel = ecModel || this._ecModel;
73139
+
73140
+ setHoverStyle(this);
72930
73141
  };
72931
73142
 
72932
73143
  SunburstPieceProto.onEmphasis = function (highlightPolicy) {
@@ -73390,7 +73601,7 @@ var SunburstView = Chart.extend({
73390
73601
  if (link) {
73391
73602
  var linkTarget = itemModel.get('target', true)
73392
73603
  || '_blank';
73393
- window.open(link, linkTarget);
73604
+ windowOpen(link, linkTarget);
73394
73605
  }
73395
73606
  }
73396
73607
  targetFound = true;
@@ -77314,7 +77525,10 @@ Calendar.prototype = {
77314
77525
  var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY)
77315
77526
  - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1;
77316
77527
 
77317
- // Consider case:
77528
+ // Consider case1 (#11677 #10430):
77529
+ // Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
77530
+
77531
+ // Consider case2:
77318
77532
  // Firstly set system timezone as "Time Zone: America/Toronto",
77319
77533
  // ```
77320
77534
  // var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
@@ -77327,11 +77541,15 @@ Calendar.prototype = {
77327
77541
  var endDateNum = range[1].date.getDate();
77328
77542
  date.setDate(startDateNum + allDay - 1);
77329
77543
  // The bias can not over a month, so just compare date.
77330
- if (date.getDate() !== endDateNum) {
77544
+ var dateNum = date.getDate();
77545
+ if (dateNum !== endDateNum) {
77331
77546
  var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
77332
- while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
77547
+ while (
77548
+ (dateNum = date.getDate()) !== endDateNum
77549
+ && (date.getTime() - range[1].time) * sign > 0
77550
+ ) {
77333
77551
  allDay -= sign;
77334
- date.setDate(startDateNum + allDay - 1);
77552
+ date.setDate(dateNum - sign);
77335
77553
  }
77336
77554
  }
77337
77555
 
@@ -78918,7 +79136,7 @@ extendComponentView({
78918
79136
  var feature;
78919
79137
 
78920
79138
  // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
78921
- if (payload && payload.newTitle != null) {
79139
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
78922
79140
  featureOpt.title = payload.newTitle;
78923
79141
  }
78924
79142
 
@@ -79191,7 +79409,8 @@ var proto$2 = SaveAsImage.prototype;
79191
79409
  proto$2.onclick = function (ecModel, api) {
79192
79410
  var model = this.model;
79193
79411
  var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
79194
- var type = model.get('type', true) || 'png';
79412
+ var isSvg = api.getZr().painter.getType() === 'svg';
79413
+ var type = isSvg ? 'svg' : model.get('type', true) || 'png';
79195
79414
  var url = api.getConnectedDataURL({
79196
79415
  type: type,
79197
79416
  backgroundColor: model.get('backgroundColor', true)
@@ -79418,7 +79637,8 @@ proto$3.onclick = function (ecModel, api, type) {
79418
79637
  type: 'changeMagicType',
79419
79638
  currentType: type,
79420
79639
  newOption: newOption,
79421
- newTitle: newTitle
79640
+ newTitle: newTitle,
79641
+ featureName: 'magicType'
79422
79642
  });
79423
79643
  };
79424
79644
 
@@ -83602,7 +83822,7 @@ extendComponentView({
83602
83822
  var dataModel = el.dataModel || seriesModel;
83603
83823
  var dataIndex = el.dataIndex;
83604
83824
  var dataType = el.dataType;
83605
- var data = dataModel.getData();
83825
+ var data = dataModel.getData(dataType);
83606
83826
 
83607
83827
  var tooltipModel = buildTooltipModel([
83608
83828
  data.getItemModel(dataIndex),
@@ -85400,12 +85620,12 @@ extendComponentView({
85400
85620
 
85401
85621
  if (link) {
85402
85622
  textEl.on('click', function () {
85403
- window.open(link, '_' + titleModel.get('target'));
85623
+ windowOpen(link, '_' + titleModel.get('target'));
85404
85624
  });
85405
85625
  }
85406
85626
  if (sublink) {
85407
85627
  subTextEl.on('click', function () {
85408
- window.open(sublink, '_' + titleModel.get('subtarget'));
85628
+ windowOpen(link, '_' + titleModel.get('subtarget'));
85409
85629
  });
85410
85630
  }
85411
85631
 
@@ -94170,25 +94390,21 @@ var resetMethods = {
94170
94390
  thisOption.precision = precision;
94171
94391
  splitStep = +splitStep.toFixed(precision);
94172
94392
 
94173
- var index = 0;
94174
-
94175
94393
  if (thisOption.minOpen) {
94176
94394
  pieceList.push({
94177
- index: index++,
94178
94395
  interval: [-Infinity, dataExtent[0]],
94179
94396
  close: [0, 0]
94180
94397
  });
94181
94398
  }
94182
94399
 
94183
94400
  for (
94184
- var curr = dataExtent[0], len = index + splitNumber;
94185
- index < len;
94186
- curr += splitStep
94401
+ var index = 0, curr = dataExtent[0];
94402
+ index < splitNumber;
94403
+ curr += splitStep, index++
94187
94404
  ) {
94188
94405
  var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
94189
94406
 
94190
94407
  pieceList.push({
94191
- index: index++,
94192
94408
  interval: [curr, max],
94193
94409
  close: [1, 1]
94194
94410
  });
@@ -94196,7 +94412,6 @@ var resetMethods = {
94196
94412
 
94197
94413
  if (thisOption.maxOpen) {
94198
94414
  pieceList.push({
94199
- index: index++,
94200
94415
  interval: [dataExtent[1], Infinity],
94201
94416
  close: [0, 0]
94202
94417
  });
@@ -94204,7 +94419,8 @@ var resetMethods = {
94204
94419
 
94205
94420
  reformIntervals(pieceList);
94206
94421
 
94207
- each$1(pieceList, function (piece) {
94422
+ each$1(pieceList, function (piece, index) {
94423
+ piece.index = index;
94208
94424
  piece.text = this.formatValueText(piece.interval);
94209
94425
  }, this);
94210
94426
  },
@@ -97513,11 +97729,16 @@ var SVGPainter = function (root, storage, opts, zrId) {
97513
97729
  this.storage = storage;
97514
97730
  this._opts = opts = extend({}, opts || {});
97515
97731
 
97516
- var svgRoot = createElement('svg');
97517
- svgRoot.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
97518
- svgRoot.setAttribute('version', '1.1');
97519
- svgRoot.setAttribute('baseProfile', 'full');
97520
- svgRoot.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
97732
+ var svgDom = createElement('svg');
97733
+ svgDom.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
97734
+ svgDom.setAttribute('version', '1.1');
97735
+ svgDom.setAttribute('baseProfile', 'full');
97736
+ svgDom.style.cssText = 'user-select:none;position:absolute;left:0;top:0;';
97737
+
97738
+ var bgRoot = createElement('g');
97739
+ svgDom.appendChild(bgRoot);
97740
+ var svgRoot = createElement('g');
97741
+ svgDom.appendChild(svgRoot);
97521
97742
 
97522
97743
  this.gradientManager = new GradientManager(zrId, svgRoot);
97523
97744
  this.clipPathManager = new ClippathManager(zrId, svgRoot);
@@ -97526,11 +97747,13 @@ var SVGPainter = function (root, storage, opts, zrId) {
97526
97747
  var viewport = document.createElement('div');
97527
97748
  viewport.style.cssText = 'overflow:hidden;position:relative';
97528
97749
 
97750
+ this._svgDom = svgDom;
97529
97751
  this._svgRoot = svgRoot;
97752
+ this._backgroundRoot = bgRoot;
97530
97753
  this._viewport = viewport;
97531
97754
 
97532
97755
  root.appendChild(viewport);
97533
- viewport.appendChild(svgRoot);
97756
+ viewport.appendChild(svgDom);
97534
97757
 
97535
97758
  this.resize(opts.width, opts.height);
97536
97759
 
@@ -97549,6 +97772,14 @@ SVGPainter.prototype = {
97549
97772
  return this._viewport;
97550
97773
  },
97551
97774
 
97775
+ getSvgDom: function () {
97776
+ return this._svgDom;
97777
+ },
97778
+
97779
+ getSvgRoot: function () {
97780
+ return this._svgRoot;
97781
+ },
97782
+
97552
97783
  getViewportRootOffset: function () {
97553
97784
  var viewportRoot = this.getViewportRoot();
97554
97785
  if (viewportRoot) {
@@ -97568,7 +97799,21 @@ SVGPainter.prototype = {
97568
97799
 
97569
97800
  setBackgroundColor: function (backgroundColor) {
97570
97801
  // TODO gradient
97571
- this._viewport.style.background = backgroundColor;
97802
+ // Insert a bg rect instead of setting background to viewport.
97803
+ // Otherwise, the exported SVG don't have background.
97804
+ if (this._backgroundRoot && this._backgroundNode) {
97805
+ this._backgroundRoot.removeChild(this._backgroundNode);
97806
+ }
97807
+
97808
+ var bgNode = createElement('rect');
97809
+ bgNode.setAttribute('width', this.getWidth());
97810
+ bgNode.setAttribute('height', this.getHeight());
97811
+ bgNode.setAttribute('x', 0);
97812
+ bgNode.setAttribute('y', 0);
97813
+ bgNode.setAttribute('id', 0);
97814
+ bgNode.style.fill = backgroundColor;
97815
+ this._backgroundRoot.appendChild(bgNode);
97816
+ this._backgroundNode = bgNode;
97572
97817
  },
97573
97818
 
97574
97819
  _paintList: function (list) {
@@ -97698,8 +97943,8 @@ SVGPainter.prototype = {
97698
97943
  },
97699
97944
 
97700
97945
  _getDefs: function (isForceCreating) {
97701
- var svgRoot = this._svgRoot;
97702
- var defs = this._svgRoot.getElementsByTagName('defs');
97946
+ var svgRoot = this._svgDom;
97947
+ var defs = svgRoot.getElementsByTagName('defs');
97703
97948
  if (defs.length === 0) {
97704
97949
  // Not exist
97705
97950
  if (isForceCreating) {
@@ -97756,11 +98001,16 @@ SVGPainter.prototype = {
97756
98001
  viewportStyle.width = width + 'px';
97757
98002
  viewportStyle.height = height + 'px';
97758
98003
 
97759
- var svgRoot = this._svgRoot;
98004
+ var svgRoot = this._svgDom;
97760
98005
  // Set width by 'svgRoot.width = width' is invalid
97761
98006
  svgRoot.setAttribute('width', width);
97762
98007
  svgRoot.setAttribute('height', height);
97763
98008
  }
98009
+
98010
+ if (this._backgroundNode) {
98011
+ this._backgroundNode.setAttribute('width', width);
98012
+ this._backgroundNode.setAttribute('height', height);
98013
+ }
97764
98014
  },
97765
98015
 
97766
98016
  /**
@@ -97802,10 +98052,13 @@ SVGPainter.prototype = {
97802
98052
  dispose: function () {
97803
98053
  this.root.innerHTML = '';
97804
98054
 
97805
- this._svgRoot =
97806
- this._viewport =
97807
- this.storage =
97808
- null;
98055
+ this._svgRoot
98056
+ = this._backgroundRoot
98057
+ = this._svgDom
98058
+ = this._backgroundNode
98059
+ = this._viewport
98060
+ = this.storage
98061
+ = null;
97809
98062
  },
97810
98063
 
97811
98064
  clear: function () {
@@ -97814,9 +98067,9 @@ SVGPainter.prototype = {
97814
98067
  }
97815
98068
  },
97816
98069
 
97817
- pathToDataUrl: function () {
98070
+ toDataURL: function () {
97818
98071
  this.refresh();
97819
- var html = this._svgRoot.outerHTML;
98072
+ var html = encodeURIComponent(this._svgDom.outerHTML.replace(/></g, '>\n\r<'));
97820
98073
  return 'data:image/svg+xml;charset=UTF-8,' + html;
97821
98074
  }
97822
98075
  };
@@ -97832,7 +98085,7 @@ function createMethodNotSupport$1(method) {
97832
98085
  each$1([
97833
98086
  'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer',
97834
98087
  'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer',
97835
- 'toDataURL', 'pathToImage'
98088
+ 'pathToImage'
97836
98089
  ], function (name) {
97837
98090
  SVGPainter.prototype[name] = createMethodNotSupport$1(name);
97838
98091
  });