mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
StateTimeline: fix duration in tooltip (#45955)
- Fixes duration in StateTimeline appearing incorrectly when "merge consecutive values" is enabled.
This commit is contained in:
@@ -555,16 +555,18 @@ export function findNextStateIndex(field: Field, datapointIdx: number) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const startValue = field.values.get(datapointIdx);
|
||||||
|
|
||||||
while (end === undefined) {
|
while (end === undefined) {
|
||||||
if (rightPointer >= field.values.length) {
|
if (rightPointer >= field.values.length) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const rightValue = field.values.get(rightPointer);
|
const rightValue = field.values.get(rightPointer);
|
||||||
|
|
||||||
if (rightValue !== undefined) {
|
if (rightValue === undefined || rightValue === startValue) {
|
||||||
end = rightPointer;
|
|
||||||
} else {
|
|
||||||
rightPointer++;
|
rightPointer++;
|
||||||
|
} else {
|
||||||
|
end = rightPointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user