File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -24,4 +24,7 @@ yarn-debug.log*
24
24
yarn-error.log *
25
25
26
26
.idea /
27
+ .vscode /
28
+ .history /
29
+
27
30
stream-charts- * .tgz
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ interface Props {
92
92
// data to plot: time-window is the time-range of data shown (slides in time)
93
93
timeWindow : number ;
94
94
seriesList : Array < Series > ;
95
+ dropDataAfter ?: number ;
95
96
96
97
// regex filter used to select which series are displayed
97
98
filter ?: RegExp ;
@@ -126,6 +127,7 @@ export function RasterChart(props: Props): JSX.Element {
126
127
onUpdateTime = ( _ : number ) => { } ,
127
128
filter = / ./ ,
128
129
timeWindow,
130
+ dropDataAfter = Infinity ,
129
131
height,
130
132
backgroundColor = '#202020' ,
131
133
} = props ;
@@ -1084,6 +1086,11 @@ export function RasterChart(props: Props): JSX.Element {
1084
1086
1085
1087
// add the new data to the series
1086
1088
series . data . push ( ...newData ) ;
1089
+
1090
+ // drop data that is older than the max time-window
1091
+ while ( currentTimeRef . current - series . data [ 0 ] . time > dropDataAfter ) {
1092
+ series . data . shift ( ) ;
1093
+ }
1087
1094
} )
1088
1095
1089
1096
// update the data
You can’t perform that action at this time.
0 commit comments