@visactor/vchart 1.2.1 → 1.2.2-beta.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 (73) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +221 -119
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/area/area.js +2 -1
  6. package/cjs/chart/area/area.js.map +1 -1
  7. package/cjs/chart/line/line.js +2 -1
  8. package/cjs/chart/line/line.js.map +1 -1
  9. package/cjs/chart/radar/radar.js +2 -1
  10. package/cjs/chart/radar/radar.js.map +1 -1
  11. package/cjs/compile/compiler.d.ts +2 -1
  12. package/cjs/compile/compiler.js +4 -0
  13. package/cjs/compile/compiler.js.map +1 -1
  14. package/cjs/component/title/title.js +1 -1
  15. package/cjs/component/title/title.js.map +1 -1
  16. package/cjs/component/tooltip/handler/utils/get-spec.js +71 -53
  17. package/cjs/component/tooltip/handler/utils/get-spec.js.map +1 -1
  18. package/cjs/core/index.d.ts +1 -1
  19. package/cjs/core/index.js +1 -1
  20. package/cjs/core/index.js.map +1 -1
  21. package/cjs/core/vchart.d.ts +1 -0
  22. package/cjs/core/vchart.js +13 -11
  23. package/cjs/core/vchart.js.map +1 -1
  24. package/cjs/series/area/interface.d.ts +1 -0
  25. package/cjs/series/area/interface.js.map +1 -1
  26. package/cjs/series/base/tooltip-helper.js +1 -0
  27. package/cjs/series/base/tooltip-helper.js.map +1 -1
  28. package/cjs/series/line/interface.d.ts +1 -0
  29. package/cjs/series/line/interface.js.map +1 -1
  30. package/cjs/series/mixin/line-mixin.d.ts +10 -2
  31. package/cjs/series/mixin/line-mixin.js +53 -6
  32. package/cjs/series/mixin/line-mixin.js.map +1 -1
  33. package/cjs/series/radar/interface.d.ts +1 -0
  34. package/cjs/series/radar/interface.js.map +1 -1
  35. package/cjs/typings/tooltip/line.d.ts +0 -1
  36. package/cjs/typings/tooltip/line.js.map +1 -1
  37. package/cjs/typings/tooltip/shape.d.ts +1 -0
  38. package/cjs/typings/tooltip/shape.js.map +1 -1
  39. package/esm/chart/area/area.js +2 -1
  40. package/esm/chart/area/area.js.map +1 -1
  41. package/esm/chart/line/line.js +2 -1
  42. package/esm/chart/line/line.js.map +1 -1
  43. package/esm/chart/radar/radar.js +2 -1
  44. package/esm/chart/radar/radar.js.map +1 -1
  45. package/esm/compile/compiler.d.ts +2 -1
  46. package/esm/compile/compiler.js +4 -0
  47. package/esm/compile/compiler.js.map +1 -1
  48. package/esm/component/title/title.js +1 -1
  49. package/esm/component/title/title.js.map +1 -1
  50. package/esm/component/tooltip/handler/utils/get-spec.js +68 -50
  51. package/esm/component/tooltip/handler/utils/get-spec.js.map +1 -1
  52. package/esm/core/index.d.ts +1 -1
  53. package/esm/core/index.js +1 -1
  54. package/esm/core/index.js.map +1 -1
  55. package/esm/core/vchart.d.ts +1 -0
  56. package/esm/core/vchart.js +13 -11
  57. package/esm/core/vchart.js.map +1 -1
  58. package/esm/series/area/interface.d.ts +1 -0
  59. package/esm/series/area/interface.js.map +1 -1
  60. package/esm/series/base/tooltip-helper.js +1 -0
  61. package/esm/series/base/tooltip-helper.js.map +1 -1
  62. package/esm/series/line/interface.d.ts +1 -0
  63. package/esm/series/line/interface.js.map +1 -1
  64. package/esm/series/mixin/line-mixin.d.ts +10 -2
  65. package/esm/series/mixin/line-mixin.js +60 -5
  66. package/esm/series/mixin/line-mixin.js.map +1 -1
  67. package/esm/series/radar/interface.d.ts +1 -0
  68. package/esm/series/radar/interface.js.map +1 -1
  69. package/esm/typings/tooltip/line.d.ts +0 -1
  70. package/esm/typings/tooltip/line.js.map +1 -1
  71. package/esm/typings/tooltip/shape.d.ts +1 -0
  72. package/esm/typings/tooltip/shape.js.map +1 -1
  73. package/package.json +5 -5
package/build/index.js CHANGED
@@ -26008,6 +26008,7 @@
26008
26008
  if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
26009
26009
  if (maxLineWidth > 0) for (let i = 0; i < lines.length; i++) {
26010
26010
  const str = lines[i];
26011
+ let needCut = !0;
26011
26012
  if (i === lineCountLimit - 1) {
26012
26013
  const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);
26013
26014
  linesLayout.push({
@@ -26017,14 +26018,17 @@
26017
26018
  break;
26018
26019
  }
26019
26020
  const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth);
26020
- if ("" !== str && "" === clip.str) if (ellipsis) {
26021
- const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);
26022
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
26023
- } else clip.str = "", clip.width = 0;
26021
+ if ("" !== str && "" === clip.str) {
26022
+ if (ellipsis) {
26023
+ const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);
26024
+ clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
26025
+ } else clip.str = "", clip.width = 0;
26026
+ needCut = !1;
26027
+ }
26024
26028
  if (linesLayout.push({
26025
26029
  str: clip.str,
26026
26030
  width: clip.width
26027
- }), clip.str.length === str.length) ;else {
26031
+ }), clip.str.length === str.length) ;else if (needCut) {
26028
26032
  const newStr = str.substring(clip.str.length);
26029
26033
  lines.splice(i + 1, 0, newStr);
26030
26034
  }
@@ -54684,6 +54688,9 @@
54684
54688
  this._view.resize(width, height);
54685
54689
  return this.reRenderAsync({ morph: false });
54686
54690
  }
54691
+ setBackground(color) {
54692
+ this._view?.background(color);
54693
+ }
54687
54694
  reRenderAsync(morphConfig) {
54688
54695
  if (this.isInited) {
54689
54696
  if (this._rafId) {
@@ -54979,7 +54986,6 @@
54979
54986
  this._currentThemeName = ThemeManager.getCurrentThemeName();
54980
54987
  this._setSpec(spec);
54981
54988
  this._updateCurrentTheme();
54982
- const specBackground = typeof spec.background === 'string' ? spec.background : null;
54983
54989
  this._compiler = new Compiler({
54984
54990
  dom: this._container ?? 'none',
54985
54991
  canvas: renderCanvas
@@ -54988,7 +54994,7 @@
54988
54994
  stage,
54989
54995
  pluginList: poptip !== false ? ['poptipForText'] : [],
54990
54996
  ...restOptions,
54991
- background: specBackground || this._currentTheme.background || this._option.background,
54997
+ background: this._getBackground(),
54992
54998
  onError: this._onError
54993
54999
  });
54994
55000
  this._eventDispatcher = new EventDispatcher(this, this._compiler);
@@ -55150,10 +55156,8 @@
55150
55156
  this._compiler?.releaseGrammar();
55151
55157
  }
55152
55158
  else {
55153
- if (updateResult.reCompile) {
55154
- this.getComponents().forEach(c => c.clear());
55155
- this._compiler?.compile({ chart: this._chart, vChart: this }, {});
55156
- }
55159
+ this.getComponents().forEach(c => c.clear());
55160
+ this._compiler?.compile({ chart: this._chart, vChart: this }, {});
55157
55161
  }
55158
55162
  }
55159
55163
  renderSync(morphConfig) {
@@ -55392,6 +55396,11 @@
55392
55396
  this._currentTheme = merge$2({}, ThemeManager.getTheme(this._currentThemeName), this._spec?.theme ?? {});
55393
55397
  }
55394
55398
  setPoptipTheme(merge$2({}, this._currentTheme.component?.poptip));
55399
+ this._compiler?.setBackground(this._getBackground());
55400
+ }
55401
+ _getBackground() {
55402
+ const specBackground = typeof this._spec.background === 'string' ? this._spec.background : null;
55403
+ return specBackground || this._currentTheme.background || this._option.background;
55395
55404
  }
55396
55405
  getCurrentTheme() {
55397
55406
  return this._currentTheme;
@@ -58413,7 +58422,7 @@
58413
58422
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
58414
58423
  Factory.registerRegion('region', Region);
58415
58424
  Factory.registerLayout('base', Layout);
58416
- const version = "1.2.1";
58425
+ const version = "1.2.2-beta.1";
58417
58426
  Logger.getInstance(LoggerLevel.Error);
58418
58427
 
58419
58428
  var SeriesMarkNameEnum;
@@ -61013,6 +61022,7 @@
61013
61022
  },
61014
61023
  content: [
61015
61024
  {
61025
+ seriesId: this.series.id,
61016
61026
  key: this.contentKeyCallback,
61017
61027
  value: this.contentValueCallback,
61018
61028
  hasShape: true,
@@ -64428,6 +64438,32 @@
64428
64438
  }
64429
64439
  return lineMark;
64430
64440
  }
64441
+ _getEventElement(params, reverse = false) {
64442
+ let data = [];
64443
+ params.dimensionInfo.some(df => {
64444
+ df.data.some(dd => {
64445
+ if (dd.series === this) {
64446
+ data = dd.datum;
64447
+ return true;
64448
+ }
64449
+ return false;
64450
+ });
64451
+ return !data.length;
64452
+ });
64453
+ return data;
64454
+ }
64455
+ _dimensionTrigger(params) {
64456
+ const elements = this._getEventElement(params);
64457
+ switch (params.action) {
64458
+ case 'enter':
64459
+ this._symbolActiveMark.getDataView().parse(elements);
64460
+ this._symbolActiveMark.getData().updateData(false);
64461
+ break;
64462
+ case 'leave':
64463
+ this._symbolActiveMark.getDataView().parse([]);
64464
+ this._symbolActiveMark.getData().updateData(false);
64465
+ }
64466
+ }
64431
64467
  initSymbolMark(progressive, isSeriesMark) {
64432
64468
  this._symbolMark = this._createMark(lineLikeSeriesMarkMap.point, {
64433
64469
  morph: shouldDoMorph(this._spec.animation, this._spec.morph, userAnimationConfig('point', this._spec)),
@@ -64437,34 +64473,65 @@
64437
64473
  progressive,
64438
64474
  isSeriesMark: !!isSeriesMark
64439
64475
  });
64476
+ if (this._spec.activePoint === true) {
64477
+ const activeData = new DataView(this._option.dataSet, { name: `${PREFIX}_series_${this.id}_active_point` });
64478
+ activeData.parse([]);
64479
+ this._symbolActiveMark = this._createMark({ name: `active_point`, type: MarkTypeEnum.symbol }, {
64480
+ morph: false,
64481
+ groupKey: this._seriesField,
64482
+ label: null,
64483
+ isSeriesMark: false,
64484
+ dataView: activeData
64485
+ });
64486
+ this._symbolActiveMark.setVisible(false);
64487
+ }
64440
64488
  return this._symbolMark;
64441
64489
  }
64442
64490
  initSymbolMarkStyle() {
64443
64491
  const symbolMark = this._symbolMark;
64444
- if (symbolMark) {
64492
+ if (!symbolMark) {
64493
+ return symbolMark;
64494
+ }
64495
+ this.setMarkStyle(symbolMark, {
64496
+ fill: this.getColorAttribute()
64497
+ }, 'normal', AttributeLevel.Series);
64498
+ if (this._invalidType) {
64445
64499
  this.setMarkStyle(symbolMark, {
64446
- fill: this.getColorAttribute()
64447
- }, 'normal', AttributeLevel.Series);
64448
- if (this._invalidType) {
64449
- this.setMarkStyle(symbolMark, {
64450
- visible: (datum) => {
64451
- if (this._invalidType === 'break') {
64452
- return couldBeValidNumber(datum[this.getStackValueField()]);
64453
- }
64454
- else if (this._invalidType === 'link') {
64455
- return couldBeValidNumber(datum[this.getStackValueField()]);
64456
- }
64457
- return true;
64500
+ visible: (datum) => {
64501
+ if (this._invalidType === 'break') {
64502
+ return couldBeValidNumber(datum[this.getStackValueField()]);
64458
64503
  }
64459
- }, 'normal', AttributeLevel.Series);
64460
- }
64461
- this.setMarkStyle(symbolMark, {
64462
- x: this.dataToPositionX.bind(this),
64463
- y: this.dataToPositionY.bind(this),
64464
- z: this.dataToPositionZ.bind(this)
64504
+ else if (this._invalidType === 'link') {
64505
+ return couldBeValidNumber(datum[this.getStackValueField()]);
64506
+ }
64507
+ return true;
64508
+ }
64465
64509
  }, 'normal', AttributeLevel.Series);
64466
- this._trigger.registerMark(symbolMark);
64467
- this._tooltipHelper?.activeTriggerSet.mark.add(symbolMark);
64510
+ }
64511
+ this.setMarkStyle(symbolMark, {
64512
+ x: this.dataToPositionX.bind(this),
64513
+ y: this.dataToPositionY.bind(this),
64514
+ z: this.dataToPositionZ.bind(this)
64515
+ }, 'normal', AttributeLevel.Series);
64516
+ this._trigger.registerMark(symbolMark);
64517
+ this._tooltipHelper?.activeTriggerSet.mark.add(symbolMark);
64518
+ if (this._symbolActiveMark && this._symbolMark.stateStyle.dimension_hover) {
64519
+ this._symbolActiveMark.setVisible(true);
64520
+ this.event.on(DimensionEventEnum.dimensionHover, this._dimensionTrigger.bind(this));
64521
+ for (const state in this._symbolMark.stateStyle) {
64522
+ this._symbolActiveMark.stateStyle[state] = {};
64523
+ for (const key in this._symbolMark.stateStyle[state]) {
64524
+ this._symbolActiveMark.stateStyle[state][key] = {
64525
+ style: null,
64526
+ level: AttributeLevel.Series,
64527
+ referer: symbolMark
64528
+ };
64529
+ }
64530
+ }
64531
+ this._symbolActiveMark.state.changeStateInfo({
64532
+ stateValue: STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,
64533
+ filter: () => true
64534
+ });
64468
64535
  }
64469
64536
  return symbolMark;
64470
64537
  }
@@ -76337,7 +76404,8 @@
76337
76404
  point: spec.point,
76338
76405
  line: spec.line,
76339
76406
  area: spec.area,
76340
- seriesMark: spec.seriesMark ?? 'area'
76407
+ seriesMark: spec.seriesMark ?? 'area',
76408
+ activePoint: spec.activePoint
76341
76409
  };
76342
76410
  }
76343
76411
  transformSpec(spec) {
@@ -76885,7 +76953,8 @@
76885
76953
  invalidType: spec.invalidType || 'break',
76886
76954
  point: spec.point,
76887
76955
  line: spec.line,
76888
- seriesMark: spec.seriesMark ?? 'line'
76956
+ seriesMark: spec.seriesMark ?? 'line',
76957
+ activePoint: spec.activePoint
76889
76958
  };
76890
76959
  }
76891
76960
  transformSpec(spec) {
@@ -77180,7 +77249,8 @@
77180
77249
  area: merge$2({
77181
77250
  visible: false
77182
77251
  }, spec.area),
77183
- seriesMark: spec.seriesMark ?? 'area'
77252
+ seriesMark: spec.seriesMark ?? 'area',
77253
+ activePoint: spec.activePoint
77184
77254
  };
77185
77255
  }
77186
77256
  transformSpec(spec) {
@@ -83711,7 +83781,7 @@
83711
83781
  };
83712
83782
  }
83713
83783
  _getTitleAttrs() {
83714
- const realWidth = this._spec.width ?? this.getLayoutRect().width;
83784
+ const realWidth = Math.max(0, this._spec.width ?? this.getLayoutRect().width);
83715
83785
  return {
83716
83786
  text: this._spec.text ?? '',
83717
83787
  subtext: this._spec.subtext ?? '',
@@ -86652,8 +86722,6 @@
86652
86722
  ...globalSpec,
86653
86723
  activeType
86654
86724
  };
86655
- let defaultPattern = {};
86656
- let userPattern = {};
86657
86725
  if (activeType === 'mark' && series) {
86658
86726
  const seriesSpec = (series.tooltipHelper?.spec ?? {});
86659
86727
  if (isValid(seriesSpec.visible) || isValid(seriesSpec.activeType)) {
@@ -86669,11 +86737,9 @@
86669
86737
  if (finalSpec.handler?.showTooltip) {
86670
86738
  return finalSpec;
86671
86739
  }
86672
- defaultPattern = makeDefaultPattern(series, 'mark') ?? {};
86673
- userPattern = merge$2({}, cloneDeep(globalSpec.mark), cloneDeep(seriesSpec.mark));
86674
86740
  }
86675
86741
  else if (activeType === 'dimension' && dimensionInfo?.length) {
86676
- const seriesList = dimensionInfo.reduce((list, cur) => list.concat(cur.data.map(data => data.series).filter(isValid)), []);
86742
+ const seriesList = getSeriesListFromDimensionInfo(dimensionInfo);
86677
86743
  if (seriesList.every(series => !getTooltipActualActiveType(series.tooltipHelper?.spec).includes('dimension'))) {
86678
86744
  finalSpec.visible = false;
86679
86745
  }
@@ -86687,6 +86753,83 @@
86687
86753
  if (finalSpec.handler?.showTooltip) {
86688
86754
  return finalSpec;
86689
86755
  }
86756
+ }
86757
+ const defaultPattern = getDefaultTooltipPattern(activeType, series, dimensionInfo);
86758
+ const seriesPattern = getSeriesTooltipPattern(activeType, series, dimensionInfo);
86759
+ const userPattern = merge$2({}, cloneDeep(globalSpec[activeType]), seriesPattern);
86760
+ const defaultPatternTitle = defaultPattern.title;
86761
+ const titleShape = getShapePattern(undefined, userPattern, undefined, defaultPatternTitle);
86762
+ if (isValid(userPattern.title)) {
86763
+ if (!isFunction(userPattern.title)) {
86764
+ userPattern.title = {
86765
+ ...defaultPattern.title,
86766
+ ...titleShape,
86767
+ ...userPattern.title
86768
+ };
86769
+ }
86770
+ else {
86771
+ const userPatternTitle = userPattern.title;
86772
+ userPattern.title = (data, params) => {
86773
+ const userResult = userPatternTitle(data, params) ?? {};
86774
+ return {
86775
+ ...titleShape,
86776
+ ...userResult
86777
+ };
86778
+ };
86779
+ }
86780
+ }
86781
+ else {
86782
+ userPattern.title = {
86783
+ ...defaultPattern.title,
86784
+ ...titleShape
86785
+ };
86786
+ }
86787
+ const defaultPatternContent = array(defaultPattern.content);
86788
+ if (isValid(userPattern.content)) {
86789
+ const shapePatternMap = getShapePatternMapOfEachSeries(defaultPatternContent);
86790
+ if (!isFunction(userPattern.content)) {
86791
+ const newPatternContent = [];
86792
+ array(userPattern.content).forEach(userLine => {
86793
+ newPatternContent.push({
86794
+ ...getShapePattern(userLine, userPattern, shapePatternMap),
86795
+ ...userLine
86796
+ });
86797
+ });
86798
+ userPattern.content = newPatternContent;
86799
+ }
86800
+ else {
86801
+ const userPatternContent = userPattern.content;
86802
+ userPattern.content = (data, params) => {
86803
+ const newPatternContent = [];
86804
+ array(userPatternContent(data, params) ?? []).forEach(userLine => {
86805
+ newPatternContent.push({
86806
+ ...getShapePattern(userLine, userPattern, shapePatternMap),
86807
+ ...userLine
86808
+ });
86809
+ });
86810
+ return newPatternContent;
86811
+ };
86812
+ }
86813
+ }
86814
+ else {
86815
+ userPattern.content = defaultPatternContent.map(line => ({
86816
+ ...line,
86817
+ ...getShapePattern(undefined, userPattern, undefined, line)
86818
+ }));
86819
+ }
86820
+ finalSpec[activeType] = {
86821
+ ...defaultPattern,
86822
+ ...userPattern,
86823
+ activeType
86824
+ };
86825
+ return finalSpec;
86826
+ };
86827
+ const getDefaultTooltipPattern = (activeType, series, dimensionInfo) => {
86828
+ let defaultPattern = {};
86829
+ if (activeType === 'mark' && series) {
86830
+ defaultPattern = makeDefaultPattern(series, 'mark') ?? {};
86831
+ }
86832
+ else if (activeType === 'dimension' && dimensionInfo?.length) {
86690
86833
  const patternList = [];
86691
86834
  dimensionInfo[0].data.forEach(data => {
86692
86835
  const { series } = data;
@@ -86714,16 +86857,23 @@
86714
86857
  ...patternList[0],
86715
86858
  content: defaultPatternContent
86716
86859
  };
86717
- let seriesDimensionPattern = {};
86860
+ }
86861
+ return defaultPattern;
86862
+ };
86863
+ const getSeriesTooltipPattern = (activeType, series, dimensionInfo) => {
86864
+ let seriesPattern = {};
86865
+ if (activeType === 'mark' && series) {
86866
+ const seriesSpec = (series.tooltipHelper?.spec ?? {});
86867
+ seriesPattern = seriesSpec.mark ? cloneDeep(seriesSpec.mark) : {};
86868
+ }
86869
+ else if (activeType === 'dimension' && dimensionInfo?.length) {
86870
+ const seriesList = getSeriesListFromDimensionInfo(dimensionInfo);
86718
86871
  const seriesPatternList = seriesList
86719
86872
  .filter(series => {
86720
86873
  const spec = series.tooltipHelper?.spec;
86721
86874
  return isValid(spec?.dimension) && getTooltipActualActiveType(spec).includes('dimension');
86722
86875
  })
86723
- .map(series => {
86724
- const pattern = series.tooltipHelper.spec.dimension;
86725
- return pattern;
86726
- });
86876
+ .map(series => series.tooltipHelper.spec.dimension);
86727
86877
  if (seriesPatternList.length) {
86728
86878
  let seriesPatternContent = [];
86729
86879
  if (seriesPatternList.every(({ content }) => isNil(content))) {
@@ -86742,86 +86892,38 @@
86742
86892
  }
86743
86893
  });
86744
86894
  }
86745
- seriesDimensionPattern = {
86895
+ seriesPattern = {
86746
86896
  ...seriesPatternList[0],
86747
86897
  content: seriesPatternContent
86748
86898
  };
86749
86899
  }
86750
- userPattern = merge$2({}, cloneDeep(globalSpec.dimension), seriesDimensionPattern);
86751
86900
  }
86752
- const defaultPatternTitle = defaultPattern.title;
86753
- const titleShape = {
86754
- hasShape: userPattern.hasShape ?? defaultPatternTitle?.hasShape,
86755
- shapeType: userPattern.shapeType ?? defaultPatternTitle?.shapeType,
86756
- shapeColor: userPattern.shapeColor ?? defaultPatternTitle?.shapeColor
86757
- };
86758
- if (isValid(userPattern.title)) {
86759
- if (!isFunction(userPattern.title)) {
86760
- userPattern.title = {
86761
- ...defaultPattern.title,
86762
- ...titleShape,
86763
- ...userPattern.title
86764
- };
86765
- }
86766
- else {
86767
- const userPatternTitle = userPattern.title;
86768
- userPattern.title = (data, params) => {
86769
- const userResult = userPatternTitle(data, params) ?? {};
86770
- return {
86771
- ...titleShape,
86772
- ...userResult
86773
- };
86774
- };
86901
+ return seriesPattern;
86902
+ };
86903
+ const getSeriesListFromDimensionInfo = (dimensionInfo) => {
86904
+ return dimensionInfo.reduce((list, cur) => list.concat(cur.data.map(data => data.series).filter(isValid)), []);
86905
+ };
86906
+ const getShapePatternMapOfEachSeries = (content) => {
86907
+ const shapePatternMap = {};
86908
+ content.forEach(line => {
86909
+ const key = line.seriesId ?? 0;
86910
+ if (!shapePatternMap[key]) {
86911
+ shapePatternMap[key] = line;
86775
86912
  }
86776
- }
86777
- else {
86778
- userPattern.title = {
86779
- ...defaultPattern.title,
86780
- ...titleShape
86781
- };
86782
- }
86783
- const getContentShape = (defaultContentLine) => ({
86784
- hasShape: userPattern.hasShape ?? defaultContentLine?.hasShape,
86785
- shapeType: userPattern.shapeType ?? defaultContentLine?.shapeType,
86786
- shapeColor: userPattern.shapeColor ?? defaultContentLine?.shapeColor
86787
86913
  });
86788
- const defaultPatternContent = array(defaultPattern.content);
86789
- if (isValid(userPattern.content)) {
86790
- if (!isFunction(userPattern.content)) {
86791
- const userPatternContent = array(userPattern.content);
86792
- userPatternContent.forEach((line, i) => {
86793
- userPatternContent[i] = {
86794
- ...getContentShape(defaultPatternContent[0]),
86795
- ...line
86796
- };
86797
- });
86798
- }
86799
- else {
86800
- const userPatternContent = userPattern.content;
86801
- userPattern.content = (data, params) => {
86802
- const userResult = array(userPatternContent(data, params) ?? []);
86803
- userResult.forEach((line, i) => {
86804
- userResult[i] = {
86805
- ...getContentShape(defaultPatternContent[0]),
86806
- ...line
86807
- };
86808
- });
86809
- return userResult;
86810
- };
86914
+ return shapePatternMap;
86915
+ };
86916
+ const getShapePattern = (userLinePattern, userPattern, shapePatternMap, defaultShapePattern) => {
86917
+ const shapePatternFromMap = shapePatternMap?.[userLinePattern?.seriesId ?? 0] ?? shapePatternMap?.[0];
86918
+ const shapeKeys = ['hasShape', 'shapeType', 'shapeColor'];
86919
+ const shapePattern = {};
86920
+ shapeKeys.forEach(key => {
86921
+ const value = userLinePattern?.[key] ?? userPattern?.[key] ?? shapePatternFromMap?.[key] ?? defaultShapePattern?.[key];
86922
+ if (value !== undefined) {
86923
+ shapePattern[key] = value;
86811
86924
  }
86812
- }
86813
- else {
86814
- userPattern.content = defaultPatternContent.map(line => ({
86815
- ...line,
86816
- ...getContentShape(line)
86817
- }));
86818
- }
86819
- finalSpec[activeType] = {
86820
- ...defaultPattern,
86821
- ...userPattern,
86822
- activeType
86823
- };
86824
- return finalSpec;
86925
+ });
86926
+ return shapePattern;
86825
86927
  };
86826
86928
 
86827
86929
  const getActualTooltipPositionValue = (position, event) => {