[ML] Only adjust the bounds of SMV if annotations are visible (#79210)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Quynh Nguyen 2020-10-05 09:06:55 -05:00 committed by GitHub
parent 5ca87308ea
commit e067604d78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -672,7 +672,7 @@ class TimeseriesChartIntl extends Component {
// if annotations are present, we extend yMax to avoid overlap
// between annotation labels, chart lines and anomalies.
if (focusAnnotationData && focusAnnotationData.length > 0) {
if (showAnnotations && focusAnnotationData && focusAnnotationData.length > 0) {
const levels = getAnnotationLevels(focusAnnotationData);
const maxLevel = d3.max(Object.keys(levels).map((key) => levels[key]));
// TODO needs revisiting to be a more robust normalization