@visactor/vseed 0.4.23 → 0.4.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 (89) hide show
  1. package/dist/cjs/index.cjs +2 -2
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/pipeline/advanced/chart/pipes/annotation/annotation.js +2 -1
  4. package/dist/esm/pipeline/advanced/chart/pipes/annotation/annotation.js.map +1 -1
  5. package/dist/esm/pipeline/spec/chart/pipeline/bar.js +3 -1
  6. package/dist/esm/pipeline/spec/chart/pipeline/bar.js.map +1 -1
  7. package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js +3 -1
  8. package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js.map +1 -1
  9. package/dist/esm/pipeline/spec/chart/pipeline/column.js +3 -1
  10. package/dist/esm/pipeline/spec/chart/pipeline/column.js.map +1 -1
  11. package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js +3 -1
  12. package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js.map +1 -1
  13. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.d.ts +2 -0
  14. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js +134 -0
  15. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js.map +1 -0
  16. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.d.ts +27 -0
  17. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.js +167 -0
  18. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.js.map +1 -0
  19. package/dist/esm/pipeline/spec/chart/pipes/annotation/index.d.ts +1 -0
  20. package/dist/esm/pipeline/spec/chart/pipes/annotation/index.js +1 -0
  21. package/dist/esm/theme/common/annotaion.d.ts +6 -1
  22. package/dist/esm/theme/common/annotaion.js +18 -1
  23. package/dist/esm/theme/common/annotaion.js.map +1 -1
  24. package/dist/esm/theme/dark/area.d.ts +2 -0
  25. package/dist/esm/theme/dark/bar.d.ts +3 -0
  26. package/dist/esm/theme/dark/boxPlot.d.ts +1 -0
  27. package/dist/esm/theme/dark/column.d.ts +3 -0
  28. package/dist/esm/theme/dark/dualAxis.d.ts +1 -0
  29. package/dist/esm/theme/dark/histogram.d.ts +1 -0
  30. package/dist/esm/theme/dark/line.d.ts +1 -0
  31. package/dist/esm/theme/dark/race.d.ts +3 -0
  32. package/dist/esm/theme/dark/raceLine.d.ts +1 -0
  33. package/dist/esm/theme/dark/scatter.d.ts +1 -0
  34. package/dist/esm/theme/light/area.d.ts +2 -0
  35. package/dist/esm/theme/light/bar.d.ts +3 -0
  36. package/dist/esm/theme/light/boxPlot.d.ts +1 -0
  37. package/dist/esm/theme/light/column.d.ts +3 -0
  38. package/dist/esm/theme/light/dualAxis.d.ts +1 -0
  39. package/dist/esm/theme/light/histogram.d.ts +1 -0
  40. package/dist/esm/theme/light/line.d.ts +1 -0
  41. package/dist/esm/theme/light/race.d.ts +3 -0
  42. package/dist/esm/theme/light/raceLine.d.ts +1 -0
  43. package/dist/esm/theme/light/scatter.d.ts +1 -0
  44. package/dist/esm/theme/tokenTheme.js +3 -0
  45. package/dist/esm/theme/tokenTheme.js.map +1 -1
  46. package/dist/esm/types/chartType/bar/bar.d.ts +5 -1
  47. package/dist/esm/types/chartType/bar/zBar.d.ts +303 -0
  48. package/dist/esm/types/chartType/bar/zBar.js +2 -1
  49. package/dist/esm/types/chartType/bar/zBar.js.map +1 -1
  50. package/dist/esm/types/chartType/barParallel/barParallel.d.ts +5 -1
  51. package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +303 -0
  52. package/dist/esm/types/chartType/barParallel/zBarParallel.js +2 -1
  53. package/dist/esm/types/chartType/barParallel/zBarParallel.js.map +1 -1
  54. package/dist/esm/types/chartType/column/column.d.ts +5 -1
  55. package/dist/esm/types/chartType/column/zColumn.d.ts +303 -0
  56. package/dist/esm/types/chartType/column/zColumn.js +2 -1
  57. package/dist/esm/types/chartType/column/zColumn.js.map +1 -1
  58. package/dist/esm/types/chartType/columnParallel/columnParallel.d.ts +5 -1
  59. package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +303 -0
  60. package/dist/esm/types/chartType/columnParallel/zColumnParallel.js +2 -1
  61. package/dist/esm/types/chartType/columnParallel/zColumnParallel.js.map +1 -1
  62. package/dist/esm/types/properties/annotation/annotation.d.ts +303 -0
  63. package/dist/esm/types/properties/annotation/annotation.js +3 -1
  64. package/dist/esm/types/properties/annotation/annotation.js.map +1 -1
  65. package/dist/esm/types/properties/annotation/annotationDifferenceLine.d.ts +51 -0
  66. package/dist/esm/types/properties/annotation/annotationDifferenceLine.js +0 -0
  67. package/dist/esm/types/properties/annotation/index.d.ts +2 -0
  68. package/dist/esm/types/properties/annotation/index.js +1 -0
  69. package/dist/esm/types/properties/annotation/zAnnotationDifferenceLine.d.ts +294 -0
  70. package/dist/esm/types/properties/annotation/zAnnotationDifferenceLine.js +29 -0
  71. package/dist/esm/types/properties/annotation/zAnnotationDifferenceLine.js.map +1 -0
  72. package/dist/esm/types/properties/config/annotation/annotation.d.ts +2 -0
  73. package/dist/esm/types/properties/config/annotation/zAnnotation.d.ts +12 -0
  74. package/dist/esm/types/properties/config/annotation/zAnnotation.js +10 -2
  75. package/dist/esm/types/properties/config/annotation/zAnnotation.js.map +1 -1
  76. package/dist/esm/types/properties/config/area.d.ts +12 -0
  77. package/dist/esm/types/properties/config/bar.d.ts +18 -0
  78. package/dist/esm/types/properties/config/boxplot.d.ts +6 -0
  79. package/dist/esm/types/properties/config/column.d.ts +18 -0
  80. package/dist/esm/types/properties/config/config.d.ts +114 -0
  81. package/dist/esm/types/properties/config/dualAxis.d.ts +6 -0
  82. package/dist/esm/types/properties/config/histogram.d.ts +6 -0
  83. package/dist/esm/types/properties/config/line.d.ts +6 -0
  84. package/dist/esm/types/properties/config/race.d.ts +36 -0
  85. package/dist/esm/types/properties/config/scatter.d.ts +6 -0
  86. package/dist/esm/types/properties/theme/customTheme.d.ts +228 -0
  87. package/dist/umd/index.js +366 -6
  88. package/dist/umd/index.js.map +1 -1
  89. package/package.json +1 -1
package/dist/umd/index.js CHANGED
@@ -1117,8 +1117,9 @@
1117
1117
  pivotTableSpecPipeline: ()=>pivotTableSpecPipeline,
1118
1118
  registerRoseParallel: ()=>registerRoseParallel,
1119
1119
  terminateWorkerPool: ()=>terminateWorkerPool,
1120
- zYBandAxis: ()=>zYBandAxis,
1120
+ zDifferenceAnchor: ()=>zDifferenceAnchor,
1121
1121
  zRaceBar: ()=>zRaceBar,
1122
+ zYBandAxis: ()=>zYBandAxis,
1122
1123
  zTimeFormat: ()=>zTimeFormat,
1123
1124
  zRacePie: ()=>zRacePie,
1124
1125
  DimAxisType: ()=>DimAxisType,
@@ -1192,6 +1193,7 @@
1192
1193
  zKdeRegressionLine: ()=>zKdeRegressionLine,
1193
1194
  zDynamicFilter: ()=>zDynamicFilter,
1194
1195
  zTooltip: ()=>zTooltip,
1196
+ zAnnotationDifferenceLineConfig: ()=>zAnnotationDifferenceLineConfig,
1195
1197
  zAreaPercentConfig: ()=>zAreaPercentConfig,
1196
1198
  zPivotChartGridConfig: ()=>zPivotChartGridConfig,
1197
1199
  zMarkStyle: ()=>zMarkStyle,
@@ -1206,10 +1208,10 @@
1206
1208
  BinStartMeasureId: ()=>BinStartMeasureId,
1207
1209
  MeasureEncodingEnum: ()=>MeasureEncodingEnum,
1208
1210
  ColorEncoding: ()=>ColorEncoding,
1209
- zLowessRegressionLine: ()=>zLowessRegressionLine,
1211
+ zDifferenceSelectors: ()=>zDifferenceSelectors,
1210
1212
  heatmapAdvancedPipeline: ()=>heatmapAdvancedPipeline,
1211
1213
  tableSpecPipeline: ()=>tableSpecPipeline,
1212
- zTableDynamicFilter: ()=>zTableDynamicFilter,
1214
+ zLowessRegressionLine: ()=>zLowessRegressionLine,
1213
1215
  zEncoding: ()=>zEncoding,
1214
1216
  zAreaConfig: ()=>zAreaConfig,
1215
1217
  registerAll: ()=>registerAll,
@@ -1225,6 +1227,7 @@
1225
1227
  FoldMeasureValue: ()=>FoldMeasureValue,
1226
1228
  isVChart: ()=>isVChart,
1227
1229
  zBrushConfig: ()=>zBrushConfig,
1230
+ zTableDynamicFilter: ()=>zTableDynamicFilter,
1228
1231
  zTheme: ()=>zTheme,
1229
1232
  autoFormatter: ()=>autoFormatter,
1230
1233
  zDatum: ()=>zDatum,
@@ -1235,6 +1238,7 @@
1235
1238
  zDimensionEncoding: ()=>zDimensionEncoding,
1236
1239
  zBodyCellStyle: ()=>zBodyCellStyle,
1237
1240
  barAdvancedPipeline: ()=>barAdvancedPipeline,
1241
+ zDifferenceSelector: ()=>zDifferenceSelector,
1238
1242
  zTreeMap: ()=>zTreeMap,
1239
1243
  DUAL_AXIS_CHART_COLUMN_Z_INDEX: ()=>1000,
1240
1244
  condition: ()=>condition_condition,
@@ -1321,6 +1325,7 @@
1321
1325
  zLinearColor: ()=>zLinearColor,
1322
1326
  zCirclePacking: ()=>zCirclePacking,
1323
1327
  isDualAxisChartType: ()=>isDualAxisChartType,
1328
+ zAnnotationDifferenceLine: ()=>zAnnotationDifferenceLine,
1324
1329
  raceScatterAdvancedPipeline: ()=>raceScatterAdvancedPipeline,
1325
1330
  treeMapAdvancedPipeline: ()=>treeMapAdvancedPipeline,
1326
1331
  barParallelAdvancedPipeline: ()=>barParallelAdvancedPipeline,
@@ -5612,7 +5617,8 @@ self.R = R;
5612
5617
  'annotationPoint',
5613
5618
  'annotationHorizontalLine',
5614
5619
  'annotationVerticalLine',
5615
- 'annotationArea'
5620
+ 'annotationArea',
5621
+ 'annotationDifferenceLine'
5616
5622
  ]);
5617
5623
  return {
5618
5624
  ...advancedVSeed,
@@ -9147,6 +9153,296 @@ self.R = R;
9147
9153
  };
9148
9154
  return result;
9149
9155
  };
9156
+ const toArray = (value)=>{
9157
+ if (Array.isArray(value)) return value;
9158
+ return null == value ? [] : [
9159
+ value
9160
+ ];
9161
+ };
9162
+ const getDifferenceBandFields = (spec)=>toArray('horizontal' === spec.direction ? spec.yField : spec.xField);
9163
+ const getDifferenceValueField = (spec)=>{
9164
+ const valueField = toArray('horizontal' === spec.direction ? spec.xField : spec.yField)[0];
9165
+ if (!valueField) throw new Error('annotationDifferenceLine requires a value field in the target chart spec');
9166
+ return valueField;
9167
+ };
9168
+ const normalizeDifferenceValue = (value, selectorLabel, field)=>{
9169
+ const numberValue = Number(value);
9170
+ if (Number.isNaN(numberValue)) throw new Error(`annotationDifferenceLine ${selectorLabel} selector resolved to a non-numeric value on field "${field}"`);
9171
+ return numberValue;
9172
+ };
9173
+ const buildStackGroupDatum = (datum, bandFields)=>Object.fromEntries(bandFields.map((field)=>[
9174
+ field,
9175
+ datum[field]
9176
+ ]));
9177
+ const buildFallbackSelectorDatum = (selectorValue)=>{
9178
+ const selectorList = Array.isArray(selectorValue) ? selectorValue : [
9179
+ selectorValue
9180
+ ];
9181
+ const fallbackDatum = {};
9182
+ for (const currentSelector of selectorList){
9183
+ if (isValueSelector(currentSelector) || isFieldSelector(currentSelector)) return;
9184
+ if (isMeasureSelector(currentSelector)) {
9185
+ const operator = currentSelector.operator || currentSelector.op;
9186
+ const selectorValues = Array.isArray(currentSelector.value) ? currentSelector.value : [
9187
+ currentSelector.value
9188
+ ];
9189
+ if (![
9190
+ '=',
9191
+ '=='
9192
+ ].includes(operator) || 1 !== selectorValues.length) return;
9193
+ fallbackDatum[currentSelector.field] = selectorValues[0];
9194
+ continue;
9195
+ }
9196
+ if (isDimensionSelector(currentSelector)) {
9197
+ const operator = currentSelector.operator || currentSelector.op;
9198
+ const selectorValues = Array.isArray(currentSelector.value) ? currentSelector.value : [
9199
+ currentSelector.value
9200
+ ];
9201
+ if ('in' !== operator || 1 !== selectorValues.length) return;
9202
+ fallbackDatum[currentSelector.field] = selectorValues[0];
9203
+ continue;
9204
+ }
9205
+ if (isPartialDatumSelector(currentSelector)) {
9206
+ Object.assign(fallbackDatum, currentSelector);
9207
+ continue;
9208
+ }
9209
+ return;
9210
+ }
9211
+ return Object.keys(fallbackDatum).length > 0 ? fallbackDatum : void 0;
9212
+ };
9213
+ const inferFallbackValue = (fallbackDatum, valueField, bandFields)=>{
9214
+ if (valueField in fallbackDatum) return fallbackDatum[valueField];
9215
+ const numericCandidateKeys = Object.keys(fallbackDatum).filter((key)=>{
9216
+ if (key === valueField || bandFields.includes(key)) return false;
9217
+ return 'number' == typeof fallbackDatum[key];
9218
+ });
9219
+ if (1 !== numericCandidateKeys.length) return;
9220
+ return fallbackDatum[numericCandidateKeys[0]];
9221
+ };
9222
+ const resolveFallbackAnchor = (options)=>{
9223
+ const { selectorLabel, selectorValue, valueField, bandFields } = options;
9224
+ const fallbackDatum = buildFallbackSelectorDatum(selectorValue);
9225
+ if (!fallbackDatum) return;
9226
+ const inferredValue = inferFallbackValue(fallbackDatum, valueField, bandFields);
9227
+ if (void 0 === inferredValue) return;
9228
+ const coordinateDatum = {
9229
+ ...fallbackDatum,
9230
+ [valueField]: inferredValue
9231
+ };
9232
+ try {
9233
+ return {
9234
+ selectorLabel,
9235
+ coordinateDatum,
9236
+ matchedDatum: fallbackDatum,
9237
+ value: normalizeDifferenceValue(inferredValue, selectorLabel, valueField)
9238
+ };
9239
+ } catch {
9240
+ return;
9241
+ }
9242
+ };
9243
+ const hasMixedSigns = (values)=>{
9244
+ const nonZeroValues = values.filter((value)=>0 !== value);
9245
+ return nonZeroValues.some((value)=>value > 0) && nonZeroValues.some((value)=>value < 0);
9246
+ };
9247
+ const isDifferenceLineStacked = (vseed, advancedVSeed)=>('column' === vseed.chartType || 'bar' === vseed.chartType) && hasMultipleMeasureInSingleView(advancedVSeed.reshapeMeasures ?? []);
9248
+ const resolveDifferenceAnchor = (options)=>{
9249
+ const { dataset, selectorLabel, selectorValue, spec, isStacked } = options;
9250
+ const matches = dataset.filter((datum)=>selector_selector(datum, selectorValue));
9251
+ const valueField = getDifferenceValueField(spec);
9252
+ const bandFields = getDifferenceBandFields(spec);
9253
+ if (0 === matches.length) return isStacked ? void 0 : resolveFallbackAnchor({
9254
+ selectorLabel,
9255
+ selectorValue,
9256
+ valueField,
9257
+ bandFields
9258
+ });
9259
+ if (!isStacked) {
9260
+ if (1 !== matches.length) throw new Error(`annotationDifferenceLine ${selectorLabel} selector must resolve to exactly one datum, got ${matches.length}`);
9261
+ return {
9262
+ selectorLabel,
9263
+ coordinateDatum: matches[0],
9264
+ matchedDatum: matches[0],
9265
+ value: normalizeDifferenceValue(matches[0][valueField], selectorLabel, valueField)
9266
+ };
9267
+ }
9268
+ const stackGroups = new Map();
9269
+ matches.forEach((datum)=>{
9270
+ const stackGroupDatum = buildStackGroupDatum(datum, bandFields);
9271
+ stackGroups.set(JSON.stringify(stackGroupDatum), stackGroupDatum);
9272
+ });
9273
+ if (1 !== stackGroups.size) throw new Error(`annotationDifferenceLine ${selectorLabel} selector must resolve to exactly one stack group, got ${stackGroups.size}`);
9274
+ const stackGroupDatum = Array.from(stackGroups.values())[0];
9275
+ const groupRows = dataset.filter((datum)=>isSubset(stackGroupDatum, datum));
9276
+ const groupValues = groupRows.map((datum)=>normalizeDifferenceValue(datum[valueField], selectorLabel, valueField));
9277
+ if (hasMixedSigns(groupValues)) throw new Error('annotationDifferenceLine does not support mixed-sign stack totals in v1');
9278
+ return {
9279
+ selectorLabel,
9280
+ coordinateDatum: stackGroupDatum,
9281
+ matchedDatum: matches[0],
9282
+ stackGroupDatum,
9283
+ value: groupValues.reduce((sum, value)=>sum + value, 0)
9284
+ };
9285
+ };
9286
+ const getStackRuntimeTotal = (runtimeMatches)=>{
9287
+ const stackEndValues = runtimeMatches.map((datum)=>Number(datum.__VCHART_STACK_END));
9288
+ if (stackEndValues.some((value)=>Number.isNaN(value))) return;
9289
+ if (hasMixedSigns(stackEndValues)) throw new Error('annotationDifferenceLine does not support mixed-sign runtime stack totals in v1');
9290
+ return stackEndValues.some((value)=>value < 0) ? Math.min(...stackEndValues) : Math.max(...stackEndValues);
9291
+ };
9292
+ const buildDifferenceCoordinateDatum = (options)=>{
9293
+ const { anchor, seriesData, relativeSeries } = options;
9294
+ if (!anchor.stackGroupDatum) {
9295
+ const runtimeMatches = anchor.matchedDatum ? seriesData.filter((datum)=>isSubset(anchor.matchedDatum, datum)) : [];
9296
+ return runtimeMatches[0] ?? anchor.coordinateDatum;
9297
+ }
9298
+ const runtimeMatches = seriesData.filter((datum)=>isSubset(anchor.stackGroupDatum, datum));
9299
+ const runtimeStackTotal = getStackRuntimeTotal(runtimeMatches);
9300
+ return {
9301
+ ...runtimeMatches[0] ?? anchor.coordinateDatum,
9302
+ [relativeSeries.getStackValueField()]: runtimeStackTotal ?? anchor.value
9303
+ };
9304
+ };
9305
+ const buildDifferenceText = (startValue, endValue, differenceType = 'absolute')=>{
9306
+ if ('percent' === differenceType) {
9307
+ if (0 === startValue) throw new Error('annotationDifferenceLine percent difference cannot be computed because start value is 0');
9308
+ return `${((endValue - startValue) / startValue * 100).toFixed(0)}%`;
9309
+ }
9310
+ return `${endValue - startValue}`;
9311
+ };
9312
+ const inferDifferenceConnectDirection = (vseed, values)=>{
9313
+ const isNegativeSide = values.every((value)=>value < 0);
9314
+ if (isBarLikeChart(vseed)) return isNegativeSide ? 'left' : 'right';
9315
+ return isNegativeSide ? 'bottom' : 'top';
9316
+ };
9317
+ const DEFAULT_LINE_COLOR = '#BCC1CB';
9318
+ const DEFAULT_TEXT_COLOR = '#ffffff';
9319
+ const DEFAULT_TEXT_BACKGROUND_COLOR = '#BCC1CB';
9320
+ const DEFAULT_TEXT_FONT_SIZE = 12;
9321
+ const DEFAULT_EXPAND_DISTANCE = 24;
9322
+ const DEFAULT_LINE_WIDTH = 2;
9323
+ const DEFAULT_CORNER_RADIUS = 4;
9324
+ const DEFAULT_LABEL_PADDING = 4;
9325
+ const DEFAULT_END_SYMBOL_SIZE = 12;
9326
+ const DEFAULT_END_SYMBOL_REF_X = -4;
9327
+ const getDifferenceLinePath = (index, total)=>1 === total ? 'annotationDifferenceLine' : `annotationDifferenceLine[${index}]`;
9328
+ const assertDifferenceLineConfig = (value, path)=>{
9329
+ if ('object' != typeof value || null === value || Array.isArray(value)) throw new Error(`${path} must be an object`);
9330
+ const start = value.start;
9331
+ if ('object' != typeof start || null === start || Array.isArray(start)) throw new Error(`${path}.start is required`);
9332
+ if (null == start.selector) throw new Error(`${path}.start.selector is required`);
9333
+ const end = value.end;
9334
+ if ('object' != typeof end || null === end || Array.isArray(end)) throw new Error(`${path}.end is required`);
9335
+ if (null == end.selector) throw new Error(`${path}.end.selector is required`);
9336
+ };
9337
+ const annotationDifferenceLine_annotationDifferenceLine = (spec, context)=>{
9338
+ const { advancedVSeed, vseed } = context;
9339
+ const annotationDifferenceLine = advancedVSeed.annotation?.annotationDifferenceLine;
9340
+ if (!annotationDifferenceLine) return spec;
9341
+ const theme = advancedVSeed.config?.[vseed.chartType]?.annotation?.annotationDifferenceLine;
9342
+ const annotationDifferenceLineList = Array.isArray(annotationDifferenceLine) ? annotationDifferenceLine : [
9343
+ annotationDifferenceLine
9344
+ ];
9345
+ const dataset = advancedVSeed.dataset.flat();
9346
+ const barSpec = spec;
9347
+ const isStacked = isDifferenceLineStacked(vseed, advancedVSeed);
9348
+ const markLine = annotationDifferenceLineList.flatMap((annotationDifferenceLine, index)=>{
9349
+ assertDifferenceLineConfig(annotationDifferenceLine, getDifferenceLinePath(index, annotationDifferenceLineList.length));
9350
+ const start = resolveDifferenceAnchor({
9351
+ dataset,
9352
+ selectorLabel: 'start',
9353
+ selectorValue: annotationDifferenceLine.start.selector,
9354
+ spec: barSpec,
9355
+ isStacked
9356
+ });
9357
+ const end = resolveDifferenceAnchor({
9358
+ dataset,
9359
+ selectorLabel: 'end',
9360
+ selectorValue: annotationDifferenceLine.end.selector,
9361
+ spec: barSpec,
9362
+ isStacked
9363
+ });
9364
+ if (!start || !end) return [];
9365
+ const lineColor = annotationDifferenceLine.lineColor ?? theme?.lineColor ?? DEFAULT_LINE_COLOR;
9366
+ const textColor = annotationDifferenceLine.textColor ?? theme?.textColor ?? DEFAULT_TEXT_COLOR;
9367
+ const textBackgroundColor = annotationDifferenceLine.textBackgroundColor ?? theme?.textBackgroundColor ?? DEFAULT_TEXT_BACKGROUND_COLOR;
9368
+ const textFontSize = annotationDifferenceLine.textFontSize ?? theme?.textFontSize ?? DEFAULT_TEXT_FONT_SIZE;
9369
+ return [
9370
+ {
9371
+ type: 'type-step',
9372
+ autoRange: true,
9373
+ zIndex: 1000,
9374
+ connectDirection: inferDifferenceConnectDirection(vseed, [
9375
+ start.value,
9376
+ end.value
9377
+ ]),
9378
+ expandDistance: DEFAULT_EXPAND_DISTANCE,
9379
+ coordinates: (seriesData, relativeSeries)=>[
9380
+ buildDifferenceCoordinateDatum({
9381
+ anchor: start,
9382
+ seriesData,
9383
+ relativeSeries
9384
+ }),
9385
+ buildDifferenceCoordinateDatum({
9386
+ anchor: end,
9387
+ seriesData,
9388
+ relativeSeries
9389
+ })
9390
+ ],
9391
+ line: {
9392
+ style: {
9393
+ visible: true,
9394
+ stroke: lineColor,
9395
+ lineWidth: DEFAULT_LINE_WIDTH,
9396
+ lineDash: [
9397
+ 0
9398
+ ],
9399
+ cornerRadius: DEFAULT_CORNER_RADIUS
9400
+ }
9401
+ },
9402
+ label: {
9403
+ confine: true,
9404
+ visible: true,
9405
+ position: 'middle',
9406
+ text: buildDifferenceText(start.value, end.value, annotationDifferenceLine.differenceType ?? 'absolute'),
9407
+ style: {
9408
+ fill: textColor,
9409
+ fontSize: textFontSize
9410
+ },
9411
+ labelBackground: {
9412
+ visible: true,
9413
+ padding: DEFAULT_LABEL_PADDING,
9414
+ style: {
9415
+ fill: textBackgroundColor,
9416
+ fillOpacity: 1,
9417
+ stroke: lineColor,
9418
+ lineWidth: 1,
9419
+ cornerRadius: DEFAULT_CORNER_RADIUS
9420
+ }
9421
+ }
9422
+ },
9423
+ startSymbol: {
9424
+ visible: false
9425
+ },
9426
+ endSymbol: {
9427
+ visible: true,
9428
+ size: DEFAULT_END_SYMBOL_SIZE,
9429
+ refX: DEFAULT_END_SYMBOL_REF_X,
9430
+ style: {
9431
+ fill: lineColor
9432
+ }
9433
+ }
9434
+ }
9435
+ ];
9436
+ });
9437
+ const specMarkLine = barSpec.markLine || [];
9438
+ return {
9439
+ ...spec,
9440
+ markLine: [
9441
+ ...specMarkLine,
9442
+ ...markLine
9443
+ ]
9444
+ };
9445
+ };
9150
9446
  const annotationAreaBand = (spec, context)=>{
9151
9447
  const { advancedVSeed, vseed } = context;
9152
9448
  const { annotation, config } = advancedVSeed;
@@ -9762,6 +10058,7 @@ self.R = R;
9762
10058
  annotationPoint_annotationPoint,
9763
10059
  annotationVerticalLine_annotationVerticalLine,
9764
10060
  annotationHorizontalLine_annotationHorizontalLine,
10061
+ annotationDifferenceLine_annotationDifferenceLine,
9765
10062
  annotationAreaBand,
9766
10063
  columnPolynomialRegressionLine
9767
10064
  ];
@@ -9792,6 +10089,7 @@ self.R = R;
9792
10089
  annotationPoint_annotationPoint,
9793
10090
  annotationVerticalLine_annotationVerticalLine,
9794
10091
  annotationHorizontalLine_annotationHorizontalLine,
10092
+ annotationDifferenceLine_annotationDifferenceLine,
9795
10093
  annotationAreaBand,
9796
10094
  columnPolynomialRegressionLine
9797
10095
  ]),
@@ -9977,6 +10275,7 @@ self.R = R;
9977
10275
  annotationPoint_annotationPoint,
9978
10276
  annotationVerticalLine_annotationVerticalLine,
9979
10277
  annotationHorizontalLine_annotationHorizontalLine,
10278
+ annotationDifferenceLine_annotationDifferenceLine,
9980
10279
  annotationAreaBand
9981
10280
  ];
9982
10281
  const pivotColumnParallel = [
@@ -10005,6 +10304,7 @@ self.R = R;
10005
10304
  annotationPoint_annotationPoint,
10006
10305
  annotationVerticalLine_annotationVerticalLine,
10007
10306
  annotationHorizontalLine_annotationHorizontalLine,
10307
+ annotationDifferenceLine_annotationDifferenceLine,
10008
10308
  annotationAreaBand
10009
10309
  ]),
10010
10310
  pivotRowDimensions,
@@ -10461,6 +10761,7 @@ self.R = R;
10461
10761
  annotationPoint_annotationPoint,
10462
10762
  annotationVerticalLine_annotationVerticalLine,
10463
10763
  annotationHorizontalLine_annotationHorizontalLine,
10764
+ annotationDifferenceLine_annotationDifferenceLine,
10464
10765
  annotationAreaBand
10465
10766
  ];
10466
10767
  const pivotBar = [
@@ -10489,6 +10790,7 @@ self.R = R;
10489
10790
  annotationPoint_annotationPoint,
10490
10791
  annotationVerticalLine_annotationVerticalLine,
10491
10792
  annotationHorizontalLine_annotationHorizontalLine,
10793
+ annotationDifferenceLine_annotationDifferenceLine,
10492
10794
  annotationAreaBand
10493
10795
  ]),
10494
10796
  pivotRowDimensions,
@@ -13211,6 +13513,7 @@ self.R = R;
13211
13513
  annotationPoint_annotationPoint,
13212
13514
  annotationVerticalLine_annotationVerticalLine,
13213
13515
  annotationHorizontalLine_annotationHorizontalLine,
13516
+ annotationDifferenceLine_annotationDifferenceLine,
13214
13517
  annotationAreaBand
13215
13518
  ];
13216
13519
  const pivotBarParallel = [
@@ -13238,6 +13541,7 @@ self.R = R;
13238
13541
  annotationPoint_annotationPoint,
13239
13542
  annotationVerticalLine_annotationVerticalLine,
13240
13543
  annotationHorizontalLine_annotationHorizontalLine,
13544
+ annotationDifferenceLine_annotationDifferenceLine,
13241
13545
  annotationAreaBand
13242
13546
  ]),
13243
13547
  pivotRowDimensions,
@@ -19389,6 +19693,15 @@ self.R = R;
19389
19693
  textBackgroundBorderColor: '#BCC1CB'
19390
19694
  });
19391
19695
  const getLightAnnotationVerticalLine = ()=>getLightAnnotationHorizontalLine();
19696
+ const getDefaultAnnotationDifferenceLine = ()=>({
19697
+ textFontSize: 12
19698
+ });
19699
+ const getLightAnnotationDifferenceLine = ()=>({
19700
+ ...getDefaultAnnotationDifferenceLine(),
19701
+ lineColor: '#BCC1CB',
19702
+ textColor: '#ffffff',
19703
+ textBackgroundColor: '#BCC1CB'
19704
+ });
19392
19705
  const getDefaultAnnotationArea = ()=>({
19393
19706
  textFontSize: 12,
19394
19707
  textFontWeight: 400,
@@ -19417,6 +19730,7 @@ self.R = R;
19417
19730
  annotationPoint: getLightAnnotationPoint(),
19418
19731
  annotationHorizontalLine: getLightAnnotationHorizontalLine(),
19419
19732
  annotationVerticalLine: getLightAnnotationVerticalLine(),
19733
+ annotationDifferenceLine: getLightAnnotationDifferenceLine(),
19420
19734
  annotationArea: getLightAnnotationArea()
19421
19735
  });
19422
19736
  const getDarkAnnotationPoint = ()=>({
@@ -19433,6 +19747,12 @@ self.R = R;
19433
19747
  textBackgroundBorderColor: '#55595F'
19434
19748
  });
19435
19749
  const getDarkAnnotationVerticalLine = ()=>getDarkAnnotationHorizontalLine();
19750
+ const getDarkAnnotationDifferenceLine = ()=>({
19751
+ ...getDefaultAnnotationDifferenceLine(),
19752
+ lineColor: '#55595F',
19753
+ textColor: '#E2E3E6',
19754
+ textBackgroundColor: '#55595F'
19755
+ });
19436
19756
  const getDarkAnnotationArea = ()=>({
19437
19757
  ...getDefaultAnnotationArea(),
19438
19758
  textColor: '#E2E3E6',
@@ -19446,6 +19766,7 @@ self.R = R;
19446
19766
  annotationPoint: getDarkAnnotationPoint(),
19447
19767
  annotationHorizontalLine: getDarkAnnotationHorizontalLine(),
19448
19768
  annotationVerticalLine: getDarkAnnotationVerticalLine(),
19769
+ annotationDifferenceLine: getDarkAnnotationDifferenceLine(),
19449
19770
  annotationArea: getDarkAnnotationArea()
19450
19771
  });
19451
19772
  const getLightLinearAxis = ()=>({
@@ -25094,6 +25415,30 @@ self.R = R;
25094
25415
  offsetY: schemas_number().default(0).nullish(),
25095
25416
  offsetX: schemas_number().default(0).nullish()
25096
25417
  });
25418
+ const zDifferenceSelector = union([
25419
+ zPartialSelector,
25420
+ zMeasureSelector,
25421
+ zDimensionSelector
25422
+ ]);
25423
+ const zDifferenceSelectors = schemas_array(zDifferenceSelector);
25424
+ const zDifferenceAnchor = schemas_object({
25425
+ selector: union([
25426
+ zDifferenceSelector,
25427
+ zDifferenceSelectors
25428
+ ])
25429
+ });
25430
+ const zAnnotationDifferenceLine = schemas_object({
25431
+ start: zDifferenceAnchor,
25432
+ end: zDifferenceAnchor,
25433
+ differenceType: schemas_enum([
25434
+ 'absolute',
25435
+ 'percent'
25436
+ ]).nullish(),
25437
+ textFontSize: schemas_number().nullish(),
25438
+ textColor: schemas_string().nullish(),
25439
+ textBackgroundColor: schemas_string().nullish(),
25440
+ lineColor: schemas_string().nullish()
25441
+ });
25097
25442
  const zAnnotationHorizontalLine = schemas_object({
25098
25443
  yValue: union([
25099
25444
  schemas_number(),
@@ -25229,11 +25574,18 @@ self.R = R;
25229
25574
  areaLineDash: true,
25230
25575
  outerPadding: true
25231
25576
  }).partial();
25577
+ const zAnnotationDifferenceLineConfig = zAnnotationDifferenceLine.pick({
25578
+ lineColor: true,
25579
+ textColor: true,
25580
+ textFontSize: true,
25581
+ textBackgroundColor: true
25582
+ }).partial();
25232
25583
  const zAnnotationConfig = schemas_object({
25233
25584
  annotationPoint: zAnnotationPointConfig.nullish(),
25234
25585
  annotationHorizontalLine: zAnnotationHorizontalLineConfig.nullish(),
25235
25586
  annotationVerticalLine: zAnnotationVerticalLineConfig.nullish(),
25236
- annotationArea: zAnnotationAreaConfig.nullish()
25587
+ annotationArea: zAnnotationAreaConfig.nullish(),
25588
+ annotationDifferenceLine: zAnnotationDifferenceLineConfig.nullish()
25237
25589
  });
25238
25590
  const zPivotChartGridConfig = schemas_object({
25239
25591
  borderColor: schemas_string().nullish(),
@@ -25789,7 +26141,8 @@ self.R = R;
25789
26141
  annotationPoint: zAnnotationPoint.or(schemas_array(zAnnotationPoint)).nullish(),
25790
26142
  annotationVerticalLine: zAnnotationVerticalLine.or(schemas_array(zAnnotationVerticalLine)).nullish(),
25791
26143
  annotationHorizontalLine: zAnnotationHorizontalLine.or(schemas_array(zAnnotationHorizontalLine)).nullish(),
25792
- annotationArea: zAnnotationArea.or(schemas_array(zAnnotationArea)).nullish()
26144
+ annotationArea: zAnnotationArea.or(schemas_array(zAnnotationArea)).nullish(),
26145
+ annotationDifferenceLine: zAnnotationDifferenceLine.or(schemas_array(zAnnotationDifferenceLine)).nullish()
25793
26146
  });
25794
26147
  const zSort = schemas_object({
25795
26148
  order: schemas_enum([
@@ -25964,6 +26317,7 @@ self.R = R;
25964
26317
  annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
25965
26318
  annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
25966
26319
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
26320
+ annotationDifferenceLine: schemas_array(zAnnotationDifferenceLine).or(zAnnotationDifferenceLine).nullish(),
25967
26321
  polynomialRegressionLine: schemas_array(zPolynomialRegressionLine).or(zPolynomialRegressionLine).nullish(),
25968
26322
  dimensionLinkage: zDimensionLinkage.nullish(),
25969
26323
  locale: zLocale.nullish()
@@ -25994,6 +26348,7 @@ self.R = R;
25994
26348
  annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
25995
26349
  annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
25996
26350
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
26351
+ annotationDifferenceLine: schemas_array(zAnnotationDifferenceLine).or(zAnnotationDifferenceLine).nullish(),
25997
26352
  dimensionLinkage: zDimensionLinkage.nullish(),
25998
26353
  locale: zLocale.nullish()
25999
26354
  });
@@ -26048,6 +26403,7 @@ self.R = R;
26048
26403
  annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
26049
26404
  annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
26050
26405
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
26406
+ annotationDifferenceLine: schemas_array(zAnnotationDifferenceLine).or(zAnnotationDifferenceLine).nullish(),
26051
26407
  dimensionLinkage: zDimensionLinkage.nullish(),
26052
26408
  locale: zLocale.nullish()
26053
26409
  });
@@ -26193,6 +26549,7 @@ self.R = R;
26193
26549
  annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
26194
26550
  annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
26195
26551
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
26552
+ annotationDifferenceLine: schemas_array(zAnnotationDifferenceLine).or(zAnnotationDifferenceLine).nullish(),
26196
26553
  dimensionLinkage: zDimensionLinkage.nullish(),
26197
26554
  locale: zLocale.nullish(),
26198
26555
  page: zPage.nullish()
@@ -26803,6 +27160,9 @@ self.R = R;
26803
27160
  annotationVerticalLine: {
26804
27161
  textFontSize: tokens.labelFontSize
26805
27162
  },
27163
+ annotationDifferenceLine: {
27164
+ textFontSize: tokens.labelFontSize
27165
+ },
26806
27166
  annotationArea: {
26807
27167
  textFontSize: tokens.labelFontSize
26808
27168
  }