Skip to content

Commit d2e98a5

Browse files
committed
Modification - Slicer & SlicerPreview - Connect valid points when cutNullValues is false
1 parent b951835 commit d2e98a5

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/atoms/Slicer.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ function makeMiniChart(ds, smooth = false) {
488488
const e = Math.min(len, Math.max(s + 1, endMini.value));
489489
490490
const points = ds.map((dp, i) => {
491-
const val = props.cutNullValues ? dp : dp === null ? 0 : dp;
491+
const val = dp;
492492
const valid = Number.isFinite(val);
493493
const x = unitWidthX.value * i + (props.minimapCompact ? 0 : unitWidthX.value / 2);
494494
const y0 = mapYSeries(0);
@@ -497,7 +497,7 @@ function makeMiniChart(ds, smooth = false) {
497497
x,
498498
y: valid ? mapYSeries(val) : NaN,
499499
v: val,
500-
value: valid ? val : null,
500+
value: val == null ? null : valid ? val : null,
501501
y0,
502502
i,
503503
};
@@ -513,15 +513,15 @@ function makeMiniChart(ds, smooth = false) {
513513
const fullSet =
514514
points.length >= 2
515515
? (props.smoothMinimap || smooth
516-
? (props.cutNullValues ? createSmoothPathWithCuts(points) : createSmoothPath(points))
517-
: (props.cutNullValues ? createStraightPathWithCuts(points) : createStraightPath(points)))
516+
? (props.cutNullValues ? createSmoothPathWithCuts(points) : createSmoothPath(points.filter(p => p.value != null)))
517+
: (props.cutNullValues ? createStraightPathWithCuts(points) : createStraightPath(points.filter(p => p.value != null))))
518518
: '';
519519
520520
const selectionSet =
521521
sliced.length >= 2
522522
? (props.smoothMinimap || smooth
523-
? (props.cutNullValues ? createSmoothPathWithCuts(sliced) : createSmoothPath(sliced))
524-
: (props.cutNullValues ? createStraightPathWithCuts(sliced) : createStraightPath(sliced)))
523+
? (props.cutNullValues ? createSmoothPathWithCuts(sliced) : createSmoothPath(sliced.filter(p => p.value != null)))
524+
: (props.cutNullValues ? createStraightPathWithCuts(sliced) : createStraightPath(sliced.filter(p => p.value != null))))
525525
: '';
526526
527527
return {

src/atoms/SlicerPreview.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ function makeMiniChart(ds, smooth = false) {
509509
const e = Math.min(len, Math.max(s + 1, endMini.value));
510510
511511
const points = ds.map((dp, i) => {
512-
const val = props.cutNullValues ? dp : dp === null ? 0 : dp;
512+
const val = dp;
513513
const valid = Number.isFinite(val);
514514
const x = unitWidthX.value * i + (props.minimapCompact ? 0 : unitWidthX.value / 2);
515515
const y0 = mapYSeries(0);
@@ -519,11 +519,11 @@ function makeMiniChart(ds, smooth = false) {
519519
x,
520520
y: valid ? mapYSeries(val) : NaN,
521521
v: val,
522-
value: valid ? val : null,
522+
value: val == null ? null : valid ? val : null,
523523
y0,
524524
i,
525-
};
526-
});
525+
}
526+
})
527527
528528
const isValid = (idx) => idx >= 0 && idx < points.length && Number.isFinite(points[idx]?.value);
529529
@@ -535,15 +535,15 @@ function makeMiniChart(ds, smooth = false) {
535535
const fullSet =
536536
points.length >= 2
537537
? (props.smoothMinimap || smooth
538-
? (props.cutNullValues ? createSmoothPathWithCuts(points) : createSmoothPath(points))
539-
: (props.cutNullValues ? createStraightPathWithCuts(points) : createStraightPath(points)))
538+
? (props.cutNullValues ? createSmoothPathWithCuts(points) : createSmoothPath(points.filter(p => p.value != null)))
539+
: (props.cutNullValues ? createStraightPathWithCuts(points) : createStraightPath(points.filter(p => p.value != null))))
540540
: '';
541541
542542
const selectionSet =
543543
sliced.length >= 2
544544
? (props.smoothMinimap || smooth
545-
? (props.cutNullValues ? createSmoothPathWithCuts(sliced) : createSmoothPath(sliced))
546-
: (props.cutNullValues ? createStraightPathWithCuts(sliced) : createStraightPath(sliced)))
545+
? (props.cutNullValues ? createSmoothPathWithCuts(sliced) : createSmoothPath(sliced.filter(p => p.value != null)))
546+
: (props.cutNullValues ? createStraightPathWithCuts(sliced) : createStraightPath(sliced.filter(p => p.value != null))))
547547
: '';
548548
549549
return {
@@ -1143,7 +1143,7 @@ defineExpose({
11431143
11441144
<circle
11451145
v-for="m in dp.fullMarkers"
1146-
v-if="dp.isVisible"
1146+
v-if="dp.isVisible && cutNullValues"
11471147
:key="`sel-dot-under-${dp.key}-${m.i}`"
11481148
:cx="m.x"
11491149
:cy="m.y"
@@ -1349,7 +1349,7 @@ defineExpose({
13491349
13501350
<circle
13511351
v-for="m in dp.selectionMarkers"
1352-
v-if="dp.isVisible"
1352+
v-if="dp.isVisible && cutNullValues"
13531353
:key="`sel-dot-${dp.key}-${m.i}`"
13541354
:cx="m.x"
13551355
:cy="m.y"

0 commit comments

Comments
 (0)