@@ -304,11 +304,18 @@ export const AnomalyDetailsChart = React.memo(
304
304
} , [ props . anomalies , zoomRange , aggregatedAnomalies , selectedAggId ] ) ;
305
305
306
306
const handleZoomRangeChange = ( start : number , end : number ) => {
307
- setZoomRange ( {
308
- startDate : start ,
309
- endDate : end ,
310
- } ) ;
311
- props . onZoomRangeChange ( start , end ) ;
307
+ // In the HC scenario, we only want to change the local zoom range.
308
+ // We don't want to change the overall date range, since that would auto-de-select
309
+ // any selected heatmap cell, and re-fetch results based on the new date range
310
+ if ( props . isHCDetector ) {
311
+ setZoomRange ( {
312
+ startDate : start ,
313
+ endDate : end ,
314
+ } ) ;
315
+ props . onZoomRangeChange ( start , end ) ;
316
+ } else {
317
+ props . onDateRangeChange ( start , end ) ;
318
+ }
312
319
} ;
313
320
314
321
useEffect ( ( ) => {
@@ -505,14 +512,22 @@ export const AnomalyDetailsChart = React.memo(
505
512
const end = get (
506
513
brushArea ,
507
514
'x.1' ,
508
- DEFAULT_DATE_PICKER_RANGE . start
515
+ DEFAULT_DATE_PICKER_RANGE . end
509
516
) ;
510
517
handleZoomRangeChange ( start , end ) ;
511
518
if ( props . onDatePickerRangeChange ) {
512
519
props . onDatePickerRangeChange ( start , end ) ;
513
520
}
514
521
} }
515
522
theme = { ANOMALY_CHART_THEME }
523
+ xDomain = {
524
+ showAggregateResults
525
+ ? undefined
526
+ : {
527
+ min : zoomRange . startDate ,
528
+ max : zoomRange . endDate ,
529
+ }
530
+ }
516
531
/>
517
532
{ ( props . isHCDetector && ! props . selectedHeatmapCell ) ||
518
533
props . isHistorical ? null : (
0 commit comments