@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.js CHANGED
@@ -1206,7 +1206,7 @@ const encodingXY = (advancedVSeed)=>{
1206
1206
  };
1207
1207
  const { datasetReshapeInfo, dimensions } = advancedVSeed;
1208
1208
  if (!datasetReshapeInfo || !dimensions) return result;
1209
- const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
1209
+ const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
1210
1210
  const isZeroDimension = 0 === dimensions.length;
1211
1211
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
1212
1212
  const { foldInfo, unfoldInfo } = cur;
@@ -1954,7 +1954,7 @@ const discreteLegend = (spec, context)=>{
1954
1954
  const baseConfig = advancedVSeed.config[chartType];
1955
1955
  if (!baseConfig || !baseConfig.legend) return result;
1956
1956
  const { legend } = baseConfig;
1957
- const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize, border, shapeType = 'rectRound' } = legend || {};
1957
+ const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
1958
1958
  const orient = [
1959
1959
  'bottom',
1960
1960
  'bottomLeft',
@@ -1996,8 +1996,8 @@ const discreteLegend = (spec, context)=>{
1996
1996
  result.legends = {
1997
1997
  type: 'discrete',
1998
1998
  visible: enable,
1999
- maxCol: maxSize,
2000
- maxRow: maxSize,
1999
+ maxCol: Math.max(1, maxSize),
2000
+ maxRow: Math.max(1, maxSize),
2001
2001
  autoPage: true,
2002
2002
  orient,
2003
2003
  position: legendPosition,
@@ -2011,7 +2011,7 @@ const discreteLegend = (spec, context)=>{
2011
2011
  }) : void 0,
2012
2012
  item: {
2013
2013
  focus: true,
2014
- maxWidth: 260,
2014
+ maxWidth: '30%',
2015
2015
  focusIconStyle: {
2016
2016
  size: labelFontSize + 2,
2017
2017
  fill: labelFontColor,
@@ -2303,7 +2303,7 @@ const annotationPoint_annotationPoint = (spec, context)=>{
2303
2303
  annotationPoint
2304
2304
  ];
2305
2305
  const markPoint = annotationPointList.flatMap((annotationPoint)=>{
2306
- 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;
2306
+ 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;
2307
2307
  const dataset = advancedVSeed.dataset.flat();
2308
2308
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
2309
2309
  return selectedData.map((datum)=>({
@@ -2373,7 +2373,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2373
2373
  insideEnd: 'insideEndTop'
2374
2374
  };
2375
2375
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2376
- 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;
2376
+ 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;
2377
2377
  const dataset = advancedVSeed.dataset.flat();
2378
2378
  const generateOneMarkLine = (x)=>({
2379
2379
  x: x,
@@ -2415,6 +2415,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2415
2415
  visible: backgroundVisible,
2416
2416
  padding: backgroundPadding,
2417
2417
  style: {
2418
+ dy: textFontSize,
2418
2419
  cornerRadius: backgroundBorderRadius ?? 4,
2419
2420
  fill: backgroundColor,
2420
2421
  stroke: backgroundBorderColor,
@@ -2424,6 +2425,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2424
2425
  },
2425
2426
  endSymbol: {
2426
2427
  visible: true,
2428
+ size: 10 + lineWidth,
2427
2429
  style: {
2428
2430
  dy: 4,
2429
2431
  fill: lineColor
@@ -2470,7 +2472,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2470
2472
  insideEnd: 'insideEndTop'
2471
2473
  };
2472
2474
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2473
- 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;
2475
+ 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;
2474
2476
  const dataset = advancedVSeed.dataset.flat();
2475
2477
  const generateOneMarkLine = (y)=>({
2476
2478
  y,
@@ -2512,6 +2514,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2512
2514
  visible: backgroundVisible,
2513
2515
  padding: backgroundPadding,
2514
2516
  style: {
2517
+ dy: textFontSize,
2515
2518
  cornerRadius: backgroundBorderRadius ?? 4,
2516
2519
  fill: backgroundColor,
2517
2520
  stroke: backgroundBorderColor,
@@ -2521,6 +2524,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2521
2524
  },
2522
2525
  endSymbol: {
2523
2526
  visible: true,
2527
+ size: 10 + lineWidth,
2524
2528
  style: {
2525
2529
  dx: -4,
2526
2530
  fill: lineColor
@@ -2944,7 +2948,7 @@ const pivotDiscreteLegend = (spec, context)=>{
2944
2948
  }), {});
2945
2949
  const { legend, color } = baseConfig;
2946
2950
  const { colorScheme } = color;
2947
- const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize, border, shapeType = 'rectRound' } = legend || {};
2951
+ const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
2948
2952
  const orient = [
2949
2953
  'bottom',
2950
2954
  'bottomLeft',
@@ -2988,8 +2992,8 @@ const pivotDiscreteLegend = (spec, context)=>{
2988
2992
  type: 'discrete',
2989
2993
  orient,
2990
2994
  position: legendPosition,
2991
- maxCol: maxSize,
2992
- maxRow: maxSize,
2995
+ maxCol: Math.max(1, maxSize),
2996
+ maxRow: Math.max(1, maxSize),
2993
2997
  data: colorItems.map((d, index)=>({
2994
2998
  label: d,
2995
2999
  shape: {
@@ -3003,7 +3007,7 @@ const pivotDiscreteLegend = (spec, context)=>{
3003
3007
  })),
3004
3008
  item: {
3005
3009
  focus: true,
3006
- maxWidth: 260,
3010
+ maxWidth: '30%',
3007
3011
  focusIconStyle: {
3008
3012
  size: labelFontSize + 2,
3009
3013
  fill: labelFontColor,
@@ -3753,7 +3757,7 @@ const encodingYX = (advancedVSeed)=>{
3753
3757
  };
3754
3758
  const { datasetReshapeInfo, dimensions } = advancedVSeed;
3755
3759
  if (!datasetReshapeInfo || !dimensions) return result;
3756
- const yDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
3760
+ const yDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
3757
3761
  const isZeroDimension = 0 === dimensions.length;
3758
3762
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
3759
3763
  const { foldInfo, unfoldInfo } = cur;
@@ -4673,8 +4677,8 @@ const encodingXYY = (advancedVSeed)=>{
4673
4677
  const result = {
4674
4678
  ...advancedVSeed
4675
4679
  };
4676
- const { datasetReshapeInfo, dimensions, measures } = advancedVSeed;
4677
- if (!datasetReshapeInfo || !dimensions || !measures) return result;
4680
+ const { datasetReshapeInfo, measures } = advancedVSeed;
4681
+ if (!datasetReshapeInfo || !measures) return result;
4678
4682
  const encoding = datasetReshapeInfo.reduce((prev, cur, index)=>{
4679
4683
  const measure = measures[index];
4680
4684
  if ('children' in measure) {
@@ -5409,8 +5413,8 @@ const encodingPie = (advancedVSeed)=>{
5409
5413
  const result = {
5410
5414
  ...advancedVSeed
5411
5415
  };
5412
- const { datasetReshapeInfo, dimensions } = advancedVSeed;
5413
- if (!datasetReshapeInfo || !dimensions) return result;
5416
+ const { datasetReshapeInfo } = advancedVSeed;
5417
+ if (!datasetReshapeInfo) return result;
5414
5418
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
5415
5419
  const { foldInfo, unfoldInfo } = cur;
5416
5420
  const radius = [
@@ -5629,7 +5633,7 @@ const encodingRose = (advancedVSeed)=>{
5629
5633
  };
5630
5634
  const { datasetReshapeInfo, dimensions, measures } = advancedVSeed;
5631
5635
  if (!datasetReshapeInfo || !dimensions || !measures) return result;
5632
- const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
5636
+ const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
5633
5637
  const is1D1M = 1 === dimensions.length && 1 === measures.length;
5634
5638
  const isZeroDimension = 0 === dimensions.length;
5635
5639
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
@@ -5943,7 +5947,7 @@ const encodingAR = (advancedVSeed)=>{
5943
5947
  };
5944
5948
  const { datasetReshapeInfo, dimensions, measures } = advancedVSeed;
5945
5949
  if (!datasetReshapeInfo || !dimensions || !measures) return result;
5946
- const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
5950
+ const angleDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
5947
5951
  const isZeroDimension = 0 === dimensions.length;
5948
5952
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
5949
5953
  const { foldInfo, unfoldInfo } = cur;
@@ -6116,8 +6120,8 @@ const encodingFunnel = (advancedVSeed)=>{
6116
6120
  const result = {
6117
6121
  ...advancedVSeed
6118
6122
  };
6119
- const { datasetReshapeInfo, dimensions } = advancedVSeed;
6120
- if (!datasetReshapeInfo || !dimensions) return result;
6123
+ const { datasetReshapeInfo } = advancedVSeed;
6124
+ if (!datasetReshapeInfo) return result;
6121
6125
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
6122
6126
  const { foldInfo, unfoldInfo } = cur;
6123
6127
  const size = [
@@ -6329,7 +6333,7 @@ const encodingMatrix = (advancedVSeed)=>{
6329
6333
  };
6330
6334
  const { datasetReshapeInfo, dimensions } = advancedVSeed;
6331
6335
  if (!datasetReshapeInfo || !dimensions) return result;
6332
- const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location);
6336
+ const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
6333
6337
  const isZeroDimension = 0 === dimensions.length;
6334
6338
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
6335
6339
  const { foldInfo, unfoldInfo } = cur;