@visactor/vseed 0.0.31 → 0.0.32

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.
package/dist/index.cjs CHANGED
@@ -1431,7 +1431,7 @@ const encodingXY = (advancedVSeed)=>{
1431
1431
  };
1432
1432
  const { datasetReshapeInfo, dimensions } = advancedVSeed;
1433
1433
  if (!datasetReshapeInfo || !dimensions) return result;
1434
- const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
1434
+ const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
1435
1435
  const isZeroDimension = 0 === dimensions.length;
1436
1436
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
1437
1437
  const { foldInfo, unfoldInfo } = cur;
@@ -2179,7 +2179,7 @@ const discreteLegend = (spec, context)=>{
2179
2179
  const baseConfig = advancedVSeed.config[chartType];
2180
2180
  if (!baseConfig || !baseConfig.legend) return result;
2181
2181
  const { legend } = baseConfig;
2182
- const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize, border, shapeType = 'rectRound' } = legend || {};
2182
+ const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
2183
2183
  const orient = [
2184
2184
  'bottom',
2185
2185
  'bottomLeft',
@@ -2221,8 +2221,8 @@ const discreteLegend = (spec, context)=>{
2221
2221
  result.legends = {
2222
2222
  type: 'discrete',
2223
2223
  visible: enable,
2224
- maxCol: maxSize,
2225
- maxRow: maxSize,
2224
+ maxCol: Math.max(1, maxSize),
2225
+ maxRow: Math.max(1, maxSize),
2226
2226
  autoPage: true,
2227
2227
  orient,
2228
2228
  position: legendPosition,
@@ -2236,7 +2236,7 @@ const discreteLegend = (spec, context)=>{
2236
2236
  }) : void 0,
2237
2237
  item: {
2238
2238
  focus: true,
2239
- maxWidth: 260,
2239
+ maxWidth: '30%',
2240
2240
  focusIconStyle: {
2241
2241
  size: labelFontSize + 2,
2242
2242
  fill: labelFontColor,
@@ -2528,7 +2528,7 @@ const annotationPoint_annotationPoint = (spec, context)=>{
2528
2528
  annotationPoint
2529
2529
  ];
2530
2530
  const markPoint = annotationPointList.flatMap((annotationPoint)=>{
2531
- const { selector: selectorPoint, text = '', textColor = '#cccccc', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
2531
+ const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
2532
2532
  const dataset = advancedVSeed.dataset.flat();
2533
2533
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
2534
2534
  return selectedData.map((datum)=>({
@@ -2598,7 +2598,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2598
2598
  insideEnd: 'insideEndTop'
2599
2599
  };
2600
2600
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2601
- const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#cccccc', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
2601
+ const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
2602
2602
  const dataset = advancedVSeed.dataset.flat();
2603
2603
  const generateOneMarkLine = (x)=>({
2604
2604
  x: x,
@@ -2640,6 +2640,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2640
2640
  visible: backgroundVisible,
2641
2641
  padding: backgroundPadding,
2642
2642
  style: {
2643
+ dy: textFontSize,
2643
2644
  cornerRadius: backgroundBorderRadius ?? 4,
2644
2645
  fill: backgroundColor,
2645
2646
  stroke: backgroundBorderColor,
@@ -2649,6 +2650,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2649
2650
  },
2650
2651
  endSymbol: {
2651
2652
  visible: true,
2653
+ size: 10 + lineWidth,
2652
2654
  style: {
2653
2655
  dy: 4,
2654
2656
  fill: lineColor
@@ -2695,7 +2697,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2695
2697
  insideEnd: 'insideEndTop'
2696
2698
  };
2697
2699
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2698
- const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'bottom', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
2700
+ const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
2699
2701
  const dataset = advancedVSeed.dataset.flat();
2700
2702
  const generateOneMarkLine = (y)=>({
2701
2703
  y,
@@ -2737,6 +2739,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2737
2739
  visible: backgroundVisible,
2738
2740
  padding: backgroundPadding,
2739
2741
  style: {
2742
+ dy: textFontSize,
2740
2743
  cornerRadius: backgroundBorderRadius ?? 4,
2741
2744
  fill: backgroundColor,
2742
2745
  stroke: backgroundBorderColor,
@@ -2746,6 +2749,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2746
2749
  },
2747
2750
  endSymbol: {
2748
2751
  visible: true,
2752
+ size: 10 + lineWidth,
2749
2753
  style: {
2750
2754
  dx: -4,
2751
2755
  fill: lineColor
@@ -3169,7 +3173,7 @@ const pivotDiscreteLegend = (spec, context)=>{
3169
3173
  }), {});
3170
3174
  const { legend, color } = baseConfig;
3171
3175
  const { colorScheme } = color;
3172
- const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize, border, shapeType = 'rectRound' } = legend || {};
3176
+ const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
3173
3177
  const orient = [
3174
3178
  'bottom',
3175
3179
  'bottomLeft',
@@ -3213,8 +3217,8 @@ const pivotDiscreteLegend = (spec, context)=>{
3213
3217
  type: 'discrete',
3214
3218
  orient,
3215
3219
  position: legendPosition,
3216
- maxCol: maxSize,
3217
- maxRow: maxSize,
3220
+ maxCol: Math.max(1, maxSize),
3221
+ maxRow: Math.max(1, maxSize),
3218
3222
  data: colorItems.map((d, index)=>({
3219
3223
  label: d,
3220
3224
  shape: {
@@ -3228,7 +3232,7 @@ const pivotDiscreteLegend = (spec, context)=>{
3228
3232
  })),
3229
3233
  item: {
3230
3234
  focus: true,
3231
- maxWidth: 260,
3235
+ maxWidth: '30%',
3232
3236
  focusIconStyle: {
3233
3237
  size: labelFontSize + 2,
3234
3238
  fill: labelFontColor,
@@ -3978,7 +3982,7 @@ const encodingYX = (advancedVSeed)=>{
3978
3982
  };
3979
3983
  const { datasetReshapeInfo, dimensions } = advancedVSeed;
3980
3984
  if (!datasetReshapeInfo || !dimensions) return result;
3981
- const yDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
3985
+ const yDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
3982
3986
  const isZeroDimension = 0 === dimensions.length;
3983
3987
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
3984
3988
  const { foldInfo, unfoldInfo } = cur;
@@ -4898,8 +4902,8 @@ const encodingXYY = (advancedVSeed)=>{
4898
4902
  const result = {
4899
4903
  ...advancedVSeed
4900
4904
  };
4901
- const { datasetReshapeInfo, dimensions, measures } = advancedVSeed;
4902
- if (!datasetReshapeInfo || !dimensions || !measures) return result;
4905
+ const { datasetReshapeInfo, measures } = advancedVSeed;
4906
+ if (!datasetReshapeInfo || !measures) return result;
4903
4907
  const encoding = datasetReshapeInfo.reduce((prev, cur, index)=>{
4904
4908
  const measure = measures[index];
4905
4909
  if ('children' in measure) {
@@ -5634,8 +5638,8 @@ const encodingPie = (advancedVSeed)=>{
5634
5638
  const result = {
5635
5639
  ...advancedVSeed
5636
5640
  };
5637
- const { datasetReshapeInfo, dimensions } = advancedVSeed;
5638
- if (!datasetReshapeInfo || !dimensions) return result;
5641
+ const { datasetReshapeInfo } = advancedVSeed;
5642
+ if (!datasetReshapeInfo) return result;
5639
5643
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
5640
5644
  const { foldInfo, unfoldInfo } = cur;
5641
5645
  const radius = [
@@ -5854,7 +5858,7 @@ const encodingRose = (advancedVSeed)=>{
5854
5858
  };
5855
5859
  const { datasetReshapeInfo, dimensions, measures } = advancedVSeed;
5856
5860
  if (!datasetReshapeInfo || !dimensions || !measures) return result;
5857
- const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
5861
+ const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
5858
5862
  const is1D1M = 1 === dimensions.length && 1 === measures.length;
5859
5863
  const isZeroDimension = 0 === dimensions.length;
5860
5864
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
@@ -6168,7 +6172,7 @@ const encodingAR = (advancedVSeed)=>{
6168
6172
  };
6169
6173
  const { datasetReshapeInfo, dimensions, measures } = advancedVSeed;
6170
6174
  if (!datasetReshapeInfo || !dimensions || !measures) return result;
6171
- const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
6175
+ const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
6172
6176
  const isZeroDimension = 0 === dimensions.length;
6173
6177
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
6174
6178
  const { foldInfo, unfoldInfo } = cur;
@@ -6341,8 +6345,8 @@ const encodingFunnel = (advancedVSeed)=>{
6341
6345
  const result = {
6342
6346
  ...advancedVSeed
6343
6347
  };
6344
- const { datasetReshapeInfo, dimensions } = advancedVSeed;
6345
- if (!datasetReshapeInfo || !dimensions) return result;
6348
+ const { datasetReshapeInfo } = advancedVSeed;
6349
+ if (!datasetReshapeInfo) return result;
6346
6350
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
6347
6351
  const { foldInfo, unfoldInfo } = cur;
6348
6352
  const size = [
@@ -6554,7 +6558,7 @@ const encodingMatrix = (advancedVSeed)=>{
6554
6558
  };
6555
6559
  const { datasetReshapeInfo, dimensions } = advancedVSeed;
6556
6560
  if (!datasetReshapeInfo || !dimensions) return result;
6557
- const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
6561
+ const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
6558
6562
  const isZeroDimension = 0 === dimensions.length;
6559
6563
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
6560
6564
  const { foldInfo, unfoldInfo } = cur;