@visactor/vchart 1.3.1-test.6 → 1.3.1

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 (171) hide show
  1. package/build/es5/index.js +17 -0
  2. package/build/index.js +285 -103
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -0
  5. package/cjs/chart/base-chart.js +2 -1
  6. package/cjs/chart/base-chart.js.map +1 -1
  7. package/cjs/component/axis/base-axis.js +5 -5
  8. package/cjs/component/axis/base-axis.js.map +1 -1
  9. package/cjs/component/base/base-component.d.ts +0 -1
  10. package/cjs/component/base/base-component.js +2 -6
  11. package/cjs/component/base/base-component.js.map +1 -1
  12. package/cjs/component/data-zoom/data-zoom/data-zoom.d.ts +1 -0
  13. package/cjs/component/data-zoom/data-zoom/data-zoom.js +15 -0
  14. package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  15. package/cjs/component/legend/base-legend.d.ts +3 -0
  16. package/cjs/component/legend/base-legend.js +25 -4
  17. package/cjs/component/legend/base-legend.js.map +1 -1
  18. package/cjs/component/legend/discrete/legend.js +4 -3
  19. package/cjs/component/legend/discrete/legend.js.map +1 -1
  20. package/cjs/component/tooltip/handler/utils/common.js +1 -1
  21. package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
  22. package/cjs/component/tooltip/handler/utils/style.js.map +1 -1
  23. package/cjs/component/tooltip/interface/theme.d.ts +1 -1
  24. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  25. package/cjs/component/tooltip/tooltip.js +2 -1
  26. package/cjs/component/tooltip/tooltip.js.map +1 -1
  27. package/cjs/core/index.d.ts +1 -1
  28. package/cjs/core/index.js +1 -1
  29. package/cjs/core/index.js.map +1 -1
  30. package/cjs/core/vchart.js +4 -3
  31. package/cjs/core/vchart.js.map +1 -1
  32. package/cjs/data/transforms/pie.js +17 -5
  33. package/cjs/data/transforms/pie.js.map +1 -1
  34. package/cjs/model/base-model.d.ts +3 -1
  35. package/cjs/model/base-model.js +14 -4
  36. package/cjs/model/base-model.js.map +1 -1
  37. package/cjs/series/base/base-series.js +1 -1
  38. package/cjs/series/base/base-series.js.map +1 -1
  39. package/cjs/series/cartesian/cartesian.d.ts +2 -1
  40. package/cjs/series/cartesian/cartesian.js +2 -2
  41. package/cjs/series/cartesian/cartesian.js.map +1 -1
  42. package/cjs/series/interface/type.d.ts +1 -0
  43. package/cjs/series/interface/type.js +4 -2
  44. package/cjs/series/interface/type.js.map +1 -1
  45. package/cjs/theme/builtin/common/component/data-zoom.js +36 -36
  46. package/cjs/theme/builtin/common/component/data-zoom.js.map +1 -1
  47. package/cjs/theme/builtin/common/component/legend/size-legend.js +4 -4
  48. package/cjs/theme/builtin/common/component/legend/size-legend.js.map +1 -1
  49. package/cjs/theme/builtin/common/component/poptip.js +0 -2
  50. package/cjs/theme/builtin/common/component/poptip.js.map +1 -1
  51. package/cjs/theme/builtin/common/component/title.js.map +1 -1
  52. package/cjs/theme/builtin/common/constants.js +6 -6
  53. package/cjs/theme/builtin/common/constants.js.map +1 -1
  54. package/cjs/theme/builtin/common/legacy/index.d.ts +1 -0
  55. package/cjs/theme/builtin/common/legacy/index.js +21 -0
  56. package/cjs/theme/builtin/common/legacy/index.js.map +1 -0
  57. package/cjs/theme/builtin/common/legacy/legend/color-legend.d.ts +2 -0
  58. package/cjs/theme/builtin/common/legacy/legend/color-legend.js +43 -0
  59. package/cjs/theme/builtin/common/legacy/legend/color-legend.js.map +1 -0
  60. package/cjs/theme/builtin/common/legacy/legend/continuous.d.ts +2 -0
  61. package/cjs/theme/builtin/common/legacy/legend/continuous.js +60 -0
  62. package/cjs/theme/builtin/common/legacy/legend/continuous.js.map +1 -0
  63. package/cjs/theme/builtin/common/legacy/legend/index.d.ts +2 -0
  64. package/cjs/theme/builtin/common/legacy/legend/index.js +24 -0
  65. package/cjs/theme/builtin/common/legacy/legend/index.js.map +1 -0
  66. package/cjs/theme/builtin/common/legacy/legend/size-legend.d.ts +2 -0
  67. package/cjs/theme/builtin/common/legacy/legend/size-legend.js +56 -0
  68. package/cjs/theme/builtin/common/legacy/legend/size-legend.js.map +1 -0
  69. package/cjs/theme/builtin/common/series/treemap.js +1 -1
  70. package/cjs/theme/builtin/common/series/treemap.js.map +1 -1
  71. package/cjs/theme/builtin/dark/index.js +13 -1
  72. package/cjs/theme/builtin/dark/index.js.map +1 -1
  73. package/cjs/theme/builtin/index.d.ts +3 -0
  74. package/cjs/theme/builtin/index.js +10 -3
  75. package/cjs/theme/builtin/index.js.map +1 -1
  76. package/cjs/theme/interface.d.ts +6 -6
  77. package/cjs/theme/interface.js.map +1 -1
  78. package/cjs/theme/theme-manager.d.ts +1 -1
  79. package/cjs/theme/theme-manager.js +3 -7
  80. package/cjs/theme/theme-manager.js.map +1 -1
  81. package/cjs/typings/visual.d.ts +1 -1
  82. package/cjs/typings/visual.js.map +1 -1
  83. package/cjs/util/spec/preprocess.d.ts +2 -2
  84. package/cjs/util/spec/preprocess.js +11 -6
  85. package/cjs/util/spec/preprocess.js.map +1 -1
  86. package/cjs/util/text.d.ts +2 -2
  87. package/cjs/util/text.js.map +1 -1
  88. package/esm/chart/base-chart.js +2 -1
  89. package/esm/chart/base-chart.js.map +1 -1
  90. package/esm/component/axis/base-axis.js +5 -5
  91. package/esm/component/axis/base-axis.js.map +1 -1
  92. package/esm/component/base/base-component.d.ts +0 -1
  93. package/esm/component/base/base-component.js +1 -7
  94. package/esm/component/base/base-component.js.map +1 -1
  95. package/esm/component/data-zoom/data-zoom/data-zoom.d.ts +1 -0
  96. package/esm/component/data-zoom/data-zoom/data-zoom.js +15 -0
  97. package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  98. package/esm/component/legend/base-legend.d.ts +3 -0
  99. package/esm/component/legend/base-legend.js +24 -4
  100. package/esm/component/legend/base-legend.js.map +1 -1
  101. package/esm/component/legend/discrete/legend.js +4 -3
  102. package/esm/component/legend/discrete/legend.js.map +1 -1
  103. package/esm/component/tooltip/handler/utils/common.js +1 -1
  104. package/esm/component/tooltip/handler/utils/common.js.map +1 -1
  105. package/esm/component/tooltip/handler/utils/style.js.map +1 -1
  106. package/esm/component/tooltip/interface/theme.d.ts +1 -1
  107. package/esm/component/tooltip/interface/theme.js.map +1 -1
  108. package/esm/component/tooltip/tooltip.js +1 -1
  109. package/esm/component/tooltip/tooltip.js.map +1 -1
  110. package/esm/core/index.d.ts +1 -1
  111. package/esm/core/index.js +1 -1
  112. package/esm/core/index.js.map +1 -1
  113. package/esm/core/vchart.js +3 -3
  114. package/esm/core/vchart.js.map +1 -1
  115. package/esm/data/transforms/pie.js +15 -5
  116. package/esm/data/transforms/pie.js.map +1 -1
  117. package/esm/model/base-model.d.ts +3 -1
  118. package/esm/model/base-model.js +14 -5
  119. package/esm/model/base-model.js.map +1 -1
  120. package/esm/series/base/base-series.js +1 -1
  121. package/esm/series/base/base-series.js.map +1 -1
  122. package/esm/series/cartesian/cartesian.d.ts +2 -1
  123. package/esm/series/cartesian/cartesian.js +2 -2
  124. package/esm/series/cartesian/cartesian.js.map +1 -1
  125. package/esm/series/interface/type.d.ts +1 -0
  126. package/esm/series/interface/type.js +2 -0
  127. package/esm/series/interface/type.js.map +1 -1
  128. package/esm/theme/builtin/common/component/data-zoom.js +36 -36
  129. package/esm/theme/builtin/common/component/data-zoom.js.map +1 -1
  130. package/esm/theme/builtin/common/component/legend/size-legend.js +4 -4
  131. package/esm/theme/builtin/common/component/legend/size-legend.js.map +1 -1
  132. package/esm/theme/builtin/common/component/poptip.js +0 -2
  133. package/esm/theme/builtin/common/component/poptip.js.map +1 -1
  134. package/esm/theme/builtin/common/component/title.js.map +1 -1
  135. package/esm/theme/builtin/common/constants.js +6 -6
  136. package/esm/theme/builtin/common/constants.js.map +1 -1
  137. package/esm/theme/builtin/common/legacy/index.d.ts +1 -0
  138. package/esm/theme/builtin/common/legacy/index.js +2 -0
  139. package/esm/theme/builtin/common/legacy/index.js.map +1 -0
  140. package/esm/theme/builtin/common/legacy/legend/color-legend.d.ts +2 -0
  141. package/esm/theme/builtin/common/legacy/legend/color-legend.js +39 -0
  142. package/esm/theme/builtin/common/legacy/legend/color-legend.js.map +1 -0
  143. package/esm/theme/builtin/common/legacy/legend/continuous.d.ts +2 -0
  144. package/esm/theme/builtin/common/legacy/legend/continuous.js +54 -0
  145. package/esm/theme/builtin/common/legacy/legend/continuous.js.map +1 -0
  146. package/esm/theme/builtin/common/legacy/legend/index.d.ts +2 -0
  147. package/esm/theme/builtin/common/legacy/legend/index.js +4 -0
  148. package/esm/theme/builtin/common/legacy/legend/index.js.map +1 -0
  149. package/esm/theme/builtin/common/legacy/legend/size-legend.d.ts +2 -0
  150. package/esm/theme/builtin/common/legacy/legend/size-legend.js +54 -0
  151. package/esm/theme/builtin/common/legacy/legend/size-legend.js.map +1 -0
  152. package/esm/theme/builtin/common/series/treemap.js +1 -1
  153. package/esm/theme/builtin/common/series/treemap.js.map +1 -1
  154. package/esm/theme/builtin/dark/index.js +13 -1
  155. package/esm/theme/builtin/dark/index.js.map +1 -1
  156. package/esm/theme/builtin/index.d.ts +3 -0
  157. package/esm/theme/builtin/index.js +12 -0
  158. package/esm/theme/builtin/index.js.map +1 -1
  159. package/esm/theme/interface.d.ts +6 -6
  160. package/esm/theme/interface.js.map +1 -1
  161. package/esm/theme/theme-manager.d.ts +1 -1
  162. package/esm/theme/theme-manager.js +3 -9
  163. package/esm/theme/theme-manager.js.map +1 -1
  164. package/esm/typings/visual.d.ts +1 -1
  165. package/esm/typings/visual.js.map +1 -1
  166. package/esm/util/spec/preprocess.d.ts +2 -2
  167. package/esm/util/spec/preprocess.js +12 -5
  168. package/esm/util/spec/preprocess.js.map +1 -1
  169. package/esm/util/text.d.ts +2 -2
  170. package/esm/util/text.js.map +1 -1
  171. package/package.json +35 -35
package/build/index.js CHANGED
@@ -7517,10 +7517,10 @@
7517
7517
  parse(data, options) {
7518
7518
  let emit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
7519
7519
  var _a;
7520
- this.isRunning = !0, emit && this.target.emit("beforeParse", []);
7520
+ this.isRunning = !0, emit && this.target.emit("beforeParse", []), options && (this.parseOption = options);
7521
7521
  const cloneData = this.cloneParseData(data, options);
7522
7522
  if (null == options ? void 0 : options.type) {
7523
- this.parseOption = options, options = cloneDeep(options);
7523
+ options = cloneDeep(options);
7524
7524
  const parserData = (null !== (_a = this.dataSet.getParser(options.type)) && void 0 !== _a ? _a : this.dataSet.getParser("bytejson"))(cloneData, options.options, this);
7525
7525
  this.rawData = cloneData, this.parserData = parserData, this.history && this.historyData.push(cloneData, parserData), this.latestData = parserData;
7526
7526
  } else this.parserData = cloneData, this.rawData = cloneData, this.history && this.historyData.push(cloneData), this.latestData = cloneData;
@@ -10169,6 +10169,7 @@
10169
10169
  SeriesMarkNameEnum["word"] = "word";
10170
10170
  SeriesMarkNameEnum["fillingWord"] = "fillingWord";
10171
10171
  })(SeriesMarkNameEnum || (SeriesMarkNameEnum = {}));
10172
+ const seriesMarkNameSet = new Set(Object.values(SeriesMarkNameEnum));
10172
10173
 
10173
10174
  var MarkTypeEnum;
10174
10175
  (function (MarkTypeEnum) {
@@ -10318,11 +10319,11 @@
10318
10319
  series });
10319
10320
  }
10320
10321
 
10321
- function preprocessSpecOrTheme(obj, colorScheme, seriesType) {
10322
+ function preprocessSpecOrTheme(type, obj, colorScheme, seriesType) {
10322
10323
  if (isArray$3(obj)) {
10323
10324
  return obj.map(element => {
10324
10325
  if (isObject$f(element) && !isFunction(element)) {
10325
- return preprocessSpecOrTheme(element, colorScheme, seriesType);
10326
+ return preprocessSpecOrTheme(type, element, colorScheme, seriesType);
10326
10327
  }
10327
10328
  return element;
10328
10329
  });
@@ -10342,11 +10343,20 @@
10342
10343
  if (isColorKey(value)) {
10343
10344
  newObj[key] = getActualColor(value, colorScheme, seriesType);
10344
10345
  }
10345
- else if (key === 'padding') {
10346
- newObj[key] = normalizeLayoutPaddingSpec(value);
10347
- }
10348
10346
  else {
10349
- newObj[key] = preprocessSpecOrTheme(value, colorScheme, seriesType);
10347
+ newObj[key] = preprocessSpecOrTheme(seriesMarkNameSet.has(key) ? (type.includes('spec') ? 'mark-spec' : 'mark-theme') : type, value, colorScheme, seriesType);
10348
+ }
10349
+ }
10350
+ else if (!type.includes('mark') && key === 'padding') {
10351
+ newObj[key] = normalizeLayoutPaddingSpec(value);
10352
+ }
10353
+ else if (!type.includes('theme') && key === 'lineHeight' && isString(value) && value[value.length - 1] === '%') {
10354
+ if (isValid(obj.fontSize)) {
10355
+ const scale = Number.parseFloat(value.substring(0, value.length - 1)) / 100;
10356
+ const newValue = obj.fontSize * scale;
10357
+ if (isValidNumber(newValue)) {
10358
+ newObj[key] = newValue;
10359
+ }
10350
10360
  }
10351
10361
  }
10352
10362
  else {
@@ -36419,17 +36429,17 @@
36419
36429
  defaultFontFamily: 'PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol',
36420
36430
  defaultFontSize: 14,
36421
36431
  l1FontSize: 32,
36422
- l1LineHeight: 48,
36432
+ l1LineHeight: '150%',
36423
36433
  l2FontSize: 20,
36424
- l2LineHeight: 28,
36434
+ l2LineHeight: '140%',
36425
36435
  l3FontSize: 16,
36426
- l3LineHeight: 24,
36436
+ l3LineHeight: '150%',
36427
36437
  l4FontSize: 14,
36428
- l4LineHeight: 22,
36438
+ l4LineHeight: '150%',
36429
36439
  l5FontSize: 12,
36430
- l5LineHeight: 16,
36440
+ l5LineHeight: '130%',
36431
36441
  l6FontSize: 10,
36432
- l6LineHeight: 12,
36442
+ l6LineHeight: '120%',
36433
36443
  axisTickSize: 4,
36434
36444
  areaOpacity: 0.2
36435
36445
  };
@@ -56369,7 +56379,7 @@
56369
56379
  }
56370
56380
  },
56371
56381
  nonLeafLabel: {
56372
- padding: THEME_CONSTANTS.l4FontSize * 2,
56382
+ padding: THEME_CONSTANTS.l5FontSize * 2,
56373
56383
  style: {
56374
56384
  fill: 'black',
56375
56385
  stroke: 'white',
@@ -56863,7 +56873,30 @@
56863
56873
  },
56864
56874
  selectedBackground: {
56865
56875
  style: {
56866
- lineWidth: 0
56876
+ fill: { type: 'palette', key: 'dataZoomSelectedColor' },
56877
+ fillOpacity: 0.1,
56878
+ outerBorder: {
56879
+ stroke: { type: 'palette', key: 'dataZoomSelectedColor' },
56880
+ strokeOpacity: 0.2,
56881
+ distance: -0.5,
56882
+ lineWidth: 1
56883
+ }
56884
+ }
56885
+ },
56886
+ selectedBackgroundChart: {
56887
+ area: {
56888
+ style: {
56889
+ visible: false,
56890
+ stroke: false,
56891
+ fill: { type: 'palette', key: 'dataZoomChartColor' }
56892
+ }
56893
+ },
56894
+ line: {
56895
+ style: {
56896
+ visible: false,
56897
+ stroke: { type: 'palette', key: 'dataZoomChartColor' },
56898
+ lineWidth: 1
56899
+ }
56867
56900
  }
56868
56901
  },
56869
56902
  startHandler: {
@@ -56912,13 +56945,6 @@
56912
56945
  fill: { type: 'palette', key: 'secondaryFontColor', default: '#89909d' }
56913
56946
  }
56914
56947
  },
56915
- dragMask: {
56916
- style: {
56917
- fill: { type: 'palette', key: 'dataZoomSelectedColor', a: 0.1 },
56918
- stroke: { type: 'palette', key: 'dataZoomSelectedColor', a: 0.2 },
56919
- lineWidth: 3
56920
- }
56921
- },
56922
56948
  backgroundChart: {
56923
56949
  area: {
56924
56950
  style: {
@@ -56932,20 +56958,6 @@
56932
56958
  lineWidth: 1
56933
56959
  }
56934
56960
  }
56935
- },
56936
- selectedBackgroundChart: {
56937
- area: {
56938
- style: {
56939
- stroke: false,
56940
- fill: { type: 'palette', key: 'dataZoomChartColor' }
56941
- }
56942
- },
56943
- line: {
56944
- style: {
56945
- stroke: { type: 'palette', key: 'dataZoomChartColor' },
56946
- lineWidth: 1
56947
- }
56948
- }
56949
56961
  }
56950
56962
  };
56951
56963
 
@@ -56978,7 +56990,7 @@
56978
56990
  }
56979
56991
  };
56980
56992
 
56981
- const DEFAULT_CONTINUOUS_LEGEND_THEME = {
56993
+ const DEFAULT_CONTINUOUS_LEGEND_THEME$1 = {
56982
56994
  orient: 'right',
56983
56995
  position: 'middle',
56984
56996
  padding: [16, 24],
@@ -57029,7 +57041,7 @@
57029
57041
  }
57030
57042
  };
57031
57043
 
57032
- const handlerTheme$1 = {
57044
+ const handlerTheme$2 = {
57033
57045
  style: {
57034
57046
  symbolType: 'circle',
57035
57047
  lineWidth: 0,
@@ -57045,20 +57057,20 @@
57045
57057
  }
57046
57058
  };
57047
57059
  const colorLegend = {
57048
- horizontal: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME), { rail: {
57060
+ horizontal: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME$1), { rail: {
57049
57061
  width: 200,
57050
57062
  height: 8,
57051
57063
  style: {
57052
57064
  fill: { type: 'palette', key: 'dataZoomBackgroundColor' }
57053
57065
  }
57054
- }, handler: handlerTheme$1 }),
57055
- vertical: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME), { rail: {
57066
+ }, handler: handlerTheme$2 }),
57067
+ vertical: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME$1), { rail: {
57056
57068
  width: 8,
57057
57069
  height: 200,
57058
57070
  style: {
57059
57071
  fill: { type: 'palette', key: 'dataZoomBackgroundColor' }
57060
57072
  }
57061
- }, handler: handlerTheme$1 })
57073
+ }, handler: handlerTheme$2 })
57062
57074
  };
57063
57075
 
57064
57076
  const discreteLegend = {
@@ -57122,7 +57134,7 @@
57122
57134
  allowAllCanceled: false
57123
57135
  };
57124
57136
 
57125
- const handlerTheme = {
57137
+ const handlerTheme$1 = {
57126
57138
  style: {
57127
57139
  symbolType: 'circle',
57128
57140
  lineWidth: 0,
@@ -57134,24 +57146,21 @@
57134
57146
  fill: { type: 'palette', key: 'dataZoomHandlerFillColor' }
57135
57147
  }
57136
57148
  };
57137
- const sizeLegend = Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME), { horizontal: {
57138
- sizeBackground: {
57149
+ const sizeLegend = {
57150
+ horizontal: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME$1), { sizeBackground: {
57139
57151
  fill: { type: 'palette', key: 'dataZoomChartColor' }
57140
- },
57141
- track: {
57152
+ }, track: {
57142
57153
  style: {
57143
57154
  fill: { type: 'palette', key: 'dataZoomSelectedColor', a: 0.8 }
57144
57155
  }
57145
- },
57146
- rail: {
57156
+ }, rail: {
57147
57157
  width: 200,
57148
57158
  height: 4,
57149
57159
  style: {
57150
57160
  fill: { type: 'palette', key: 'dataZoomBackgroundColor' }
57151
57161
  }
57152
- },
57153
- handler: handlerTheme
57154
- }, vertical: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME), { sizeBackground: {
57162
+ }, handler: handlerTheme$1 }),
57163
+ vertical: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME$1), { sizeBackground: {
57155
57164
  fill: { type: 'palette', key: 'dataZoomChartColor' }
57156
57165
  }, track: {
57157
57166
  style: {
@@ -57163,7 +57172,8 @@
57163
57172
  style: {
57164
57173
  fill: { type: 'palette', key: 'dataZoomBackgroundColor' }
57165
57174
  }
57166
- }, handler: handlerTheme }) });
57175
+ }, handler: handlerTheme$1 })
57176
+ };
57167
57177
 
57168
57178
  const mapLabel = {
57169
57179
  visible: true,
@@ -57466,14 +57476,12 @@
57466
57476
  padding: 8,
57467
57477
  titleStyle: {
57468
57478
  fontSize: THEME_CONSTANTS.l5FontSize,
57469
- lineHeight: THEME_CONSTANTS.l5LineHeight,
57470
57479
  fontFamily: THEME_CONSTANTS.defaultFontFamily,
57471
57480
  fontWeight: 'bold',
57472
57481
  fill: { type: 'palette', key: ['titleFontColor', 'primaryFontColor'] }
57473
57482
  },
57474
57483
  contentStyle: {
57475
57484
  fontSize: THEME_CONSTANTS.l5FontSize,
57476
- lineHeight: THEME_CONSTANTS.l5LineHeight,
57477
57485
  fontFamily: THEME_CONSTANTS.defaultFontFamily,
57478
57486
  fill: { type: 'palette', key: 'secondaryFontColor' }
57479
57487
  },
@@ -57546,6 +57554,111 @@
57546
57554
  animationThreshold: 2000
57547
57555
  };
57548
57556
 
57557
+ const DEFAULT_CONTINUOUS_LEGEND_THEME = {
57558
+ orient: 'right',
57559
+ position: 'middle',
57560
+ padding: 30,
57561
+ title: {
57562
+ visible: false,
57563
+ padding: 0,
57564
+ textStyle: {
57565
+ fontSize: THEME_CONSTANTS.defaultFontSize,
57566
+ fontWeight: 'normal',
57567
+ fill: { type: 'palette', key: 'titleFontColor' }
57568
+ },
57569
+ space: 12
57570
+ },
57571
+ handler: {
57572
+ visible: true
57573
+ },
57574
+ startText: {
57575
+ style: {
57576
+ fontSize: THEME_CONSTANTS.defaultFontSize,
57577
+ fontWeight: 'normal',
57578
+ fill: { type: 'palette', key: 'labelFontColor' }
57579
+ }
57580
+ },
57581
+ endText: {
57582
+ style: {
57583
+ fontSize: THEME_CONSTANTS.defaultFontSize,
57584
+ fontWeight: 'normal',
57585
+ fill: { type: 'palette', key: 'labelFontColor' }
57586
+ }
57587
+ },
57588
+ handlerText: {
57589
+ style: {
57590
+ fontSize: THEME_CONSTANTS.defaultFontSize,
57591
+ fontWeight: 'normal',
57592
+ fill: { type: 'palette', key: 'labelFontColor' }
57593
+ }
57594
+ }
57595
+ };
57596
+
57597
+ const handlerTheme = {
57598
+ style: {
57599
+ symbolType: 'circle',
57600
+ lineWidth: 4,
57601
+ outerBorder: { distance: 2, lineWidth: 1, stroke: '#ccc' },
57602
+ size: 10,
57603
+ stroke: '#fff'
57604
+ }
57605
+ };
57606
+ ({
57607
+ horizontal: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME), { rail: {
57608
+ width: 200,
57609
+ height: 8,
57610
+ style: {
57611
+ fill: 'rgba(0,0,0,0.04)'
57612
+ }
57613
+ }, handler: handlerTheme }),
57614
+ vertical: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME), { rail: {
57615
+ width: 8,
57616
+ height: 200,
57617
+ style: {
57618
+ fill: 'rgba(0,0,0,0.04)'
57619
+ }
57620
+ }, handler: handlerTheme })
57621
+ });
57622
+
57623
+ const getHandlerTheme = (align) => ({
57624
+ style: {
57625
+ symbolType: getSizeHandlerPath(align),
57626
+ fill: '#fff',
57627
+ lineWidth: 1,
57628
+ size: 10,
57629
+ stroke: '#ccc',
57630
+ outerBorder: false
57631
+ }
57632
+ });
57633
+ ({
57634
+ horizontal: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME), { sizeBackground: {
57635
+ fill: '#cdcdcd'
57636
+ }, track: {
57637
+ style: {
57638
+ fill: 'rgba(20,20,20,0.1)'
57639
+ }
57640
+ }, rail: {
57641
+ width: 200,
57642
+ height: 4,
57643
+ style: {
57644
+ fill: 'rgba(0,0,0,0.04)'
57645
+ }
57646
+ }, handler: getHandlerTheme('top') }),
57647
+ vertical: Object.assign(Object.assign({}, DEFAULT_CONTINUOUS_LEGEND_THEME), { sizeBackground: {
57648
+ fill: '#cdcdcd'
57649
+ }, track: {
57650
+ style: {
57651
+ fill: 'rgba(20,20,20,0.1)'
57652
+ }
57653
+ }, rail: {
57654
+ width: 4,
57655
+ height: 200,
57656
+ style: {
57657
+ fill: 'rgba(0,0,0,0.04)'
57658
+ }
57659
+ }, handler: getHandlerTheme('right') })
57660
+ });
57661
+
57549
57662
  const colorScheme = {
57550
57663
  default: {
57551
57664
  dataScheme,
@@ -57575,7 +57688,19 @@
57575
57688
 
57576
57689
  const darkTheme = {
57577
57690
  name: 'dark',
57578
- colorScheme
57691
+ colorScheme,
57692
+ component: {
57693
+ dataZoom: {
57694
+ selectedBackground: {
57695
+ style: {
57696
+ fillOpacity: 0.4,
57697
+ outerBorder: {
57698
+ strokeOpacity: 0.4
57699
+ }
57700
+ }
57701
+ }
57702
+ }
57703
+ }
57579
57704
  };
57580
57705
 
57581
57706
  const builtinThemeMap = new Map([
@@ -57583,6 +57708,13 @@
57583
57708
  [darkTheme.name, darkTheme]
57584
57709
  ]);
57585
57710
  const defaultThemeName = lightTheme.name;
57711
+ const themes = new Map([[defaultThemeName, builtinThemeMap.get(defaultThemeName)]]);
57712
+ const getMergedTheme = (theme) => mergeTheme({}, builtinThemeMap.get(defaultThemeName), theme);
57713
+ builtinThemeMap.forEach((theme, name) => {
57714
+ if (name !== defaultThemeName) {
57715
+ themes.set(name, getMergedTheme(theme));
57716
+ }
57717
+ });
57586
57718
 
57587
57719
  class InstanceManager {
57588
57720
  static registerInstance(instance) {
@@ -57614,7 +57746,7 @@
57614
57746
  if (!name) {
57615
57747
  return;
57616
57748
  }
57617
- ThemeManager.themes.set(name, mergeTheme({}, ThemeManager.getDefaultTheme(), theme));
57749
+ ThemeManager.themes.set(name, getMergedTheme(theme));
57618
57750
  }
57619
57751
  static getTheme(name) {
57620
57752
  return ThemeManager.themes.get(name) || ThemeManager.getDefaultTheme();
@@ -57642,14 +57774,8 @@
57642
57774
  return ThemeManager._currentThemeName;
57643
57775
  }
57644
57776
  }
57645
- ThemeManager.themes = new Map();
57777
+ ThemeManager.themes = themes;
57646
57778
  ThemeManager._currentThemeName = defaultThemeName;
57647
- ThemeManager.registerTheme(defaultThemeName, builtinThemeMap.get(defaultThemeName));
57648
- builtinThemeMap.forEach((theme, name) => {
57649
- if (name !== defaultThemeName) {
57650
- ThemeManager.registerTheme(name, theme);
57651
- }
57652
- });
57653
57779
 
57654
57780
  var GrammarType;
57655
57781
  (function (GrammarType) {
@@ -58634,14 +58760,14 @@
58634
58760
  const userTheme = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.theme) !== null && _b !== void 0 ? _b : this._option.theme;
58635
58761
  if (isString(userTheme)) {
58636
58762
  const theme = mergeTheme({}, ThemeManager.getTheme(userTheme));
58637
- this._currentTheme = preprocessSpecOrTheme(theme, theme.colorScheme);
58763
+ this._currentTheme = preprocessSpecOrTheme('theme', theme, theme.colorScheme);
58638
58764
  this._currentThemeName = userTheme;
58639
58765
  }
58640
58766
  else {
58641
58767
  const theme = mergeTheme({}, ThemeManager.getTheme(this._currentThemeName), userTheme !== null && userTheme !== void 0 ? userTheme : {});
58642
- this._currentTheme = preprocessSpecOrTheme(theme, theme.colorScheme);
58768
+ this._currentTheme = preprocessSpecOrTheme('theme', theme, theme.colorScheme);
58643
58769
  }
58644
- setPoptipTheme(preprocessSpecOrTheme(mergeSpec({}, (_c = this._currentTheme.component) === null || _c === void 0 ? void 0 : _c.poptip)));
58770
+ setPoptipTheme(preprocessSpecOrTheme('mark-theme', mergeSpec({}, (_c = this._currentTheme.component) === null || _c === void 0 ? void 0 : _c.poptip)));
58645
58771
  (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.setBackground(this._getBackground());
58646
58772
  }
58647
58773
  _getBackground() {
@@ -59786,18 +59912,33 @@
59786
59912
  });
59787
59913
  }
59788
59914
  _mergeThemeToSpec() {
59789
- const chartSpec = this.getChart().getSpec();
59790
- this._spec = mergeSpec({}, this._theme, this._getDefaultSpecFromChart(chartSpec), this._originalSpec);
59915
+ if (this._shouldMergeThemeToSpec()) {
59916
+ const specFromChart = this._getDefaultSpecFromChart(this.getChart().getSpec());
59917
+ const merge = (originalSpec) => mergeSpec({}, this._theme, this._prepareSpecBeforeMergingTheme(specFromChart), this._prepareSpecBeforeMergingTheme(originalSpec));
59918
+ if (isArray$3(this._originalSpec)) {
59919
+ this._spec = this._originalSpec.map(spec => merge(spec));
59920
+ }
59921
+ else {
59922
+ this._spec = merge(this._originalSpec);
59923
+ }
59924
+ }
59925
+ this._prepareSpecAfterMergingTheme();
59791
59926
  }
59792
59927
  _getDefaultSpecFromChart(chartSpec) {
59793
59928
  return {};
59794
59929
  }
59795
- _preprocessSpec(obj) {
59930
+ _shouldMergeThemeToSpec() {
59931
+ return true;
59932
+ }
59933
+ _prepareSpecBeforeMergingTheme(obj) {
59934
+ return obj;
59935
+ }
59936
+ _prepareSpecAfterMergingTheme(obj) {
59796
59937
  var _a, _b, _c;
59797
59938
  if (!arguments.length) {
59798
59939
  obj = this._spec;
59799
59940
  }
59800
- const newObj = preprocessSpecOrTheme(obj, (_c = (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.colorScheme, this.modelType === 'series' ? this.type : undefined);
59941
+ const newObj = preprocessSpecOrTheme('spec', obj, (_c = (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.colorScheme, this.modelType === 'series' ? this.type : undefined);
59801
59942
  if (!arguments.length) {
59802
59943
  this._spec = newObj;
59803
59944
  }
@@ -61732,7 +61873,7 @@
61732
61873
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
61733
61874
  Factory.registerRegion('region', Region);
61734
61875
  Factory.registerLayout('base', Layout);
61735
- const version = "1.3.0";
61876
+ const version = "1.3.1";
61736
61877
  Logger.getInstance(LoggerLevel.Error);
61737
61878
 
61738
61879
  const Appear_ClipIn$1 = {
@@ -64754,7 +64895,6 @@
64754
64895
  super._initTheme((_a = globalTheme.series[this.type]) !== null && _a !== void 0 ? _a : {});
64755
64896
  }
64756
64897
  this._mergeThemeToSpec();
64757
- this._preprocessSpec();
64758
64898
  }
64759
64899
  _createMark(markInfo, option = {}) {
64760
64900
  var _a, _b, _c, _d;
@@ -65253,8 +65393,8 @@
65253
65393
  }
65254
65394
  return array((_b = this._spec.xField) !== null && _b !== void 0 ? _b : this.fieldX);
65255
65395
  }
65256
- fillData() {
65257
- super.fillData();
65396
+ viewDataUpdate(d) {
65397
+ super.viewDataUpdate(d);
65258
65398
  if (this.sortDataByAxis) {
65259
65399
  this._sortDataInAxisDomain();
65260
65400
  }
@@ -66665,7 +66805,8 @@
66665
66805
  progressiveStep: spec.progressiveStep,
66666
66806
  progressiveThreshold: spec.progressiveThreshold,
66667
66807
  background: spec.seriesBackground,
66668
- invalidType: spec.invalidType
66808
+ invalidType: spec.invalidType,
66809
+ seriesField: spec.seriesField
66669
66810
  };
66670
66811
  return series;
66671
66812
  }
@@ -71870,18 +72011,30 @@
71870
72011
  MapChart.type = ChartTypeEnum.map;
71871
72012
  MapChart.view = 'singleDefault';
71872
72013
 
72014
+ function transformInvalidValue(value) {
72015
+ if (!couldBeValidNumber(value)) {
72016
+ return 0;
72017
+ }
72018
+ return Number.parseFloat(value);
72019
+ }
71873
72020
  const pie = (originData, op) => {
71874
72021
  const data = originData.map((datum) => (Object.assign({}, datum)));
71875
72022
  if (!data || data.length === 0) {
71876
72023
  return data;
71877
72024
  }
71878
72025
  const { angleField, startAngle, endAngle, asStartAngle, asEndAngle, asMiddleAngle, asRadian, asRatio, asQuadrant, asK } = op;
71879
- const total = data.reduce((sum, d) => Number.parseFloat(d[angleField]) + sum, 0);
71880
- const max = data.reduce((m, d) => Math.max(m, Number.parseFloat(d[angleField])), -Infinity);
72026
+ let total = 0;
72027
+ let max = -Infinity;
72028
+ for (let index = 0; index < data.length; index++) {
72029
+ const angleFieldValue = transformInvalidValue(data[index][angleField]);
72030
+ total += angleFieldValue;
72031
+ max = Math.max(angleFieldValue, max);
72032
+ }
71881
72033
  const intervalAngle = endAngle - startAngle;
71882
72034
  let lastAngle = startAngle;
71883
72035
  data.forEach(d => {
71884
- const ratio = Number.parseFloat(d[angleField]) / total;
72036
+ const angleFieldValue = transformInvalidValue(d[angleField]);
72037
+ const ratio = total ? angleFieldValue / total : 0;
71885
72038
  const radian = ratio * intervalAngle;
71886
72039
  asRatio && (d[asRatio] = ratio);
71887
72040
  asStartAngle && (d[asStartAngle] = lastAngle);
@@ -71889,10 +72042,12 @@
71889
72042
  asMiddleAngle && (d[asMiddleAngle] = lastAngle + radian / 2);
71890
72043
  asRadian && (d[asRadian] = radian);
71891
72044
  asQuadrant && (d[asQuadrant] = computeQuadrant$2(lastAngle + radian / 2));
71892
- asK && (d[asK] = Number.parseFloat(d[angleField]) / max);
72045
+ asK && (d[asK] = max ? angleFieldValue / max : 0);
71893
72046
  lastAngle = d[asEndAngle];
71894
72047
  });
71895
- data[data.length - 1][asEndAngle] = endAngle;
72048
+ if (total !== 0) {
72049
+ data[data.length - 1][asEndAngle] = endAngle;
72050
+ }
71896
72051
  return data;
71897
72052
  };
71898
72053
 
@@ -80914,23 +81069,12 @@
80914
81069
  else {
80915
81070
  super._initTheme(getComponentThemeFromGlobalTheme(this.type, globalTheme, this._originalSpec, this._option.getChart()));
80916
81071
  }
80917
- if (this._shouldMergeThemeToSpec) {
80918
- if (isArray$3(this._originalSpec)) {
80919
- this._spec = this._originalSpec.map(spec => merge$2({}, this._theme, spec));
80920
- }
80921
- else {
80922
- this._mergeThemeToSpec();
80923
- }
80924
- }
80925
- this._preprocessSpec();
81072
+ this._mergeThemeToSpec();
80926
81073
  const { padding, noOuterPadding = true, orient } = this._spec;
80927
81074
  if (noOuterPadding && padding && orient) {
80928
81075
  this._spec.padding = Object.assign(Object.assign({}, normalizeLayoutPaddingSpec(padding)), { [orient]: 0 });
80929
81076
  }
80930
81077
  }
80931
- _shouldMergeThemeToSpec() {
80932
- return true;
80933
- }
80934
81078
  getContainer() {
80935
81079
  if (!this._container) {
80936
81080
  this._container = this._option.globalInstance.getStage().find(node => node.name === 'root', true);
@@ -81645,6 +81789,17 @@
81645
81789
  this._startHandlerSize = startHandlerVisble ? this._spec.startHandler.style.size : 0;
81646
81790
  this._endHandlerSize = endHandlerVisble ? this._spec.endHandler.style.size : 0;
81647
81791
  }
81792
+ _prepareSpecBeforeMergingTheme(originalSpec) {
81793
+ const newSpec = Object.assign({}, originalSpec);
81794
+ const { selectedBackgroundChart = {} } = newSpec;
81795
+ const { line, area } = selectedBackgroundChart;
81796
+ if (line || area) {
81797
+ newSpec.selectedBackgroundChart = Object.assign(Object.assign({}, selectedBackgroundChart), { line: line && line.visible !== false
81798
+ ? Object.assign(Object.assign({}, line), { style: Object.assign(Object.assign({}, line.style), { visible: true }) }) : line, area: area && area.visible !== false
81799
+ ? Object.assign(Object.assign({}, area), { style: Object.assign(Object.assign({}, area.style), { visible: true }) }) : area });
81800
+ }
81801
+ return newSpec;
81802
+ }
81648
81803
  onLayoutEnd(ctx) {
81649
81804
  this._updateScaleRange();
81650
81805
  super.onLayoutEnd(ctx);
@@ -83777,8 +83932,8 @@
83777
83932
  label: Object.assign({ style: isFunction(spec.label.style)
83778
83933
  ? (datum, index, data, layer) => {
83779
83934
  var _a;
83780
- const style = this._preprocessSpec(spec.label.style(datum.rawValue, index, datum, data, layer));
83781
- return transformToGraphic(this._preprocessSpec(mergeSpec({}, (_a = this._theme.label) === null || _a === void 0 ? void 0 : _a.style, style)));
83935
+ const style = this._prepareSpecAfterMergingTheme(spec.label.style(datum.rawValue, index, datum, data, layer));
83936
+ return transformToGraphic(this._prepareSpecAfterMergingTheme(mergeSpec({}, (_a = this._theme.label) === null || _a === void 0 ? void 0 : _a.style, style)));
83782
83937
  }
83783
83938
  : transformToGraphic(spec.label.style), formatMethod: spec.label.formatMethod
83784
83939
  ? (value, datum, index) => {
@@ -83793,8 +83948,8 @@
83793
83948
  style: isFunction(spec.tick.style)
83794
83949
  ? (value, index, datum, data) => {
83795
83950
  var _a;
83796
- const style = this._preprocessSpec(spec.tick.style(value, index, datum, data));
83797
- return transformToGraphic(this._preprocessSpec(mergeSpec({}, (_a = this._theme.tick) === null || _a === void 0 ? void 0 : _a.style, style)));
83951
+ const style = this._prepareSpecAfterMergingTheme(spec.tick.style(value, index, datum, data));
83952
+ return transformToGraphic(this._prepareSpecAfterMergingTheme(mergeSpec({}, (_a = this._theme.tick) === null || _a === void 0 ? void 0 : _a.style, style)));
83798
83953
  }
83799
83954
  : transformToGraphic(spec.tick.style),
83800
83955
  state: transformStateStyle(spec.tick.state),
@@ -83823,7 +83978,7 @@
83823
83978
  ? (datum, index) => {
83824
83979
  var _a, _b;
83825
83980
  const style = spec.grid.style((_a = datum.datum) === null || _a === void 0 ? void 0 : _a.rawValue, index, datum.datum);
83826
- return transformToGraphic(this._preprocessSpec(mergeSpec({}, (_b = this._theme.grid) === null || _b === void 0 ? void 0 : _b.style, style)));
83981
+ return transformToGraphic(this._prepareSpecAfterMergingTheme(mergeSpec({}, (_b = this._theme.grid) === null || _b === void 0 ? void 0 : _b.style, style)));
83827
83982
  }
83828
83983
  : transformToGraphic(spec.grid.style)
83829
83984
  },
@@ -85623,6 +85778,7 @@
85623
85778
  this._orient = 'left';
85624
85779
  this._visible = true;
85625
85780
  this._position = 'middle';
85781
+ this._preSelectedData = [];
85626
85782
  this._selectedData = [];
85627
85783
  this.effect = {
85628
85784
  onSelectedDataChange: () => {
@@ -85694,9 +85850,13 @@
85694
85850
  }
85695
85851
  changeRegions(regions) {
85696
85852
  }
85853
+ _bindLegendDataChange() {
85854
+ this._preSelectedData = [...this._selectedData];
85855
+ this._initSelectedData();
85856
+ }
85697
85857
  initData() {
85698
85858
  const legendData = this._initLegendData();
85699
- legendData.target.addListener('change', this._initSelectedData.bind(this));
85859
+ legendData.target.addListener('change', this._bindLegendDataChange.bind(this));
85700
85860
  this._legendData = new CompilableData(this._option, legendData);
85701
85861
  this._initSelectedData();
85702
85862
  eachSeries(this._regions, s => {
@@ -85785,12 +85945,29 @@
85785
85945
  result.y2 = result.y1 + height;
85786
85946
  return result;
85787
85947
  }
85948
+ onDataUpdate() {
85949
+ var _a, _b;
85950
+ if (JSON.stringify(this._preSelectedData) === JSON.stringify(this._selectedData)) {
85951
+ return;
85952
+ }
85953
+ if (this._legendComponent) {
85954
+ const attrs = this._getLegendAttributes(this.getLayoutRect());
85955
+ if (!isEqual$1(attrs, this._cacheAttrs)) {
85956
+ this._legendComponent.setAttributes(mergeSpec({}, attrs, {
85957
+ defaultSelected: this._selectedData
85958
+ }));
85959
+ }
85960
+ }
85961
+ (_b = (_a = this.effect).onSelectedDataChange) === null || _b === void 0 ? void 0 : _b.call(_a);
85962
+ this.event.emit(ChartEvent.legendSelectedDataChange, { model: this });
85963
+ }
85788
85964
  clear() {
85789
85965
  if (this._legendComponent) {
85790
85966
  this._container.removeChild(this._legendComponent);
85791
85967
  this._legendComponent = null;
85792
85968
  }
85793
85969
  this._cacheAttrs = null;
85970
+ this._preSelectedData = null;
85794
85971
  super.clear();
85795
85972
  }
85796
85973
  }
@@ -85903,7 +86080,7 @@
85903
86080
  }
85904
86081
  _getLegendAttributes(rect) {
85905
86082
  const layout = this.layoutOrient === 'bottom' || this.layoutOrient === 'top' ? 'horizontal' : 'vertical';
85906
- const attrs = Object.assign({ layout, items: this._getLegendItems(), zIndex: this.layoutZIndex, maxWidth: rect.width, maxHeight: rect.height }, getLegendAttributes(this._spec, rect));
86083
+ const attrs = Object.assign(Object.assign({ layout, items: this._getLegendItems(), zIndex: this.layoutZIndex }, getLegendAttributes(this._spec, rect)), { maxWidth: rect.width, maxHeight: rect.height });
85907
86084
  this._addDefaultTitleText(attrs);
85908
86085
  return attrs;
85909
86086
  }
@@ -89094,7 +89271,12 @@
89094
89271
  MarkPoint.speckey = 'markPoint';
89095
89272
 
89096
89273
  function escapeHTML(value) {
89097
- return String(value).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\(/g, '&#40;');
89274
+ return String(value)
89275
+ .replace(/&/g, '&amp;')
89276
+ .replace(/</g, '&lt;')
89277
+ .replace(/>/g, '&gt;')
89278
+ .replace(/\(/g, '&#40;')
89279
+ .replace(/ /g, ' &nbsp;');
89098
89280
  }
89099
89281
  const getTooltipContentValue = (field, datum, params) => {
89100
89282
  if (isNil(field)) {
@@ -91317,7 +91499,7 @@
91317
91499
  }
91318
91500
  _initTheme(theme) {
91319
91501
  super._initTheme(theme);
91320
- this._spec.style = this._preprocessSpec(mergeSpec({}, this._theme, this._originalSpec.style));
91502
+ this._spec.style = this._prepareSpecAfterMergingTheme(mergeSpec({}, this._theme, this._originalSpec.style));
91321
91503
  }
91322
91504
  _shouldMergeThemeToSpec() {
91323
91505
  return false;