@visactor/vseed 0.4.26 → 0.4.28
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/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js +128 -12
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.d.ts +2 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.js +14 -7
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js +8 -3
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js +3 -3
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js.map +1 -1
- package/dist/esm/types/chartType/area/zArea.d.ts +2 -0
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +2 -0
- package/dist/esm/types/chartType/bar/zBar.d.ts +2 -0
- package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +2 -0
- package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +2 -0
- package/dist/esm/types/chartType/boxPlot/zBoxPlot.d.ts +2 -0
- package/dist/esm/types/chartType/column/zColumn.d.ts +2 -0
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +2 -0
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +2 -0
- package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +2 -0
- package/dist/esm/types/chartType/histogram/zHistogram.d.ts +2 -0
- package/dist/esm/types/chartType/line/zLine.d.ts +2 -0
- package/dist/esm/types/chartType/raceBar/zRaceBar.d.ts +2 -0
- package/dist/esm/types/chartType/raceColumn/zRaceColumn.d.ts +2 -0
- package/dist/esm/types/chartType/raceLine/zRaceLine.d.ts +2 -0
- package/dist/esm/types/chartType/raceScatter/zRaceScatter.d.ts +2 -0
- package/dist/esm/types/chartType/scatter/zScatter.d.ts +2 -0
- package/dist/esm/types/properties/annotation/annotation.d.ts +2 -0
- package/dist/esm/types/properties/annotation/annotationPoint.d.ts +4 -0
- package/dist/esm/types/properties/annotation/zAnnotationPoint.d.ts +1 -0
- package/dist/esm/types/properties/annotation/zAnnotationPoint.js +1 -0
- package/dist/esm/types/properties/annotation/zAnnotationPoint.js.map +1 -1
- package/dist/esm/types/properties/config/annotation/zAnnotation.js +1 -0
- package/dist/esm/types/properties/config/annotation/zAnnotation.js.map +1 -1
- package/dist/umd/index.js +152 -35
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
package/dist/umd/index.js
CHANGED
|
@@ -1341,7 +1341,7 @@
|
|
|
1341
1341
|
registerScatter: ()=>registerScatter,
|
|
1342
1342
|
zAreaPercent: ()=>zAreaPercent,
|
|
1343
1343
|
isDimension: ()=>isDimension,
|
|
1344
|
-
isBarLikeChart: ()=>
|
|
1344
|
+
isBarLikeChart: ()=>chatType_isBarLikeChart,
|
|
1345
1345
|
columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
|
|
1346
1346
|
deleteDimensionTreeByCallback: ()=>deleteDimensionTreeByCallback,
|
|
1347
1347
|
zBarConfig: ()=>zBarConfig,
|
|
@@ -3197,7 +3197,7 @@ self.R = R;
|
|
|
3197
3197
|
const isAreaPercent = (vseed)=>vseed.chartType === ChartTypeEnum.AreaPercent;
|
|
3198
3198
|
const isColumnPercent = (vseed)=>vseed.chartType === ChartTypeEnum.ColumnPercent;
|
|
3199
3199
|
const isBarPercent = (vseed)=>vseed.chartType === ChartTypeEnum.BarPercent;
|
|
3200
|
-
const
|
|
3200
|
+
const chatType_isBarLikeChart = (vseed)=>vseed.chartType === ChartTypeEnum.Bar || vseed.chartType === ChartTypeEnum.RaceBar || vseed.chartType === ChartTypeEnum.BarPercent || vseed.chartType === ChartTypeEnum.BarParallel;
|
|
3201
3201
|
const isVTable = (vseed)=>[
|
|
3202
3202
|
'table',
|
|
3203
3203
|
'pivotTable'
|
|
@@ -6986,8 +6986,11 @@ self.R = R;
|
|
|
6986
6986
|
};
|
|
6987
6987
|
const generateAnnotationPointPipe = (options)=>{
|
|
6988
6988
|
const findSelectedDatas = options.findSelectedDatas ?? ((opts)=>{
|
|
6989
|
-
const { dataset, selector: s, dynamicFilter } = opts;
|
|
6990
|
-
return dataset.filter((datum)=>
|
|
6989
|
+
const { dataset, selector: s, measureId, dynamicFilter } = opts;
|
|
6990
|
+
return dataset.filter((datum)=>{
|
|
6991
|
+
const isSelected = dynamicFilter ? selectorWithDynamicFilter(datum, dynamicFilter, s) : selector_selector(datum, s);
|
|
6992
|
+
return isSelected && (!measureId || datum[MeasureId] === measureId);
|
|
6993
|
+
});
|
|
6991
6994
|
});
|
|
6992
6995
|
const generateMarkPoint = options.generateMarkPoint ?? ((datum)=>[
|
|
6993
6996
|
{
|
|
@@ -7016,7 +7019,7 @@ self.R = R;
|
|
|
7016
7019
|
const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
|
|
7017
7020
|
annotationPoint
|
|
7018
7021
|
];
|
|
7019
|
-
const isHorizontalBar =
|
|
7022
|
+
const isHorizontalBar = chatType_isBarLikeChart(advancedVSeed);
|
|
7020
7023
|
const defaultStyle = isHorizontalBar ? {
|
|
7021
7024
|
textAlign: 'right',
|
|
7022
7025
|
textBaseline: 'middle'
|
|
@@ -7025,11 +7028,12 @@ self.R = R;
|
|
|
7025
7028
|
textBaseline: 'top'
|
|
7026
7029
|
};
|
|
7027
7030
|
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
|
7028
|
-
const { selector: selectorPoint, dynamicFilter, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
|
|
7031
|
+
const { selector: selectorPoint, measureId, dynamicFilter, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
|
|
7029
7032
|
const dataset = advancedVSeed.dataset.flat();
|
|
7030
7033
|
const selectedData = selectorPoint || dynamicFilter ? findSelectedDatas({
|
|
7031
7034
|
dataset,
|
|
7032
7035
|
selector: selectorPoint,
|
|
7036
|
+
measureId,
|
|
7033
7037
|
dynamicFilter,
|
|
7034
7038
|
spec,
|
|
7035
7039
|
context
|
|
@@ -7251,8 +7255,9 @@ self.R = R;
|
|
|
7251
7255
|
};
|
|
7252
7256
|
};
|
|
7253
7257
|
const getStackRuntimeTotal = (runtimeMatches)=>{
|
|
7258
|
+
if (0 === runtimeMatches.length) return;
|
|
7254
7259
|
const stackEndValues = runtimeMatches.map((datum)=>Number(datum[STACK_END_FIELD]));
|
|
7255
|
-
if (stackEndValues.some((value)
|
|
7260
|
+
if (stackEndValues.some((value)=>!Number.isFinite(value))) return;
|
|
7256
7261
|
if (hasMixedSigns(stackEndValues)) throw new Error('annotationDifferenceLine does not support mixed-sign runtime stack totals in v1');
|
|
7257
7262
|
return stackEndValues.some((value)=>value < 0) ? Math.min(...stackEndValues) : Math.max(...stackEndValues);
|
|
7258
7263
|
};
|
|
@@ -7265,7 +7270,7 @@ self.R = R;
|
|
|
7265
7270
|
const runtimeStackEnd = Number(runtimeMatch?.[STACK_END_FIELD]);
|
|
7266
7271
|
return {
|
|
7267
7272
|
...runtimeMatch ?? anchor.coordinateDatum,
|
|
7268
|
-
[relativeSeries.getStackValueField()]: Number.
|
|
7273
|
+
[relativeSeries.getStackValueField()]: Number.isFinite(runtimeStackEnd) ? runtimeStackEnd : anchor.value
|
|
7269
7274
|
};
|
|
7270
7275
|
}
|
|
7271
7276
|
const runtimeMatches = seriesData.filter((datum)=>isSubset(anchor.stackGroupDatum, datum));
|
|
@@ -7284,40 +7289,137 @@ self.R = R;
|
|
|
7284
7289
|
if (!useElementStackEnd || !anchor.matchedDatum) return anchor.value;
|
|
7285
7290
|
const runtimeMatch = seriesData.find((datum)=>isSubset(anchor.matchedDatum, datum));
|
|
7286
7291
|
const runtimeStackEnd = Number(runtimeMatch?.[STACK_END_FIELD]);
|
|
7287
|
-
return Number.
|
|
7292
|
+
return Number.isFinite(runtimeStackEnd) ? runtimeStackEnd : anchor.value;
|
|
7288
7293
|
};
|
|
7289
|
-
const
|
|
7294
|
+
const getDifferenceValue = (startValue, endValue, differenceType = 'absolute')=>{
|
|
7290
7295
|
if ('percent' === differenceType) {
|
|
7291
7296
|
if (0 === startValue) throw new Error('annotationDifferenceLine percent difference cannot be computed because start value is 0');
|
|
7292
|
-
return
|
|
7297
|
+
return (endValue - startValue) / startValue;
|
|
7293
7298
|
}
|
|
7294
|
-
return
|
|
7295
|
-
};
|
|
7296
|
-
const inferDifferenceConnectDirection = (vseed, values)=>{
|
|
7297
|
-
const isNegativeSide = values.every((value)=>value < 0);
|
|
7298
|
-
if (isBarLikeChart(vseed)) return isNegativeSide ? 'left' : 'right';
|
|
7299
|
-
return isNegativeSide ? 'bottom' : 'top';
|
|
7299
|
+
return endValue - startValue;
|
|
7300
7300
|
};
|
|
7301
|
-
const
|
|
7302
|
-
|
|
7303
|
-
|
|
7301
|
+
const buildDifferenceText = (startValue, endValue, differenceType = 'absolute', formatter)=>{
|
|
7302
|
+
const differenceValue = getDifferenceValue(startValue, endValue, differenceType);
|
|
7303
|
+
if (formatter) return formatter(differenceValue);
|
|
7304
|
+
if ('percent' === differenceType) return `${(100 * differenceValue).toFixed(2)}%`;
|
|
7305
|
+
return `${differenceValue}`;
|
|
7304
7306
|
};
|
|
7305
7307
|
const DEFAULT_LINE_COLOR = '#BCC1CB';
|
|
7306
7308
|
const DEFAULT_TEXT_COLOR = '#ffffff';
|
|
7307
7309
|
const DEFAULT_TEXT_BACKGROUND_COLOR = '#BCC1CB';
|
|
7308
7310
|
const DEFAULT_TEXT_FONT_SIZE = 12;
|
|
7309
|
-
const DEFAULT_EXPAND_DISTANCE = 24;
|
|
7310
7311
|
const DEFAULT_LINE_WIDTH = 2;
|
|
7311
7312
|
const DEFAULT_CORNER_RADIUS = 4;
|
|
7312
7313
|
const DEFAULT_LABEL_PADDING = 4;
|
|
7313
7314
|
const DEFAULT_END_SYMBOL_SIZE = 12;
|
|
7314
7315
|
const DEFAULT_END_SYMBOL_REF_X = -4;
|
|
7315
|
-
const
|
|
7316
|
+
const DEFAULT_GUTTER_BASE_OFFSET = 20;
|
|
7317
|
+
const DEFAULT_GUTTER_RIGHT_PADDING = 44;
|
|
7318
|
+
const DEFAULT_GUTTER_TOP_PADDING = 36;
|
|
7316
7319
|
const DEFAULT_BRACKET_LINE_DASH = [
|
|
7317
7320
|
2,
|
|
7318
7321
|
2
|
|
7319
7322
|
];
|
|
7323
|
+
const DEFAULT_PERCENT_DIFFERENCE_FORMAT = {
|
|
7324
|
+
type: 'percent',
|
|
7325
|
+
fractionDigits: 2
|
|
7326
|
+
};
|
|
7320
7327
|
const getDifferenceLinePath = (index, total)=>1 === total ? 'annotationDifferenceLine' : `annotationDifferenceLine[${index}]`;
|
|
7328
|
+
const annotationDifferenceLine_toArray = (value)=>{
|
|
7329
|
+
if (Array.isArray(value)) return value;
|
|
7330
|
+
return null == value ? [] : [
|
|
7331
|
+
value
|
|
7332
|
+
];
|
|
7333
|
+
};
|
|
7334
|
+
const normalizeRegionPadding = (padding)=>{
|
|
7335
|
+
if ('number' == typeof padding) return {
|
|
7336
|
+
top: padding,
|
|
7337
|
+
right: padding,
|
|
7338
|
+
bottom: padding,
|
|
7339
|
+
left: padding
|
|
7340
|
+
};
|
|
7341
|
+
return {
|
|
7342
|
+
top: padding?.top ?? 0,
|
|
7343
|
+
right: padding?.right ?? 0,
|
|
7344
|
+
bottom: padding?.bottom ?? 0,
|
|
7345
|
+
left: padding?.left ?? 0
|
|
7346
|
+
};
|
|
7347
|
+
};
|
|
7348
|
+
const mergeDifferenceLineRegionPadding = (spec, paddingPatch)=>{
|
|
7349
|
+
const region = spec.region;
|
|
7350
|
+
if (!Array.isArray(region) || 0 === region.length) return spec;
|
|
7351
|
+
const mergedPadding = normalizeRegionPadding(region[0].padding);
|
|
7352
|
+
if (void 0 !== paddingPatch.top) mergedPadding.top = Math.max(mergedPadding.top, paddingPatch.top);
|
|
7353
|
+
if (void 0 !== paddingPatch.right) mergedPadding.right = Math.max(mergedPadding.right, paddingPatch.right);
|
|
7354
|
+
if (void 0 !== paddingPatch.bottom) mergedPadding.bottom = Math.max(mergedPadding.bottom, paddingPatch.bottom);
|
|
7355
|
+
if (void 0 !== paddingPatch.left) mergedPadding.left = Math.max(mergedPadding.left, paddingPatch.left);
|
|
7356
|
+
return {
|
|
7357
|
+
...spec,
|
|
7358
|
+
region: [
|
|
7359
|
+
{
|
|
7360
|
+
...region[0],
|
|
7361
|
+
padding: mergedPadding
|
|
7362
|
+
},
|
|
7363
|
+
...region.slice(1)
|
|
7364
|
+
]
|
|
7365
|
+
};
|
|
7366
|
+
};
|
|
7367
|
+
const buildFixedGutterExpandDistance = (isHorizontalChart)=>(_markerData, context)=>{
|
|
7368
|
+
const region = context?.region;
|
|
7369
|
+
const coordinatePoints = Array.isArray(context?.coordinatePoints) ? context.coordinatePoints : [];
|
|
7370
|
+
if (!region || 0 === coordinatePoints.length) return 0;
|
|
7371
|
+
const { x: regionStartX, y: regionStartY } = region.getLayoutStartPoint();
|
|
7372
|
+
const { width } = region.getLayoutRect();
|
|
7373
|
+
if (isHorizontalChart) {
|
|
7374
|
+
const targetY = regionStartY - DEFAULT_GUTTER_BASE_OFFSET;
|
|
7375
|
+
const minY = Math.min(...coordinatePoints.map((point)=>point.y));
|
|
7376
|
+
return Math.max(0, minY - targetY);
|
|
7377
|
+
}
|
|
7378
|
+
const targetX = regionStartX + width + DEFAULT_GUTTER_BASE_OFFSET;
|
|
7379
|
+
const maxX = Math.max(...coordinatePoints.map((point)=>point.x));
|
|
7380
|
+
return Math.max(0, targetX - maxX);
|
|
7381
|
+
};
|
|
7382
|
+
const getAxisFormatter = (spec)=>{
|
|
7383
|
+
const valueAxisOrient = 'horizontal' === spec.direction ? 'bottom' : 'left';
|
|
7384
|
+
const formatMethod = spec.axes?.find((axis)=>axis.orient === valueAxisOrient)?.label?.formatMethod;
|
|
7385
|
+
return 'function' == typeof formatMethod ? (value)=>String(formatMethod(value) ?? value) : void 0;
|
|
7386
|
+
};
|
|
7387
|
+
const getExplicitMeasureFormat = (measure)=>{
|
|
7388
|
+
if (measure?.numFormat && !chunk_VCYTMP4D_n(measure.numFormat)) return measure.numFormat;
|
|
7389
|
+
if (measure?.format && !chunk_VCYTMP4D_n(measure.format)) return measure.format;
|
|
7390
|
+
};
|
|
7391
|
+
const inferMeasureIdFromDatum = (anchor, measureIds)=>{
|
|
7392
|
+
const candidateValues = [
|
|
7393
|
+
anchor.matchedDatum,
|
|
7394
|
+
anchor.coordinateDatum
|
|
7395
|
+
];
|
|
7396
|
+
for (const datum of candidateValues){
|
|
7397
|
+
if (!datum) continue;
|
|
7398
|
+
const candidates = measureIds.filter((measureId)=>Number(datum[measureId]) === anchor.value);
|
|
7399
|
+
if (1 === candidates.length) return candidates[0];
|
|
7400
|
+
}
|
|
7401
|
+
};
|
|
7402
|
+
const inferMeasureIdFromSelector = (selectorValue, measureIdSet)=>{
|
|
7403
|
+
const matchedMeasureIds = new Set();
|
|
7404
|
+
for (const currentSelector of annotationDifferenceLine_toArray(selectorValue)){
|
|
7405
|
+
if (isMeasureSelector(currentSelector)) {
|
|
7406
|
+
if (measureIdSet.has(currentSelector.field)) matchedMeasureIds.add(currentSelector.field);
|
|
7407
|
+
continue;
|
|
7408
|
+
}
|
|
7409
|
+
if (!(isFieldSelector(currentSelector) || isDimensionSelector(currentSelector))) {
|
|
7410
|
+
if (isPartialDatumSelector(currentSelector)) Object.keys(currentSelector).forEach((field)=>{
|
|
7411
|
+
if (measureIdSet.has(field)) matchedMeasureIds.add(field);
|
|
7412
|
+
});
|
|
7413
|
+
}
|
|
7414
|
+
}
|
|
7415
|
+
return 1 === matchedMeasureIds.size ? Array.from(matchedMeasureIds)[0] : void 0;
|
|
7416
|
+
};
|
|
7417
|
+
const resolveDifferenceMeasureId = (anchor, selectorValue, measureIds)=>{
|
|
7418
|
+
if ('element' !== anchor.mode) return;
|
|
7419
|
+
if (1 === measureIds.length) return measureIds[0];
|
|
7420
|
+
const measureIdSet = new Set(measureIds);
|
|
7421
|
+
return inferMeasureIdFromSelector(selectorValue, measureIdSet) ?? inferMeasureIdFromDatum(anchor, measureIds);
|
|
7422
|
+
};
|
|
7321
7423
|
const assertDifferenceLineConfig = (value, path)=>{
|
|
7322
7424
|
if ('object' != typeof value || null === value || Array.isArray(value)) throw new Error(`${path} must be an object`);
|
|
7323
7425
|
const start = value.start;
|
|
@@ -7340,6 +7442,11 @@ self.R = R;
|
|
|
7340
7442
|
const stackResolveMode = getDifferenceLineStackResolveMode(vseed, advancedVSeed);
|
|
7341
7443
|
const useElementStackEnd = usesDifferenceLineElementStackEnd(vseed, advancedVSeed);
|
|
7342
7444
|
const isBracketChart = 'line' === vseed.chartType || 'area' === vseed.chartType;
|
|
7445
|
+
const measures = findAllMeasures(advancedVSeed.measures);
|
|
7446
|
+
const measureIds = measures.map((measure)=>measure.id);
|
|
7447
|
+
const axisFormatter = getAxisFormatter(chartSpec);
|
|
7448
|
+
const percentFormatter = createFormatter(DEFAULT_PERCENT_DIFFERENCE_FORMAT);
|
|
7449
|
+
const isHorizontalChart = 'horizontal' === chartSpec.direction;
|
|
7343
7450
|
const markLine = annotationDifferenceLineList.flatMap((annotationDifferenceLine, index)=>{
|
|
7344
7451
|
try {
|
|
7345
7452
|
assertDifferenceLineConfig(annotationDifferenceLine, getDifferenceLinePath(index, annotationDifferenceLineList.length));
|
|
@@ -7363,16 +7470,18 @@ self.R = R;
|
|
|
7363
7470
|
if (start.mode !== end.mode) return [];
|
|
7364
7471
|
const usesRuntimeStackEnd = useElementStackEnd || ('column' === vseed.chartType || 'bar' === vseed.chartType) && 'element' === start.mode && 'auto' === stackResolveMode;
|
|
7365
7472
|
const useBracketStyle = isBracketChart || ('column' === vseed.chartType || 'bar' === vseed.chartType) && 'element' === start.mode && 'auto' === stackResolveMode;
|
|
7366
|
-
const
|
|
7367
|
-
const
|
|
7368
|
-
start.value,
|
|
7369
|
-
end.value
|
|
7370
|
-
]);
|
|
7473
|
+
const connectDirection = isHorizontalChart ? 'top' : 'right';
|
|
7474
|
+
const expandDistance = buildFixedGutterExpandDistance(isHorizontalChart);
|
|
7371
7475
|
const lineColor = annotationDifferenceLine.lineColor ?? theme?.lineColor ?? DEFAULT_LINE_COLOR;
|
|
7372
7476
|
const textColor = annotationDifferenceLine.textColor ?? theme?.textColor ?? DEFAULT_TEXT_COLOR;
|
|
7373
7477
|
const textBackgroundColor = annotationDifferenceLine.textBackgroundColor ?? theme?.textBackgroundColor ?? DEFAULT_TEXT_BACKGROUND_COLOR;
|
|
7374
7478
|
const textFontSize = annotationDifferenceLine.textFontSize ?? theme?.textFontSize ?? DEFAULT_TEXT_FONT_SIZE;
|
|
7375
7479
|
const differenceType = annotationDifferenceLine.differenceType ?? 'absolute';
|
|
7480
|
+
const startMeasureId = resolveDifferenceMeasureId(start, annotationDifferenceLine.start.selector, measureIds);
|
|
7481
|
+
const endMeasureId = resolveDifferenceMeasureId(end, annotationDifferenceLine.end.selector, measureIds);
|
|
7482
|
+
const sameMeasure = void 0 !== startMeasureId && startMeasureId === endMeasureId;
|
|
7483
|
+
const explicitMeasureFormat = sameMeasure ? getExplicitMeasureFormat(measures.find((measure)=>measure.id === startMeasureId)) : void 0;
|
|
7484
|
+
const differenceFormatter = 'percent' === differenceType ? percentFormatter : explicitMeasureFormat ? createFormatter(explicitMeasureFormat) : axisFormatter ?? autoFormatter;
|
|
7376
7485
|
const label = usesRuntimeStackEnd ? {
|
|
7377
7486
|
visible: true,
|
|
7378
7487
|
position: 'middle',
|
|
@@ -7387,7 +7496,7 @@ self.R = R;
|
|
|
7387
7496
|
anchor: end,
|
|
7388
7497
|
seriesData,
|
|
7389
7498
|
useElementStackEnd: usesRuntimeStackEnd
|
|
7390
|
-
}), differenceType);
|
|
7499
|
+
}), differenceType, differenceFormatter);
|
|
7391
7500
|
} catch {
|
|
7392
7501
|
return '';
|
|
7393
7502
|
}
|
|
@@ -7411,7 +7520,7 @@ self.R = R;
|
|
|
7411
7520
|
visible: true,
|
|
7412
7521
|
position: 'middle',
|
|
7413
7522
|
refY: 0,
|
|
7414
|
-
text: buildDifferenceText(start.value, end.value, differenceType),
|
|
7523
|
+
text: buildDifferenceText(start.value, end.value, differenceType, differenceFormatter),
|
|
7415
7524
|
style: {
|
|
7416
7525
|
fill: textColor,
|
|
7417
7526
|
fontSize: textFontSize
|
|
@@ -7434,7 +7543,7 @@ self.R = R;
|
|
|
7434
7543
|
autoRange: true,
|
|
7435
7544
|
zIndex: 1000,
|
|
7436
7545
|
connectDirection,
|
|
7437
|
-
expandDistance
|
|
7546
|
+
expandDistance,
|
|
7438
7547
|
coordinates: (seriesData, relativeSeries)=>{
|
|
7439
7548
|
try {
|
|
7440
7549
|
return [
|
|
@@ -7507,13 +7616,19 @@ self.R = R;
|
|
|
7507
7616
|
}
|
|
7508
7617
|
});
|
|
7509
7618
|
const specMarkLine = chartSpec.markLine || [];
|
|
7510
|
-
|
|
7619
|
+
const nextSpec = {
|
|
7511
7620
|
...spec,
|
|
7512
7621
|
markLine: [
|
|
7513
7622
|
...specMarkLine,
|
|
7514
7623
|
...markLine
|
|
7515
7624
|
]
|
|
7516
7625
|
};
|
|
7626
|
+
if (0 === markLine.length) return nextSpec;
|
|
7627
|
+
return mergeDifferenceLineRegionPadding(nextSpec, isHorizontalChart ? {
|
|
7628
|
+
top: DEFAULT_GUTTER_TOP_PADDING
|
|
7629
|
+
} : {
|
|
7630
|
+
right: DEFAULT_GUTTER_RIGHT_PADDING
|
|
7631
|
+
});
|
|
7517
7632
|
};
|
|
7518
7633
|
const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
|
7519
7634
|
const { advancedVSeed, vseed } = context;
|
|
@@ -7757,7 +7872,7 @@ self.R = R;
|
|
|
7757
7872
|
left: 'insideLeft',
|
|
7758
7873
|
right: 'insideRight'
|
|
7759
7874
|
};
|
|
7760
|
-
const defaultTextPosition =
|
|
7875
|
+
const defaultTextPosition = chatType_isBarLikeChart(advancedVSeed) ? 'right' : 'top';
|
|
7761
7876
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
|
7762
7877
|
const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#191d24', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24', textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundPadding = theme?.textBackgroundPadding ?? 4, areaColor = theme?.areaColor ?? '#888888', areaColorOpacity = theme?.areaColorOpacity ?? 0.15, areaBorderColor = theme?.areaBorderColor ?? '#888888', areaBorderRadius = theme?.areaBorderRadius ?? 4, areaBorderWidth = theme?.areaBorderWidth ?? 1, areaLineDash = theme?.areaLineDash, outerPadding = theme?.outerPadding ?? 4 } = annotationArea;
|
|
7763
7878
|
const dataset = advancedVSeed.dataset.flat();
|
|
@@ -9616,7 +9731,7 @@ self.R = R;
|
|
|
9616
9731
|
left: 'insideLeft',
|
|
9617
9732
|
right: 'insideRight'
|
|
9618
9733
|
};
|
|
9619
|
-
const defaultTextPosition =
|
|
9734
|
+
const defaultTextPosition = chatType_isBarLikeChart(advancedVSeed) ? 'right' : 'top';
|
|
9620
9735
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
|
9621
9736
|
const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#191d24', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24', textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundPadding = theme?.textBackgroundPadding ?? 4, areaColor = theme?.areaColor ?? '#888888', areaColorOpacity = theme?.areaColorOpacity ?? 0.15, areaBorderColor = theme?.areaBorderColor ?? '#888888', areaBorderRadius = theme?.areaBorderRadius ?? 4, areaBorderWidth = theme?.areaBorderWidth ?? 1, areaLineDash = theme?.areaLineDash, outerPadding = theme?.outerPadding ?? 4 } = annotationArea;
|
|
9622
9737
|
const textPosition = annotationArea.textPosition ?? defaultTextPosition;
|
|
@@ -15023,13 +15138,13 @@ self.R = R;
|
|
|
15023
15138
|
}
|
|
15024
15139
|
const annotationPointOfDualAxis = generateAnnotationPointPipe({
|
|
15025
15140
|
findSelectedDatas: (options)=>{
|
|
15026
|
-
const { dataset, selector: s, dynamicFilter, context } = options;
|
|
15141
|
+
const { dataset, selector: s, measureId, dynamicFilter, context } = options;
|
|
15027
15142
|
return dataset.reduce((res, d)=>{
|
|
15028
15143
|
const { advancedVSeed } = context;
|
|
15029
15144
|
const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m)=>m.id);
|
|
15030
15145
|
const pickedDatum = pickWithout(d, allMeasureIds.filter((id)=>id !== d[MeasureId]));
|
|
15031
15146
|
const shouldSelect = dynamicFilter ? selectorWithDynamicFilter(pickedDatum, dynamicFilter, s) : selector_selector(pickedDatum, s);
|
|
15032
|
-
if (shouldSelect) res.push(pickedDatum);
|
|
15147
|
+
if (shouldSelect && (!measureId || pickedDatum[MeasureId] === measureId)) res.push(pickedDatum);
|
|
15033
15148
|
return res;
|
|
15034
15149
|
}, []);
|
|
15035
15150
|
},
|
|
@@ -25563,6 +25678,7 @@ self.R = R;
|
|
|
25563
25678
|
zSelector,
|
|
25564
25679
|
zSelectors
|
|
25565
25680
|
]).nullish(),
|
|
25681
|
+
measureId: schemas_string().nullish(),
|
|
25566
25682
|
dynamicFilter: zChartDynamicFilter.optional(),
|
|
25567
25683
|
text: schemas_string().or(schemas_array(schemas_string())).nullish(),
|
|
25568
25684
|
textColor: schemas_string().default('#ffffff').nullish(),
|
|
@@ -25703,6 +25819,7 @@ self.R = R;
|
|
|
25703
25819
|
});
|
|
25704
25820
|
const zAnnotationPointConfig = zAnnotationPoint.omit({
|
|
25705
25821
|
selector: true,
|
|
25822
|
+
measureId: true,
|
|
25706
25823
|
text: true
|
|
25707
25824
|
}).partial();
|
|
25708
25825
|
const zAnnotationHorizontalLineConfig = zAnnotationHorizontalLine.pick({
|