@@ -478,10 +478,15 @@ impl ViewClass for TimeSeriesView {
478478 } ;
479479 state. time_offset = time_offset;
480480
481- // Get the maximum time/X value for the entire plot
482- let max_time = all_plot_series
481+ // Get the min and max time/X value for the visible plot.
482+ let min_view_time = all_plot_series
483483 . iter ( )
484- . map ( |line| line. points . last ( ) . map ( |( t, _) | * t) . unwrap_or ( line. min_time ) )
484+ . filter_map ( |line| line. points . first ( ) . map ( |( t, _) | * t) )
485+ . min ( )
486+ . unwrap_or ( 0 ) ;
487+ let max_view_time = all_plot_series
488+ . iter ( )
489+ . filter_map ( |line| line. points . last ( ) . map ( |( t, _) | * t) )
485490 . max ( )
486491 . unwrap_or ( 0 ) ;
487492
@@ -498,8 +503,8 @@ impl ViewClass for TimeSeriesView {
498503 . unwrap_or_default ( ) ;
499504
500505 state. max_time_view_range = AbsoluteTimeRange :: new (
501- TimeInt :: saturated_temporal_i64 ( min_time ) ,
502- TimeInt :: saturated_temporal_i64 ( max_time ) ,
506+ TimeInt :: saturated_temporal_i64 ( min_view_time ) ,
507+ TimeInt :: saturated_temporal_i64 ( max_view_time ) ,
503508 ) ;
504509
505510 let blueprint_db = ctx. blueprint_db ( ) ;
@@ -620,18 +625,6 @@ impl ViewClass for TimeSeriesView {
620625 . map ( |line| line. aggregator )
621626 . unwrap_or_default ( ) ;
622627
623- // …then use that as an offset to avoid nasty precision issues with
624- // large times (nanos since epoch does not fit into a f64).
625- let time_offset = match timeline. typ ( ) {
626- TimeType :: Sequence => min_time,
627- TimeType :: TimestampNs | TimeType :: DurationNs => {
628- // In order to make the tick-marks on the time axis fall on whole days, hours, minutes etc,
629- // we need to round to a whole day:
630- round_nanos_to_start_of_day ( min_time)
631- }
632- } ;
633- state. time_offset = time_offset;
634-
635628 // TODO(#5075): Boxed-zoom should be fixed to accommodate the locked range.
636629 let timestamp_format = ctx. app_options ( ) . timestamp_format ;
637630
0 commit comments