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
@@ -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
  }
@@ -25782,6 +25821,32 @@ var lang = {
25782
25821
  lang: ['Right Click to Save Image']
25783
25822
  }
25784
25823
  },
25824
+ series: {
25825
+ typeNames: {
25826
+ pie: 'Pie chart',
25827
+ bar: 'Bar chart',
25828
+ line: 'Line chart',
25829
+ scatter: 'Scatter plot',
25830
+ effectScatter: 'Ripple scatter plot',
25831
+ radar: 'Radar chart',
25832
+ tree: 'Tree',
25833
+ treemap: 'Treemap',
25834
+ boxplot: 'Boxplot',
25835
+ candlestick: 'Candlestick',
25836
+ k: 'K line chart',
25837
+ heatmap: 'Heat map',
25838
+ map: 'Map',
25839
+ parallel: 'Parallel coordinate map',
25840
+ lines: 'Line graph',
25841
+ graph: 'Relationship graph',
25842
+ sankey: 'Sankey diagram',
25843
+ funnel: 'Funnel chart',
25844
+ gauge: 'Guage',
25845
+ pictorialBar: 'Pictorial bar',
25846
+ themeRiver: 'Theme River Map',
25847
+ sunburst: 'Sunburst'
25848
+ }
25849
+ },
25785
25850
  aria: {
25786
25851
  general: {
25787
25852
  withTitle: 'This is a chart about "{title}"',
@@ -26014,11 +26079,16 @@ var loadingDefault = function (api, opts) {
26014
26079
  opts = opts || {};
26015
26080
  defaults(opts, {
26016
26081
  text: 'loading',
26017
- color: '#c23531',
26018
26082
  textColor: '#000',
26083
+ fontSize: '12px',
26019
26084
  maskColor: 'rgba(255, 255, 255, 0.8)',
26085
+ showSpinner: true,
26086
+ color: '#c23531',
26087
+ spinnerRadius: 10,
26088
+ lineWidth: 5,
26020
26089
  zlevel: 0
26021
26090
  });
26091
+ var group = new Group();
26022
26092
  var mask = new Rect({
26023
26093
  style: {
26024
26094
  fill: opts.maskColor
@@ -26026,24 +26096,13 @@ var loadingDefault = function (api, opts) {
26026
26096
  zlevel: opts.zlevel,
26027
26097
  z: 10000
26028
26098
  });
26029
- var arc = new Arc({
26030
- shape: {
26031
- startAngle: -PI$1 / 2,
26032
- endAngle: -PI$1 / 2 + 0.1,
26033
- r: 10
26034
- },
26035
- style: {
26036
- stroke: opts.color,
26037
- lineCap: 'round',
26038
- lineWidth: 5
26039
- },
26040
- zlevel: opts.zlevel,
26041
- z: 10001
26042
- });
26099
+ group.add(mask);
26100
+ var font = opts.fontSize + ' sans-serif';
26043
26101
  var labelRect = new Rect({
26044
26102
  style: {
26045
26103
  fill: 'none',
26046
26104
  text: opts.text,
26105
+ font: font,
26047
26106
  textPosition: 'right',
26048
26107
  textDistance: 10,
26049
26108
  textFill: opts.textColor
@@ -26051,32 +26110,49 @@ var loadingDefault = function (api, opts) {
26051
26110
  zlevel: opts.zlevel,
26052
26111
  z: 10001
26053
26112
  });
26054
-
26055
- arc.animateShape(true)
26056
- .when(1000, {
26057
- endAngle: PI$1 * 3 / 2
26058
- })
26059
- .start('circularInOut');
26060
- arc.animateShape(true)
26061
- .when(1000, {
26062
- startAngle: PI$1 * 3 / 2
26063
- })
26064
- .delay(300)
26065
- .start('circularInOut');
26066
-
26067
- var group = new Group();
26068
- group.add(arc);
26069
26113
  group.add(labelRect);
26070
- 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
+ }
26071
26142
  // Inject resize
26072
26143
  group.resize = function () {
26073
- 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);
26074
26151
  var cy = api.getHeight() / 2;
26075
- arc.setShape({
26152
+ opts.showSpinner && arc.setShape({
26076
26153
  cx: cx,
26077
26154
  cy: cy
26078
26155
  });
26079
- var r = arc.shape.r;
26080
26156
  labelRect.setShape({
26081
26157
  x: cx - r,
26082
26158
  y: cy - r,
@@ -27736,10 +27812,10 @@ var isFunction = isFunction$1;
27736
27812
  var isObject = isObject$1;
27737
27813
  var parseClassType = ComponentModel.parseClassType;
27738
27814
 
27739
- var version = '4.7.0';
27815
+ var version = '4.8.0';
27740
27816
 
27741
27817
  var dependencies = {
27742
- zrender: '4.3.0'
27818
+ zrender: '4.3.1'
27743
27819
  };
27744
27820
 
27745
27821
  var TEST_FRAME_REMAIN_TIME = 1;
@@ -28158,7 +28234,7 @@ echartsProto.getRenderedCanvas = function (opts) {
28158
28234
  * Get svg data url
28159
28235
  * @return {string}
28160
28236
  */
28161
- echartsProto.getSvgDataUrl = function () {
28237
+ echartsProto.getSvgDataURL = function () {
28162
28238
  if (!env$1.svgSupported) {
28163
28239
  return;
28164
28240
  }
@@ -28170,7 +28246,7 @@ echartsProto.getSvgDataUrl = function () {
28170
28246
  el.stopAnimation(true);
28171
28247
  });
28172
28248
 
28173
- return zr.painter.pathToDataUrl();
28249
+ return zr.painter.toDataURL();
28174
28250
  };
28175
28251
 
28176
28252
  /**
@@ -28206,7 +28282,7 @@ echartsProto.getDataURL = function (opts) {
28206
28282
  });
28207
28283
 
28208
28284
  var url = this._zr.painter.getType() === 'svg'
28209
- ? this.getSvgDataUrl()
28285
+ ? this.getSvgDataURL()
28210
28286
  : this.getRenderedCanvas(opts).toDataURL(
28211
28287
  'image/' + (opts && opts.type || 'png')
28212
28288
  );
@@ -28235,6 +28311,7 @@ echartsProto.getConnectedDataURL = function (opts) {
28235
28311
  if (!env$1.canvasSupported) {
28236
28312
  return;
28237
28313
  }
28314
+ var isSvg = opts.type === 'svg';
28238
28315
  var groupId = this.group;
28239
28316
  var mathMin = Math.min;
28240
28317
  var mathMax = Math.max;
@@ -28249,9 +28326,9 @@ echartsProto.getConnectedDataURL = function (opts) {
28249
28326
 
28250
28327
  each$1(instances, function (chart, id) {
28251
28328
  if (chart.group === groupId) {
28252
- var canvas = chart.getRenderedCanvas(
28253
- clone(opts)
28254
- );
28329
+ var canvas = isSvg
28330
+ ? chart.getZr().painter.getSvgDom().innerHTML
28331
+ : chart.getRenderedCanvas(clone(opts));
28255
28332
  var boundingRect = chart.getDom().getBoundingClientRect();
28256
28333
  left = mathMin(boundingRect.left, left);
28257
28334
  top = mathMin(boundingRect.top, top);
@@ -28272,38 +28349,61 @@ echartsProto.getConnectedDataURL = function (opts) {
28272
28349
  var width = right - left;
28273
28350
  var height = bottom - top;
28274
28351
  var targetCanvas = createCanvas();
28275
- targetCanvas.width = width;
28276
- targetCanvas.height = height;
28277
- 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
+ });
28278
28359
 
28279
- // Background between the charts
28280
- if (opts.connectedBackgroundColor) {
28281
- zr.add(new Rect({
28282
- shape: {
28283
- x: 0,
28284
- y: 0,
28285
- width: width,
28286
- height: height
28287
- },
28288
- style: {
28289
- fill: opts.connectedBackgroundColor
28290
- }
28291
- }));
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();
28292
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
+ }
28293
28392
 
28294
- each(canvasList, function (item) {
28295
- var img = new ZImage({
28296
- style: {
28297
- x: item.left * dpr - left,
28298
- y: item.top * dpr - top,
28299
- image: item.dom
28300
- }
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);
28301
28402
  });
28302
- zr.add(img);
28303
- });
28304
- zr.refreshImmediately();
28305
28403
 
28306
- return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
28404
+ zr.refreshImmediately();
28405
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
28406
+ }
28307
28407
  }
28308
28408
  else {
28309
28409
  return this.getDataURL(opts);
@@ -34738,9 +34838,11 @@ var largeLayout = {
34738
34838
 
34739
34839
  coord = cartesian.dataToPoint(valuePair, null, coord);
34740
34840
  // Data index might not be in order, depends on `progressiveChunkMode`.
34741
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
34841
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
34842
+ ? coordLayout.x + coordLayout.width : coord[0];
34742
34843
  largePoints[pointsOffset++] = coord[0];
34743
- largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
34844
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
34845
+ ? coord[1] : coordLayout.y + coordLayout.height;
34744
34846
  largePoints[pointsOffset++] = coord[1];
34745
34847
  largeDataIndices[idxOffset++] = dataIndex;
34746
34848
  }
@@ -35230,8 +35332,6 @@ function getScaleExtent(scale, model) {
35230
35332
 
35231
35333
  var min = model.getMin();
35232
35334
  var max = model.getMax();
35233
- var fixMin = min != null;
35234
- var fixMax = max != null;
35235
35335
  var originalExtent = scale.getExtent();
35236
35336
 
35237
35337
  var axisDataLen;
@@ -35275,17 +35375,6 @@ function getScaleExtent(scale, model) {
35275
35375
  // (2) When `needCrossZero` and all data is positive/negative, should it be ensured
35276
35376
  // that the results processed by boundaryGap are positive/negative?
35277
35377
 
35278
- if (min == null) {
35279
- min = scaleType === 'ordinal'
35280
- ? (axisDataLen ? 0 : NaN)
35281
- : originalExtent[0] - boundaryGap[0] * span;
35282
- }
35283
- if (max == null) {
35284
- max = scaleType === 'ordinal'
35285
- ? (axisDataLen ? axisDataLen - 1 : NaN)
35286
- : originalExtent[1] + boundaryGap[1] * span;
35287
- }
35288
-
35289
35378
  if (min === 'dataMin') {
35290
35379
  min = originalExtent[0];
35291
35380
  }
@@ -35306,6 +35395,20 @@ function getScaleExtent(scale, model) {
35306
35395
  });
35307
35396
  }
35308
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
+
35309
35412
  (min == null || !isFinite(min)) && (min = NaN);
35310
35413
  (max == null || !isFinite(max)) && (max = NaN);
35311
35414
 
@@ -35356,7 +35459,13 @@ function getScaleExtent(scale, model) {
35356
35459
  }
35357
35460
  }
35358
35461
 
35359
- 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
+ };
35360
35469
  }
35361
35470
 
35362
35471
  function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
@@ -35395,9 +35504,9 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
35395
35504
  }
35396
35505
 
35397
35506
  function niceScaleExtent(scale, model) {
35398
- var extent = getScaleExtent(scale, model);
35399
- var fixMin = model.getMin() != null;
35400
- var fixMax = model.getMax() != null;
35507
+ var extentInfo = getScaleExtent(scale, model);
35508
+ var extent = extentInfo.extent;
35509
+
35401
35510
  var splitNumber = model.get('splitNumber');
35402
35511
 
35403
35512
  if (scale.type === 'log') {
@@ -35408,8 +35517,8 @@ function niceScaleExtent(scale, model) {
35408
35517
  scale.setExtent(extent[0], extent[1]);
35409
35518
  scale.niceExtent({
35410
35519
  splitNumber: splitNumber,
35411
- fixMin: fixMin,
35412
- fixMax: fixMax,
35520
+ fixMin: extentInfo.fixMin,
35521
+ fixMax: extentInfo.fixMax,
35413
35522
  minInterval: (scaleType === 'interval' || scaleType === 'time')
35414
35523
  ? model.get('minInterval') : null,
35415
35524
  maxInterval: (scaleType === 'interval' || scaleType === 'time')
@@ -36442,9 +36551,10 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
36442
36551
  /**
36443
36552
  * @alias module:echarts/coord/geo/parseGeoJson
36444
36553
  * @param {Object} geoJson
36554
+ * @param {string} nameProperty
36445
36555
  * @return {module:zrender/container/Group}
36446
36556
  */
36447
- var parseGeoJson$1 = function (geoJson) {
36557
+ var parseGeoJson$1 = function (geoJson, nameProperty) {
36448
36558
 
36449
36559
  decode(geoJson);
36450
36560
 
@@ -36482,7 +36592,7 @@ var parseGeoJson$1 = function (geoJson) {
36482
36592
  }
36483
36593
 
36484
36594
  var region = new Region(
36485
- properties.name,
36595
+ properties[nameProperty || 'name'],
36486
36596
  geometries,
36487
36597
  properties.cp
36488
36598
  );
@@ -37679,7 +37789,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37679
37789
 
37680
37790
  var itemStyle = seriesScope && seriesScope.itemStyle;
37681
37791
  var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
37682
- var symbolRotate = seriesScope && seriesScope.symbolRotate;
37683
37792
  var symbolOffset = seriesScope && seriesScope.symbolOffset;
37684
37793
  var labelModel = seriesScope && seriesScope.labelModel;
37685
37794
  var hoverLabelModel = seriesScope && seriesScope.hoverLabelModel;
@@ -37695,7 +37804,6 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37695
37804
  itemStyle = itemModel.getModel(normalStyleAccessPath).getItemStyle(['color']);
37696
37805
  hoverItemStyle = itemModel.getModel(emphasisStyleAccessPath).getItemStyle();
37697
37806
 
37698
- symbolRotate = itemModel.getShallow('symbolRotate');
37699
37807
  symbolOffset = itemModel.getShallow('symbolOffset');
37700
37808
 
37701
37809
  labelModel = itemModel.getModel(normalLabelAccessPath);
@@ -37709,6 +37817,8 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
37709
37817
 
37710
37818
  var elStyle = symbolPath.style;
37711
37819
 
37820
+ var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
37821
+
37712
37822
  symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
37713
37823
 
37714
37824
  if (symbolOffset) {
@@ -38764,6 +38874,10 @@ function createGridClipPath(cartesian, hasAnimation, seriesModel) {
38764
38874
  width += lineWidth;
38765
38875
  height += lineWidth;
38766
38876
 
38877
+ // fix: https://github.com/apache/incubator-echarts/issues/11369
38878
+ x = Math.floor(x);
38879
+ width = Math.round(width);
38880
+
38767
38881
  var clipPath = new Rect({
38768
38882
  shape: {
38769
38883
  x: x,
@@ -38861,6 +38975,26 @@ function isPointsSame(points1, points2) {
38861
38975
  return true;
38862
38976
  }
38863
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
+
38864
38998
  function getSmooth(smooth) {
38865
38999
  return typeof (smooth) === 'number' ? smooth : (smooth ? 0.5 : 0);
38866
39000
  }
@@ -39473,6 +39607,24 @@ Chart.extend({
39473
39607
  next = turnPointsIntoStep(diff.next, coordSys, step);
39474
39608
  stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
39475
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
+
39476
39628
  // `diff.current` is subset of `current` (which should be ensured by
39477
39629
  // turnPointsIntoStep), so points in `__points` can be updated when
39478
39630
  // points in `current` are update during animation.
@@ -39579,13 +39731,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39579
39731
  var symbolType = seriesModel.get('symbol');
39580
39732
  var symbolSize = seriesModel.get('symbolSize');
39581
39733
  var keepAspect = seriesModel.get('symbolKeepAspect');
39734
+ var symbolRotate = seriesModel.get('symbolRotate');
39582
39735
 
39583
39736
  var hasSymbolTypeCallback = isFunction$1(symbolType);
39584
39737
  var hasSymbolSizeCallback = isFunction$1(symbolSize);
39585
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
39738
+ var hasSymbolRotateCallback = isFunction$1(symbolRotate);
39739
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
39586
39740
  var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
39587
39741
  var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
39588
-
39589
39742
  data.setVisual({
39590
39743
  legendSymbol: legendSymbol || seriesSymbol,
39591
39744
  // If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -39594,7 +39747,8 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39594
39747
  // some cases but generally it is not recommanded.
39595
39748
  symbol: seriesSymbol,
39596
39749
  symbolSize: seriesSymbolSize,
39597
- symbolKeepAspect: keepAspect
39750
+ symbolKeepAspect: keepAspect,
39751
+ symbolRotate: symbolRotate
39598
39752
  });
39599
39753
 
39600
39754
  // Only visible series has each data be visual encoded
@@ -39608,12 +39762,14 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39608
39762
  var params = seriesModel.getDataParams(idx);
39609
39763
  hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
39610
39764
  hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
39765
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
39611
39766
  }
39612
39767
 
39613
39768
  if (data.hasItemOption) {
39614
39769
  var itemModel = data.getItemModel(idx);
39615
39770
  var itemSymbolType = itemModel.getShallow('symbol', true);
39616
39771
  var itemSymbolSize = itemModel.getShallow('symbolSize', true);
39772
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
39617
39773
  var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
39618
39774
 
39619
39775
  // If has item symbol
@@ -39624,6 +39780,9 @@ var visualSymbol = function (seriesType, defaultSymbolType, legendSymbol) {
39624
39780
  // PENDING Transform symbolSize ?
39625
39781
  data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
39626
39782
  }
39783
+ if (itemSymbolRotate != null) {
39784
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
39785
+ }
39627
39786
  if (itemSymbolKeepAspect != null) {
39628
39787
  data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
39629
39788
  }
@@ -43499,6 +43658,7 @@ extendChartView({
43499
43658
 
43500
43659
  var drawBackground = seriesModel.get('showBackground', true);
43501
43660
  var backgroundModel = seriesModel.getModel('backgroundStyle');
43661
+ var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
43502
43662
 
43503
43663
  var bgEls = [];
43504
43664
  var oldBgEls = this._backgroundEls || [];
@@ -43509,8 +43669,13 @@ extendChartView({
43509
43669
  var layout = getLayout[coord.type](data, dataIndex, itemModel);
43510
43670
 
43511
43671
  if (drawBackground) {
43512
- var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, layout);
43672
+ var bgLayout = getLayout[coord.type](data, dataIndex);
43673
+ var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
43513
43674
  bgEl.useStyle(backgroundModel.getBarItemStyle());
43675
+ // Only cartesian2d support borderRadius.
43676
+ if (coord.type === 'cartesian2d') {
43677
+ bgEl.setShape('r', barBorderRadius);
43678
+ }
43514
43679
  bgEls[dataIndex] = bgEl;
43515
43680
  }
43516
43681
 
@@ -43547,9 +43712,14 @@ extendChartView({
43547
43712
  if (drawBackground) {
43548
43713
  var bgEl = oldBgEls[oldIndex];
43549
43714
  bgEl.useStyle(backgroundModel.getBarItemStyle());
43715
+ // Only cartesian2d support borderRadius.
43716
+ if (coord.type === 'cartesian2d') {
43717
+ bgEl.setShape('r', barBorderRadius);
43718
+ }
43550
43719
  bgEls[newIndex] = bgEl;
43551
43720
 
43552
- var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
43721
+ var bgLayout = getLayout[coord.type](data, newIndex);
43722
+ var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
43553
43723
  updateProps(bgEl, { shape: shape }, animationModel, newIndex);
43554
43724
  }
43555
43725
 
@@ -43799,9 +43969,11 @@ function removeSector(dataIndex, animationModel, el) {
43799
43969
  }
43800
43970
 
43801
43971
  var getLayout = {
43972
+ // itemModel is only used to get borderWidth, which is not needed
43973
+ // when calculating bar background layout.
43802
43974
  cartesian2d: function (data, dataIndex, itemModel) {
43803
43975
  var layout = data.getItemLayout(dataIndex);
43804
- var fixedLineWidth = getLineWidth(itemModel, layout);
43976
+ var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
43805
43977
 
43806
43978
  // fix layout with lineWidth
43807
43979
  var signX = layout.width > 0 ? 1 : -1;
@@ -44675,31 +44847,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) {
44675
44847
  var withAnimation = !firstCreate && animationTypeUpdate === 'transition';
44676
44848
  this._updateLabel(data, idx, withAnimation);
44677
44849
 
44678
- this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled())
44850
+ this.highDownOnUpdate = !seriesModel.get('silent')
44679
44851
  ? function (fromState, toState) {
44852
+ var hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation');
44680
44853
  if (toState === 'emphasis') {
44681
44854
  labelLine.ignore = labelLine.hoverIgnore;
44682
44855
  labelText.ignore = labelText.hoverIgnore;
44683
44856
 
44684
44857
  // Sector may has animation of updating data. Force to move to the last frame
44685
44858
  // Or it may stopped on the wrong shape
44686
- sector.stopAnimation(true);
44687
- sector.animateTo({
44688
- shape: {
44689
- r: layout.r + seriesModel.get('hoverOffset')
44690
- }
44691
- }, 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
+ }
44692
44867
  }
44693
44868
  else {
44694
44869
  labelLine.ignore = labelLine.normalIgnore;
44695
44870
  labelText.ignore = labelText.normalIgnore;
44696
44871
 
44697
- sector.stopAnimation(true);
44698
- sector.animateTo({
44699
- shape: {
44700
- r: layout.r
44701
- }
44702
- }, 300, 'elasticOut');
44872
+ if (hasAnimation) {
44873
+ sector.stopAnimation(true);
44874
+ sector.animateTo({
44875
+ shape: {
44876
+ r: layout.r
44877
+ }
44878
+ }, 300, 'elasticOut');
44879
+ }
44703
44880
  }
44704
44881
  }
44705
44882
  : null;
@@ -46452,7 +46629,7 @@ Radar.prototype.update = function (ecModel, api) {
46452
46629
  }
46453
46630
  // Force all the axis fixing the maxSplitNumber.
46454
46631
  each$1(indicatorAxes, function (indicatorAxis, idx) {
46455
- var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
46632
+ var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
46456
46633
  niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
46457
46634
 
46458
46635
  var axisModel = indicatorAxis.model;
@@ -47572,9 +47749,10 @@ var geoJSONLoader = {
47572
47749
  /**
47573
47750
  * @param {string} mapName
47574
47751
  * @param {Object} mapRecord {specialAreas, geoJSON}
47752
+ * @param {string} nameProperty
47575
47753
  * @return {Object} {regions, boundingRect}
47576
47754
  */
47577
- load: function (mapName, mapRecord) {
47755
+ load: function (mapName, mapRecord, nameProperty) {
47578
47756
 
47579
47757
  var parsed = inner$7(mapRecord).parsed;
47580
47758
 
@@ -47588,7 +47766,7 @@ var geoJSONLoader = {
47588
47766
 
47589
47767
  // https://jsperf.com/try-catch-performance-overhead
47590
47768
  try {
47591
- regions = geoJSON ? parseGeoJson$1(geoJSON) : [];
47769
+ regions = geoJSON ? parseGeoJson$1(geoJSON, nameProperty) : [];
47592
47770
  }
47593
47771
  catch (e) {
47594
47772
  throw new Error('Invalid geoJson format\n' + e.message);
@@ -47796,9 +47974,10 @@ var geoSourceManager = {
47796
47974
  /**
47797
47975
  * @param {string} mapName
47798
47976
  * @param {Object} nameMap
47977
+ * @param {string} nameProperty
47799
47978
  * @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
47800
47979
  */
47801
- load: function (mapName, nameMap) {
47980
+ load: function (mapName, nameMap, nameProperty) {
47802
47981
  var regions = [];
47803
47982
  var regionsMap = createHashMap();
47804
47983
  var nameCoordMap = createHashMap();
@@ -47806,7 +47985,7 @@ var geoSourceManager = {
47806
47985
  var mapRecords = retrieveMap(mapName);
47807
47986
 
47808
47987
  each$1(mapRecords, function (record) {
47809
- var singleSource = loaders[record.type].load(mapName, record);
47988
+ var singleSource = loaders[record.type].load(mapName, record, nameProperty);
47810
47989
 
47811
47990
  each$1(singleSource.regions, function (region) {
47812
47991
  var regionName = region.name;
@@ -47945,7 +48124,7 @@ var MapSeries = SeriesModel.extend({
47945
48124
  });
47946
48125
  }
47947
48126
 
47948
- var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap);
48127
+ var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty);
47949
48128
  each$1(geoSource.regions, function (region) {
47950
48129
  var name = region.name;
47951
48130
  if (!dataNameMap.get(name)) {
@@ -48135,7 +48314,8 @@ var MapSeries = SeriesModel.extend({
48135
48314
  itemStyle: {
48136
48315
  areaColor: 'rgba(255,215,0,0.8)'
48137
48316
  }
48138
- }
48317
+ },
48318
+ nameProperty: 'name'
48139
48319
  }
48140
48320
 
48141
48321
  });
@@ -48745,9 +48925,25 @@ MapDraw.prototype = {
48745
48925
  var group = this.group;
48746
48926
 
48747
48927
  var transformInfo = geo.getTransformInfo();
48748
- group.transform = transformInfo.roamTransform;
48749
- group.decomposeTransform();
48750
- 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
+ }
48751
48947
 
48752
48948
  var scale = transformInfo.rawScale;
48753
48949
  var position = transformInfo.rawPosition;
@@ -48889,6 +49085,12 @@ MapDraw.prototype = {
48889
49085
  }
48890
49086
  );
48891
49087
 
49088
+ if (!isFirstDraw) {
49089
+ // Text animation
49090
+ var textScale = [1 / targetScale[0], 1 / targetScale[1]];
49091
+ updateProps(textEl, { scale: textScale }, mapOrGeoModel);
49092
+ }
49093
+
48892
49094
  regionGroup.add(textEl);
48893
49095
  }
48894
49096
 
@@ -50796,11 +50998,14 @@ TreeNode.prototype = {
50796
50998
  var hostTree = this.hostTree;
50797
50999
  var itemModel = hostTree.data.getItemModel(this.dataIndex);
50798
51000
  var levelModel = this.getLevelModel();
50799
- var leavesModel;
50800
- if (!levelModel && (this.children.length === 0 || (this.children.length !== 0 && this.isExpand === false))) {
50801
- 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);
50802
51008
  }
50803
- return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
50804
51009
  },
50805
51010
 
50806
51011
  /**
@@ -50810,13 +51015,6 @@ TreeNode.prototype = {
50810
51015
  return (this.hostTree.levelModels || [])[this.depth];
50811
51016
  },
50812
51017
 
50813
- /**
50814
- * @return {module:echarts/model/Model}
50815
- */
50816
- getLeavesModel: function () {
50817
- return this.hostTree.leavesModel;
50818
- },
50819
-
50820
51018
  /**
50821
51019
  * @example
50822
51020
  * setItemVisual('color', color);
@@ -50887,9 +51085,8 @@ TreeNode.prototype = {
50887
51085
  * @alias module:echarts/data/Tree
50888
51086
  * @param {module:echarts/model/Model} hostModel
50889
51087
  * @param {Array.<Object>} levelOptions
50890
- * @param {Object} leavesOption
50891
51088
  */
50892
- function Tree(hostModel, levelOptions, leavesOption) {
51089
+ function Tree(hostModel, levelOptions) {
50893
51090
  /**
50894
51091
  * @type {module:echarts/data/Tree~TreeNode}
50895
51092
  * @readOnly
@@ -50925,7 +51122,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
50925
51122
  return new Model(levelDefine, hostModel, hostModel.ecModel);
50926
51123
  });
50927
51124
 
50928
- this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
50929
51125
  }
50930
51126
 
50931
51127
  Tree.prototype = {
@@ -51017,12 +51213,11 @@ Tree.prototype = {
51017
51213
  * @param {module:echarts/model/Model} hostModel
51018
51214
  * @param {Object} treeOptions
51019
51215
  * @param {Array.<Object>} treeOptions.levels
51020
- * @param {Array.<Object>} treeOptions.leaves
51021
51216
  * @return module:echarts/data/Tree
51022
51217
  */
51023
51218
  Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
51024
51219
 
51025
- var tree = new Tree(hostModel, treeOptions.levels, treeOptions.leaves);
51220
+ var tree = new Tree(hostModel, treeOptions && treeOptions.levels);
51026
51221
  var listData = [];
51027
51222
  var dimMax = 1;
51028
51223
 
@@ -51059,6 +51254,8 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
51059
51254
  var list = new List(dimensionsInfo, hostModel);
51060
51255
  list.initData(listData);
51061
51256
 
51257
+ beforeLink && beforeLink(list);
51258
+
51062
51259
  linkList({
51063
51260
  mainData: list,
51064
51261
  struct: tree,
@@ -51067,8 +51264,6 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
51067
51264
 
51068
51265
  tree.update();
51069
51266
 
51070
- beforeLink && beforeLink(list);
51071
-
51072
51267
  return tree;
51073
51268
  };
51074
51269
 
@@ -51128,17 +51323,13 @@ SeriesModel.extend({
51128
51323
  var root = {name: option.name, children: option.data};
51129
51324
 
51130
51325
  var leaves = option.leaves || {};
51326
+ var leavesModel = new Model(leaves, this, this.ecModel);
51131
51327
 
51132
- var treeOption = {};
51133
-
51134
- treeOption.leaves = leaves;
51135
-
51136
- var tree = Tree.createTree(root, this, treeOption, beforeLink);
51328
+ var tree = Tree.createTree(root, this, {}, beforeLink);
51137
51329
 
51138
51330
  function beforeLink(nodeData) {
51139
51331
  nodeData.wrapMethod('getItemModel', function (model, idx) {
51140
51332
  var node = tree.getNodeByDataIndex(idx);
51141
- var leavesModel = node.getLeavesModel();
51142
51333
  if (!node.children.length || !node.isExpand) {
51143
51334
  model.parentModel = leavesModel;
51144
51335
  }
@@ -52753,15 +52944,25 @@ SeriesModel.extend({
52753
52944
  var levels = option.levels || [];
52754
52945
 
52755
52946
  levels = option.levels = setDefault(levels, ecModel);
52756
-
52757
- var treeOption = {};
52758
-
52759
- treeOption.levels = levels;
52947
+ var levelModels = map(levels || [], function (levelDefine) {
52948
+ return new Model(levelDefine, this, ecModel);
52949
+ }, this);
52760
52950
 
52761
52951
  // Make sure always a new tree is created when setOption,
52762
52952
  // in TreemapView, we check whether oldTree === newTree
52763
52953
  // to choose mappings approach among old shapes and new shapes.
52764
- 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;
52765
52966
  },
52766
52967
 
52767
52968
  optionUpdated: function () {
@@ -53772,7 +53973,7 @@ extendChartView({
53772
53973
  var itemModel = node.hostTree.data.getItemModel(node.dataIndex);
53773
53974
  var link = itemModel.get('link', true);
53774
53975
  var linkTarget = itemModel.get('target', true) || 'blank';
53775
- link && window.open(link, linkTarget);
53976
+ link && windowOpen(link, linkTarget);
53776
53977
  }
53777
53978
  }
53778
53979
 
@@ -53962,7 +54163,7 @@ function renderNode(
53962
54163
 
53963
54164
  // Background
53964
54165
  var bg = giveGraphic('background', Rect$1, depth, Z_BG);
53965
- bg && renderBackground(group, bg, isParent && thisLayout.upperHeight);
54166
+ bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight);
53966
54167
 
53967
54168
  // No children, render content.
53968
54169
  if (isParent) {
@@ -54083,16 +54284,7 @@ function renderNode(
54083
54284
  }
54084
54285
 
54085
54286
  function prepareText(normalStyle, emphasisStyle, visualColor, width, height, upperLabelRect) {
54086
- var text = retrieve(
54087
- seriesModel.getFormattedLabel(
54088
- thisNode.dataIndex, 'normal', null, null, upperLabelRect ? 'upperLabel' : 'label'
54089
- ),
54090
- nodeModel.get('name')
54091
- );
54092
- if (!upperLabelRect && thisLayout.isLeafRoot) {
54093
- var iconChar = seriesModel.get('drillDownIcon', true);
54094
- text = iconChar ? iconChar + ' ' + text : text;
54095
- }
54287
+ var defaultText = nodeModel.get('name');
54096
54288
 
54097
54289
  var normalLabelModel = nodeModel.getModel(
54098
54290
  upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL
@@ -54106,12 +54298,18 @@ function renderNode(
54106
54298
  setLabelStyle(
54107
54299
  normalStyle, emphasisStyle, normalLabelModel, emphasisLabelModel,
54108
54300
  {
54109
- defaultText: isShow ? text : null,
54301
+ defaultText: isShow ? defaultText : null,
54110
54302
  autoColor: visualColor,
54111
- isRectText: true
54303
+ isRectText: true,
54304
+ labelFetcher: seriesModel,
54305
+ labelDataIndex: thisNode.dataIndex,
54306
+ labelProp: upperLabelRect ? 'upperLabel' : 'label'
54112
54307
  }
54113
54308
  );
54114
54309
 
54310
+ addDrillDownIcon(normalStyle, upperLabelRect, thisLayout);
54311
+ addDrillDownIcon(emphasisStyle, upperLabelRect, thisLayout);
54312
+
54115
54313
  upperLabelRect && (normalStyle.textRect = clone(upperLabelRect));
54116
54314
 
54117
54315
  normalStyle.truncate = (isShow && normalLabelModel.get('ellipsis'))
@@ -54123,6 +54321,14 @@ function renderNode(
54123
54321
  : null;
54124
54322
  }
54125
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
+
54126
54332
  function giveGraphic(storageName, Ctor, depth, z) {
54127
54333
  var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];
54128
54334
  var lasts = lastsForAnimation[storageName];
@@ -57293,9 +57499,13 @@ lineDrawProto.incrementalPrepareUpdate = function (lineData) {
57293
57499
  this.group.removeAll();
57294
57500
  };
57295
57501
 
57502
+ function isEffectObject(el) {
57503
+ return el.animators && el.animators.length > 0;
57504
+ }
57505
+
57296
57506
  lineDrawProto.incrementalUpdate = function (taskParams, lineData) {
57297
57507
  function updateIncrementalAndHover(el) {
57298
- if (!el.isGroup) {
57508
+ if (!el.isGroup && !isEffectObject(el)) {
57299
57509
  el.incremental = el.useHoverLayer = true;
57300
57510
  }
57301
57511
  }
@@ -64345,7 +64555,13 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
64345
64555
  each$1(nodes, function (node) {
64346
64556
  if (node.outEdges.length) {
64347
64557
  var y = sum(node.outEdges, weightedTarget, orient)
64348
- / 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
+
64349
64565
  if (orient === 'vertical') {
64350
64566
  var nodeX = node.getLayout().x + (y - center$1(node, orient)) * alpha;
64351
64567
  node.setLayout({x: nodeX}, true);
@@ -64362,10 +64578,16 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
64362
64578
  function weightedTarget(edge, orient) {
64363
64579
  return center$1(edge.node2, orient) * edge.getValue();
64364
64580
  }
64581
+ function centerTarget(edge, orient) {
64582
+ return center$1(edge.node2, orient);
64583
+ }
64365
64584
 
64366
64585
  function weightedSource(edge, orient) {
64367
64586
  return center$1(edge.node1, orient) * edge.getValue();
64368
64587
  }
64588
+ function centerSource(edge, orient) {
64589
+ return center$1(edge.node1, orient);
64590
+ }
64369
64591
 
64370
64592
  function center$1(node, orient) {
64371
64593
  return orient === 'vertical'
@@ -64401,8 +64623,15 @@ function relaxLeftToRight(nodesByBreadth, alpha, orient) {
64401
64623
  each$1(nodesByBreadth, function (nodes) {
64402
64624
  each$1(nodes, function (node) {
64403
64625
  if (node.inEdges.length) {
64626
+
64404
64627
  var y = sum(node.inEdges, weightedSource, orient)
64405
- / 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
+
64406
64635
  if (orient === 'vertical') {
64407
64636
  var nodeX = node.getLayout().x + (y - center$1(node, orient)) * alpha;
64408
64637
  node.setLayout({x: nodeX}, true);
@@ -66242,7 +66471,8 @@ effectSymbolProto.updateData = function (data, idx) {
66242
66471
  pos[0] = parsePercent$1(symbolOffset[0], symbolSize[0]);
66243
66472
  pos[1] = parsePercent$1(symbolOffset[1], symbolSize[1]);
66244
66473
  }
66245
- 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;
66246
66476
 
66247
66477
  var effectCfg = {};
66248
66478
 
@@ -68160,8 +68390,8 @@ extendChartView({
68160
68390
 
68161
68391
  rect = new Rect({
68162
68392
  shape: {
68163
- x: Math.floor(point[0] - width / 2),
68164
- 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),
68165
68395
  width: Math.ceil(width),
68166
68396
  height: Math.ceil(height)
68167
68397
  },
@@ -72638,8 +72868,7 @@ SeriesModel.extend({
72638
72868
  align: 'center',
72639
72869
  position: 'inside',
72640
72870
  distance: 5,
72641
- silent: true,
72642
- emphasis: {}
72871
+ silent: true
72643
72872
  },
72644
72873
  itemStyle: {
72645
72874
  borderWidth: 1,
@@ -72649,13 +72878,19 @@ SeriesModel.extend({
72649
72878
  shadowColor: 'rgba(0, 0, 0, 0.2)',
72650
72879
  shadowOffsetX: 0,
72651
72880
  shadowOffsetY: 0,
72652
- opacity: 1,
72653
- emphasis: {},
72654
- highlight: {
72881
+ opacity: 1
72882
+ },
72883
+ highlight: {
72884
+ itemStyle: {
72655
72885
  opacity: 1
72886
+ }
72887
+ },
72888
+ downplay: {
72889
+ itemStyle: {
72890
+ opacity: 0.5
72656
72891
  },
72657
- downplay: {
72658
- opacity: 0.9
72892
+ label: {
72893
+ opacity: 0.6
72659
72894
  }
72660
72895
  },
72661
72896
 
@@ -72901,6 +73136,8 @@ SunburstPieceProto.updateData = function (
72901
73136
 
72902
73137
  this._seriesModel = seriesModel || this._seriesModel;
72903
73138
  this._ecModel = ecModel || this._ecModel;
73139
+
73140
+ setHoverStyle(this);
72904
73141
  };
72905
73142
 
72906
73143
  SunburstPieceProto.onEmphasis = function (highlightPolicy) {
@@ -73364,7 +73601,7 @@ var SunburstView = Chart.extend({
73364
73601
  if (link) {
73365
73602
  var linkTarget = itemModel.get('target', true)
73366
73603
  || '_blank';
73367
- window.open(link, linkTarget);
73604
+ windowOpen(link, linkTarget);
73368
73605
  }
73369
73606
  }
73370
73607
  targetFound = true;
@@ -77288,7 +77525,10 @@ Calendar.prototype = {
77288
77525
  var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY)
77289
77526
  - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1;
77290
77527
 
77291
- // 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:
77292
77532
  // Firstly set system timezone as "Time Zone: America/Toronto",
77293
77533
  // ```
77294
77534
  // var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
@@ -77301,11 +77541,15 @@ Calendar.prototype = {
77301
77541
  var endDateNum = range[1].date.getDate();
77302
77542
  date.setDate(startDateNum + allDay - 1);
77303
77543
  // The bias can not over a month, so just compare date.
77304
- if (date.getDate() !== endDateNum) {
77544
+ var dateNum = date.getDate();
77545
+ if (dateNum !== endDateNum) {
77305
77546
  var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
77306
- 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
+ ) {
77307
77551
  allDay -= sign;
77308
- date.setDate(startDateNum + allDay - 1);
77552
+ date.setDate(dateNum - sign);
77309
77553
  }
77310
77554
  }
77311
77555
 
@@ -78892,7 +79136,7 @@ extendComponentView({
78892
79136
  var feature;
78893
79137
 
78894
79138
  // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
78895
- if (payload && payload.newTitle != null) {
79139
+ if (payload && payload.newTitle != null && payload.featureName === featureName) {
78896
79140
  featureOpt.title = payload.newTitle;
78897
79141
  }
78898
79142
 
@@ -79165,7 +79409,8 @@ var proto$2 = SaveAsImage.prototype;
79165
79409
  proto$2.onclick = function (ecModel, api) {
79166
79410
  var model = this.model;
79167
79411
  var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
79168
- 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';
79169
79414
  var url = api.getConnectedDataURL({
79170
79415
  type: type,
79171
79416
  backgroundColor: model.get('backgroundColor', true)
@@ -79392,7 +79637,8 @@ proto$3.onclick = function (ecModel, api, type) {
79392
79637
  type: 'changeMagicType',
79393
79638
  currentType: type,
79394
79639
  newOption: newOption,
79395
- newTitle: newTitle
79640
+ newTitle: newTitle,
79641
+ featureName: 'magicType'
79396
79642
  });
79397
79643
  };
79398
79644
 
@@ -83576,7 +83822,7 @@ extendComponentView({
83576
83822
  var dataModel = el.dataModel || seriesModel;
83577
83823
  var dataIndex = el.dataIndex;
83578
83824
  var dataType = el.dataType;
83579
- var data = dataModel.getData();
83825
+ var data = dataModel.getData(dataType);
83580
83826
 
83581
83827
  var tooltipModel = buildTooltipModel([
83582
83828
  data.getItemModel(dataIndex),
@@ -85374,12 +85620,12 @@ extendComponentView({
85374
85620
 
85375
85621
  if (link) {
85376
85622
  textEl.on('click', function () {
85377
- window.open(link, '_' + titleModel.get('target'));
85623
+ windowOpen(link, '_' + titleModel.get('target'));
85378
85624
  });
85379
85625
  }
85380
85626
  if (sublink) {
85381
85627
  subTextEl.on('click', function () {
85382
- window.open(sublink, '_' + titleModel.get('subtarget'));
85628
+ windowOpen(link, '_' + titleModel.get('subtarget'));
85383
85629
  });
85384
85630
  }
85385
85631
 
@@ -94144,25 +94390,21 @@ var resetMethods = {
94144
94390
  thisOption.precision = precision;
94145
94391
  splitStep = +splitStep.toFixed(precision);
94146
94392
 
94147
- var index = 0;
94148
-
94149
94393
  if (thisOption.minOpen) {
94150
94394
  pieceList.push({
94151
- index: index++,
94152
94395
  interval: [-Infinity, dataExtent[0]],
94153
94396
  close: [0, 0]
94154
94397
  });
94155
94398
  }
94156
94399
 
94157
94400
  for (
94158
- var curr = dataExtent[0], len = index + splitNumber;
94159
- index < len;
94160
- curr += splitStep
94401
+ var index = 0, curr = dataExtent[0];
94402
+ index < splitNumber;
94403
+ curr += splitStep, index++
94161
94404
  ) {
94162
94405
  var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
94163
94406
 
94164
94407
  pieceList.push({
94165
- index: index++,
94166
94408
  interval: [curr, max],
94167
94409
  close: [1, 1]
94168
94410
  });
@@ -94170,7 +94412,6 @@ var resetMethods = {
94170
94412
 
94171
94413
  if (thisOption.maxOpen) {
94172
94414
  pieceList.push({
94173
- index: index++,
94174
94415
  interval: [dataExtent[1], Infinity],
94175
94416
  close: [0, 0]
94176
94417
  });
@@ -94178,7 +94419,8 @@ var resetMethods = {
94178
94419
 
94179
94420
  reformIntervals(pieceList);
94180
94421
 
94181
- each$1(pieceList, function (piece) {
94422
+ each$1(pieceList, function (piece, index) {
94423
+ piece.index = index;
94182
94424
  piece.text = this.formatValueText(piece.interval);
94183
94425
  }, this);
94184
94426
  },
@@ -97487,11 +97729,16 @@ var SVGPainter = function (root, storage, opts, zrId) {
97487
97729
  this.storage = storage;
97488
97730
  this._opts = opts = extend({}, opts || {});
97489
97731
 
97490
- var svgRoot = createElement('svg');
97491
- svgRoot.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
97492
- svgRoot.setAttribute('version', '1.1');
97493
- svgRoot.setAttribute('baseProfile', 'full');
97494
- 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);
97495
97742
 
97496
97743
  this.gradientManager = new GradientManager(zrId, svgRoot);
97497
97744
  this.clipPathManager = new ClippathManager(zrId, svgRoot);
@@ -97500,11 +97747,13 @@ var SVGPainter = function (root, storage, opts, zrId) {
97500
97747
  var viewport = document.createElement('div');
97501
97748
  viewport.style.cssText = 'overflow:hidden;position:relative';
97502
97749
 
97750
+ this._svgDom = svgDom;
97503
97751
  this._svgRoot = svgRoot;
97752
+ this._backgroundRoot = bgRoot;
97504
97753
  this._viewport = viewport;
97505
97754
 
97506
97755
  root.appendChild(viewport);
97507
- viewport.appendChild(svgRoot);
97756
+ viewport.appendChild(svgDom);
97508
97757
 
97509
97758
  this.resize(opts.width, opts.height);
97510
97759
 
@@ -97523,6 +97772,14 @@ SVGPainter.prototype = {
97523
97772
  return this._viewport;
97524
97773
  },
97525
97774
 
97775
+ getSvgDom: function () {
97776
+ return this._svgDom;
97777
+ },
97778
+
97779
+ getSvgRoot: function () {
97780
+ return this._svgRoot;
97781
+ },
97782
+
97526
97783
  getViewportRootOffset: function () {
97527
97784
  var viewportRoot = this.getViewportRoot();
97528
97785
  if (viewportRoot) {
@@ -97542,7 +97799,21 @@ SVGPainter.prototype = {
97542
97799
 
97543
97800
  setBackgroundColor: function (backgroundColor) {
97544
97801
  // TODO gradient
97545
- 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;
97546
97817
  },
97547
97818
 
97548
97819
  _paintList: function (list) {
@@ -97672,8 +97943,8 @@ SVGPainter.prototype = {
97672
97943
  },
97673
97944
 
97674
97945
  _getDefs: function (isForceCreating) {
97675
- var svgRoot = this._svgRoot;
97676
- var defs = this._svgRoot.getElementsByTagName('defs');
97946
+ var svgRoot = this._svgDom;
97947
+ var defs = svgRoot.getElementsByTagName('defs');
97677
97948
  if (defs.length === 0) {
97678
97949
  // Not exist
97679
97950
  if (isForceCreating) {
@@ -97730,11 +98001,16 @@ SVGPainter.prototype = {
97730
98001
  viewportStyle.width = width + 'px';
97731
98002
  viewportStyle.height = height + 'px';
97732
98003
 
97733
- var svgRoot = this._svgRoot;
98004
+ var svgRoot = this._svgDom;
97734
98005
  // Set width by 'svgRoot.width = width' is invalid
97735
98006
  svgRoot.setAttribute('width', width);
97736
98007
  svgRoot.setAttribute('height', height);
97737
98008
  }
98009
+
98010
+ if (this._backgroundNode) {
98011
+ this._backgroundNode.setAttribute('width', width);
98012
+ this._backgroundNode.setAttribute('height', height);
98013
+ }
97738
98014
  },
97739
98015
 
97740
98016
  /**
@@ -97776,10 +98052,13 @@ SVGPainter.prototype = {
97776
98052
  dispose: function () {
97777
98053
  this.root.innerHTML = '';
97778
98054
 
97779
- this._svgRoot =
97780
- this._viewport =
97781
- this.storage =
97782
- null;
98055
+ this._svgRoot
98056
+ = this._backgroundRoot
98057
+ = this._svgDom
98058
+ = this._backgroundNode
98059
+ = this._viewport
98060
+ = this.storage
98061
+ = null;
97783
98062
  },
97784
98063
 
97785
98064
  clear: function () {
@@ -97788,9 +98067,9 @@ SVGPainter.prototype = {
97788
98067
  }
97789
98068
  },
97790
98069
 
97791
- pathToDataUrl: function () {
98070
+ toDataURL: function () {
97792
98071
  this.refresh();
97793
- var html = this._svgRoot.outerHTML;
98072
+ var html = encodeURIComponent(this._svgDom.outerHTML.replace(/></g, '>\n\r<'));
97794
98073
  return 'data:image/svg+xml;charset=UTF-8,' + html;
97795
98074
  }
97796
98075
  };
@@ -97806,7 +98085,7 @@ function createMethodNotSupport$1(method) {
97806
98085
  each$1([
97807
98086
  'getLayer', 'insertLayer', 'eachLayer', 'eachBuiltinLayer',
97808
98087
  'eachOtherLayer', 'getLayers', 'modLayer', 'delLayer', 'clearLayer',
97809
- 'toDataURL', 'pathToImage'
98088
+ 'pathToImage'
97810
98089
  ], function (name) {
97811
98090
  SVGPainter.prototype[name] = createMethodNotSupport$1(name);
97812
98091
  });