* OutsideRangePlugin: Exclude null limit values from calculation
* refactor
* Update OutsideRangePlugin.tsx
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
(cherry picked from commit f161c5407a)
Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com>
This commit is contained in:
co-authored by
Victor Marin
parent
b6a91429c9
commit
868e560006
@@ -34,11 +34,26 @@ export const OutsideRangePlugin: React.FC<ThresholdControlsPluginProps> = ({ con
|
||||
}
|
||||
|
||||
// Time values are always sorted for uPlot to work
|
||||
const first = timevalues[0];
|
||||
const last = timevalues[timevalues.length - 1];
|
||||
let i = 0,
|
||||
j = timevalues.length - 1;
|
||||
|
||||
while (i <= j && timevalues[i] == null) {
|
||||
i++;
|
||||
}
|
||||
|
||||
while (j >= 0 && timevalues[j] == null) {
|
||||
j--;
|
||||
}
|
||||
|
||||
const first = timevalues[i];
|
||||
const last = timevalues[j];
|
||||
const fromX = timeRange.min;
|
||||
const toX = timeRange.max;
|
||||
|
||||
if (first == null || last == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// (StartA <= EndB) and (EndA >= StartB)
|
||||
if (first <= toX && last >= fromX) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user