@visactor/vseed 0.1.23 → 0.1.25

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 (32) hide show
  1. package/dist/cjs/index.cjs +1 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/pipeline/advanced/chart/pipeline/heatmap.js +1 -2
  4. package/dist/esm/pipeline/advanced/chart/pipeline/heatmap.js.map +1 -1
  5. package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.d.ts +1 -0
  6. package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.js +7 -1
  7. package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.js.map +1 -1
  8. package/dist/esm/pipeline/spec/chart/pipes/axes/radarAngle.js +1 -4
  9. package/dist/esm/pipeline/spec/chart/pipes/axes/radarAngle.js.map +1 -1
  10. package/dist/esm/pipeline/spec/chart/pipes/axes/radarRadius.js +1 -4
  11. package/dist/esm/pipeline/spec/chart/pipes/axes/radarRadius.js.map +1 -1
  12. package/dist/esm/pipeline/spec/chart/pipes/axes/radius.js +1 -4
  13. package/dist/esm/pipeline/spec/chart/pipes/axes/radius.js.map +1 -1
  14. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js +0 -11
  15. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js.map +1 -1
  16. package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js +2 -14
  17. package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js.map +1 -1
  18. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js +0 -11
  19. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js.map +1 -1
  20. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js +2 -14
  21. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js.map +1 -1
  22. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js +0 -13
  23. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js.map +1 -1
  24. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js +0 -14
  25. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js.map +1 -1
  26. package/dist/esm/pipeline/spec/chart/pipes/markStyle/lineStyle.js +4 -7
  27. package/dist/esm/pipeline/spec/chart/pipes/markStyle/lineStyle.js.map +1 -1
  28. package/dist/esm/pipeline/utils/format/createNumFormatter.js +3 -2
  29. package/dist/esm/pipeline/utils/format/createNumFormatter.js.map +1 -1
  30. package/dist/umd/index.js +34 -111
  31. package/dist/umd/index.js.map +1 -1
  32. package/package.json +1 -1
package/dist/umd/index.js CHANGED
@@ -1048,7 +1048,7 @@
1048
1048
  return result || [];
1049
1049
  };
1050
1050
  const createNumFormatter = (format, locale = intl.getLocale())=>{
1051
- const { type = 'number', ratio = 1, symbol = '', thousandSeparator = true, prefix = '', suffix = '', fractionDigits = 2, significantDigits, roundingMode = 'halfExpand', roundingPriority = 'auto' } = format || {};
1051
+ const { type = 'number', ratio = 1, thousandSeparator = true, prefix = '', suffix = '', symbol = '', fractionDigits = 2, significantDigits, roundingMode = 'halfExpand', roundingPriority = 'auto' } = format || {};
1052
1052
  const numFormatterOptions = {
1053
1053
  style: 'decimal',
1054
1054
  notation: 'scientific' === type ? 'scientific' : 'standard',
@@ -1088,7 +1088,8 @@
1088
1088
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
1089
1089
  numStr = parts.join('.');
1090
1090
  }
1091
- return `${prefix}${numStr}${typeSymbol}${symbol}${suffix}`;
1091
+ const validSymbol = symbol ?? '';
1092
+ return `${prefix}${numStr}${typeSymbol}${validSymbol}${suffix}`;
1092
1093
  };
1093
1094
  };
1094
1095
  const autoNumFormatter = (value, locale = intl.getLocale())=>{
@@ -2668,17 +2669,6 @@
2668
2669
  const { measures, dimensions, encoding } = advancedVSeed;
2669
2670
  const config = advancedVSeed.config?.[chartType]?.xAxis;
2670
2671
  if (!result.axes) result.axes = [];
2671
- if (!config) {
2672
- result.axes = [
2673
- ...result.axes,
2674
- {
2675
- visible: true,
2676
- type: 'band',
2677
- orient: 'bottom'
2678
- }
2679
- ];
2680
- return result;
2681
- }
2682
2672
  const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
2683
2673
  const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
2684
2674
  const bandAxis = {
@@ -2760,6 +2750,12 @@
2760
2750
  if (!chunk_VCYTMP4D_n(numFormat)) return formatter(value);
2761
2751
  return String(value);
2762
2752
  };
2753
+ const createLinearPercentFormat = (value, autoFormat, numFormat, formatter, percentFormatter)=>{
2754
+ if (chunk_JK3VNB42_n(autoFormat) && chunk_VCYTMP4D_n(numFormat)) return percentFormatter(value);
2755
+ if (true === autoFormat) return percentFormatter(value);
2756
+ if (!chunk_VCYTMP4D_n(numFormat)) return formatter(value);
2757
+ return String(value);
2758
+ };
2763
2759
  const yLinear = (spec, context)=>{
2764
2760
  const result = {
2765
2761
  ...spec
@@ -2769,17 +2765,6 @@
2769
2765
  const { measures, dimensions, encoding } = advancedVSeed;
2770
2766
  const config = advancedVSeed.config?.[chartType]?.yAxis;
2771
2767
  if (!result.axes) result.axes = [];
2772
- if (!config) {
2773
- result.axes = [
2774
- ...result.axes,
2775
- {
2776
- visible: true,
2777
- type: 'linear',
2778
- orient: 'left'
2779
- }
2780
- ];
2781
- return result;
2782
- }
2783
2768
  const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = config;
2784
2769
  const formatter = createNumFormatter(numFormat);
2785
2770
  const percentFormatter = createNumFormatter({
@@ -2798,7 +2783,7 @@
2798
2783
  label: {
2799
2784
  visible: label?.visible,
2800
2785
  formatMethod: (value)=>{
2801
- if ((isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) && chunk_VCYTMP4D_n(numFormat) && (true === autoFormat || chunk_JK3VNB42_n(autoFormat))) return percentFormatter(value);
2786
+ if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter);
2802
2787
  return createLinearFormat(value, autoFormat, numFormat, formatter);
2803
2788
  },
2804
2789
  style: {
@@ -3287,22 +3272,6 @@
3287
3272
  }
3288
3273
  return result;
3289
3274
  };
3290
- function chunk_HVPVHFDT_i(...e) {
3291
- return chunk_WIMGWYZL_u(chunk_HVPVHFDT_p, e);
3292
- }
3293
- var chunk_HVPVHFDT_p = (e, d)=>{
3294
- let r = Object.create(null);
3295
- for(let n = 0; n < e.length; n++){
3296
- let t = e[n], y = d(t, n, e);
3297
- if (void 0 !== y) {
3298
- let o = r[y];
3299
- void 0 === o ? r[y] = [
3300
- t
3301
- ] : o.push(t);
3302
- }
3303
- }
3304
- return Object.setPrototypeOf(r, Object.prototype), r;
3305
- };
3306
3275
  const getCurveType = (vseed, lineSmooth = false)=>{
3307
3276
  if (!lineSmooth) return 'linear';
3308
3277
  return isRadar(vseed) ? 'catmullRomClosed' : 'monotone';
@@ -3313,8 +3282,7 @@
3313
3282
  };
3314
3283
  const lineStyle_lineStyle = (spec, context)=>{
3315
3284
  const { advancedVSeed } = context;
3316
- const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;
3317
- const { unfoldInfo } = datasetReshapeInfo[0];
3285
+ const { markStyle } = advancedVSeed;
3318
3286
  const { lineStyle } = markStyle;
3319
3287
  const result = {
3320
3288
  ...spec,
@@ -3326,8 +3294,6 @@
3326
3294
  const lineStyles = Array.isArray(lineStyle) ? lineStyle : [
3327
3295
  lineStyle
3328
3296
  ];
3329
- const colorId = unfoldInfo.encodingColorId;
3330
- const lineGroups = chunk_HVPVHFDT_i(dataset, (d)=>d[colorId ?? '']);
3331
3297
  const customMap = lineStyles.reduce((result, style, index)=>{
3332
3298
  const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style;
3333
3299
  const dashSegment = 2 * lineWidth;
@@ -3348,8 +3314,8 @@
3348
3314
  ...result,
3349
3315
  [`custom${index + 1}`]: {
3350
3316
  level: index + 1,
3351
- filter: (datum)=>{
3352
- const lineData = lineGroups[datum[colorId ?? '']];
3317
+ filter: (_, node)=>{
3318
+ const lineData = node.renderNode.context.data;
3353
3319
  for (const d of lineData)if (selector_selector(d, style.selector)) return true;
3354
3320
  return false;
3355
3321
  },
@@ -5416,17 +5382,6 @@
5416
5382
  const { chartType } = vseed;
5417
5383
  const config = advancedVSeed.config?.[chartType]?.xAxis;
5418
5384
  if (!result.axes) result.axes = [];
5419
- if (!config) {
5420
- result.axes = [
5421
- ...result.axes,
5422
- {
5423
- visible: true,
5424
- type: 'linear',
5425
- orient: 'bottom'
5426
- }
5427
- ];
5428
- return result;
5429
- }
5430
5385
  const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = config;
5431
5386
  const formatter = createNumFormatter(numFormat);
5432
5387
  const percentFormatter = createNumFormatter({
@@ -5445,7 +5400,7 @@
5445
5400
  label: {
5446
5401
  visible: label?.visible,
5447
5402
  formatMethod: (value)=>{
5448
- if (chunk_VCYTMP4D_n(numFormat) && (true === autoFormat || chunk_JK3VNB42_n(autoFormat)) && (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed))) return percentFormatter(value);
5403
+ if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter);
5449
5404
  return createLinearFormat(value, autoFormat, numFormat, formatter);
5450
5405
  },
5451
5406
  style: {
@@ -5505,17 +5460,6 @@
5505
5460
  const { measures, dimensions, encoding } = advancedVSeed;
5506
5461
  const config = advancedVSeed.config?.[chartType]?.yAxis;
5507
5462
  if (!result.axes) result.axes = [];
5508
- if (!config) {
5509
- result.axes = [
5510
- ...result.axes,
5511
- {
5512
- visible: true,
5513
- type: 'band',
5514
- orient: 'left'
5515
- }
5516
- ];
5517
- return result;
5518
- }
5519
5463
  const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
5520
5464
  const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
5521
5465
  const bandAxis = {
@@ -5943,6 +5887,22 @@
5943
5887
  }
5944
5888
  return result;
5945
5889
  };
5890
+ function chunk_HVPVHFDT_i(...e) {
5891
+ return chunk_WIMGWYZL_u(chunk_HVPVHFDT_p, e);
5892
+ }
5893
+ var chunk_HVPVHFDT_p = (e, d)=>{
5894
+ let r = Object.create(null);
5895
+ for(let n = 0; n < e.length; n++){
5896
+ let t = e[n], y = d(t, n, e);
5897
+ if (void 0 !== y) {
5898
+ let o = r[y];
5899
+ void 0 === o ? r[y] = [
5900
+ t
5901
+ ] : o.push(t);
5902
+ }
5903
+ }
5904
+ return Object.setPrototypeOf(r, Object.prototype), r;
5905
+ };
5946
5906
  const areaStyle_areaStyle = (spec, context)=>{
5947
5907
  const { advancedVSeed } = context;
5948
5908
  const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;
@@ -7479,19 +7439,6 @@
7479
7439
  ];
7480
7440
  const seriesId = alignTicksConfig ? seriesIds : seriesIds[0];
7481
7441
  if (!result.axes) result.axes = [];
7482
- if (!yAxisConfig) {
7483
- result.axes = [
7484
- ...result.axes,
7485
- {
7486
- visible: true,
7487
- id,
7488
- seriesId,
7489
- type: 'linear',
7490
- orient: 'left'
7491
- }
7492
- ];
7493
- return result;
7494
- }
7495
7442
  const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = yAxisConfig;
7496
7443
  const formatter = createNumFormatter(numFormat);
7497
7444
  const linearAxis = {
@@ -7583,20 +7530,6 @@
7583
7530
  ];
7584
7531
  const seriesId = alignTicksConfig ? seriesIds : seriesIds[1];
7585
7532
  if (!result.axes) result.axes = [];
7586
- if (!yAxisConfig) {
7587
- result.axes = [
7588
- ...result.axes,
7589
- {
7590
- visible: true,
7591
- id,
7592
- seriesId,
7593
- type: 'linear',
7594
- orient: 'right',
7595
- sync
7596
- }
7597
- ];
7598
- return result;
7599
- }
7600
7533
  const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, numFormat = {}, autoFormat } = yAxisConfig;
7601
7534
  const formatter = createNumFormatter(numFormat);
7602
7535
  const linearAxis = {
@@ -8219,13 +8152,10 @@
8219
8152
  result.animation = true;
8220
8153
  return result;
8221
8154
  };
8222
- const radiusAxis = (spec, context)=>{
8155
+ const radiusAxis = (spec)=>{
8223
8156
  const result = {
8224
8157
  ...spec
8225
8158
  };
8226
- const { advancedVSeed } = context;
8227
- const { dimensions, measures } = advancedVSeed;
8228
- if (!dimensions || !measures) return result;
8229
8159
  if (!result.axes) result.axes = [];
8230
8160
  result.axes.push({
8231
8161
  type: 'linear',
@@ -8562,13 +8492,10 @@
8562
8492
  result.animation = true;
8563
8493
  return result;
8564
8494
  };
8565
- const radarAngleAxis = (spec, context)=>{
8495
+ const radarAngleAxis = (spec)=>{
8566
8496
  const result = {
8567
8497
  ...spec
8568
8498
  };
8569
- const { advancedVSeed } = context;
8570
- const { dimensions, measures } = advancedVSeed;
8571
- if (!dimensions || !measures) return result;
8572
8499
  if (!result.axes) result.axes = [];
8573
8500
  result.axes.push({
8574
8501
  orient: 'angle',
@@ -8587,13 +8514,10 @@
8587
8514
  });
8588
8515
  return result;
8589
8516
  };
8590
- const radarRadiusAxis = (spec, context)=>{
8517
+ const radarRadiusAxis = (spec)=>{
8591
8518
  const result = {
8592
8519
  ...spec
8593
8520
  };
8594
- const { advancedVSeed } = context;
8595
- const { dimensions, measures } = advancedVSeed;
8596
- if (!dimensions || !measures) return result;
8597
8521
  if (!result.axes) result.axes = [];
8598
8522
  result.axes.push({
8599
8523
  orient: 'radius',
@@ -8953,8 +8877,7 @@
8953
8877
  buildMeasures,
8954
8878
  deleteEncodingForMeasure([
8955
8879
  'tooltip',
8956
- 'label',
8957
- 'color'
8880
+ 'label'
8958
8881
  ]),
8959
8882
  deleteTooltipAndLabelDimension
8960
8883
  ]),