Skip to content

Commit

Permalink
[ML] Fix anomaly dot plotted in wrong location in Single Metric Viewer (
Browse files Browse the repository at this point in the history
#66071)

* [ML] Fix anomaly dot plotted in wrong location in SMV

* [ML] Validate if record's actual exists before setting it as chartPoint data

* [ML] Add logic for chartPoint in case record dne to use the cause's actual

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
qn895 and elasticmachine authored May 12, 2020
1 parent 8601780 commit 7da7080
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ export function processDataForFocusAnomalies(
chartPoint.function = record.function;

if (_.has(record, 'actual')) {
// If cannot match chart point for anomaly time
// substitute the value with the record's actual so it won't plot as null/0
if (chartPoint.value === null) {
chartPoint.value = record.actual;
}

chartPoint.actual = record.actual;
chartPoint.typical = record.typical;
} else {
Expand All @@ -166,6 +172,10 @@ export function processDataForFocusAnomalies(
const cause = _.first(record.causes);
chartPoint.actual = cause.actual;
chartPoint.typical = cause.typical;
// substitute the value with the record's actual so it won't plot as null/0
if (chartPoint.value === null) {
chartPoint.value = cause.actual;
}
}
}
}
Expand Down

0 comments on commit 7da7080

Please sign in to comment.