File tree Expand file tree Collapse file tree 1 file changed +25
-13
lines changed
crates/viewer/re_view_time_series/src Expand file tree Collapse file tree 1 file changed +25
-13
lines changed Original file line number Diff line number Diff line change @@ -719,20 +719,32 @@ fn add_series_to_plot(
719
719
* scalar_range. end_mut ( ) = f64:: NEG_INFINITY ;
720
720
721
721
for series in all_plot_series {
722
- let points = series
723
- . points
724
- . iter ( )
725
- . map ( |p| {
726
- if p. 1 < scalar_range. start ( ) {
727
- * scalar_range. start_mut ( ) = p. 1 ;
728
- }
729
- if p. 1 > scalar_range. end ( ) {
730
- * scalar_range. end_mut ( ) = p. 1 ;
731
- }
722
+ let points = if series. visible {
723
+ series
724
+ . points
725
+ . iter ( )
726
+ . map ( |p| {
727
+ if p. 1 < scalar_range. start ( ) {
728
+ * scalar_range. start_mut ( ) = p. 1 ;
729
+ }
730
+ if p. 1 > scalar_range. end ( ) {
731
+ * scalar_range. end_mut ( ) = p. 1 ;
732
+ }
732
733
733
- [ ( p. 0 - time_offset) as _ , p. 1 ]
734
- } )
735
- . collect :: < Vec < _ > > ( ) ;
734
+ [ ( p. 0 - time_offset) as _ , p. 1 ]
735
+ } )
736
+ . collect :: < Vec < _ > > ( )
737
+ } else {
738
+ // Note we still need to produce a series, so it shows up in the legend.
739
+ // As of writing, egui_plot gets confused if this is an empty series, so
740
+ // we still add a single point (but don't have it influence the scalar range!)
741
+ series
742
+ . points
743
+ . iter ( )
744
+ . map ( |p| [ ( p. 0 - time_offset) as _ , p. 1 ] )
745
+ . take ( 1 )
746
+ . collect :: < Vec < _ > > ( )
747
+ } ;
736
748
737
749
let color = series. color ;
738
750
You can’t perform that action at this time.
0 commit comments