fix TrafficChart::update_charts_data

This commit is contained in:
GyulyVGC
2025-12-13 15:47:08 +01:00
parent f59964ac99
commit 223072d8fa
2 changed files with 9 additions and 9 deletions

View File

@@ -134,7 +134,7 @@ fn reduce_all_time_data(all_time: &mut Vec<(f32, f32)>) {
mod tests {
use splines::{Interpolation, Key, Spline};
use crate::chart::chart_series::{ChartSeries, get_max, get_min};
use crate::chart::types::chart_series::ChartSeries;
use crate::networking::types::data_info::DataInfo;
use crate::networking::types::data_representation::DataRepr;
use crate::utils::types::timestamp::Timestamp;
@@ -247,13 +247,13 @@ fn test_chart_data_updates() {
..Default::default()
};
assert_eq!(get_min(&sent), -1000.0);
assert_eq!(get_max(&received), 21000.0);
assert_eq!(sent.get_min(), -1000.0);
assert_eq!(received.get_max(), 21000.0);
traffic_chart.update_charts_data(&info_traffic, false);
assert_eq!(get_min(&traffic_chart.out_packets), -3333.0);
assert_eq!(get_max(&traffic_chart.in_bytes), 21000.0);
assert_eq!(traffic_chart.out_packets.get_min(), -3333.0);
assert_eq!(traffic_chart.in_bytes.get_max(), 21000.0);
let mut sent_bytes = sent.clone();
sent_bytes

View File

@@ -118,22 +118,22 @@ pub fn update_charts_data(&mut self, info_traffic_msg: &InfoTraffic, no_more_pac
// update sent bytes traffic data
self.out_bytes
.update_series(out_bytes_point, self.is_live_capture, no_more_packets);
self.out_bytes.get_min();
self.min_bytes = self.out_bytes.get_min();
// update received bytes traffic data
self.in_bytes
.update_series(in_bytes_point, self.is_live_capture, no_more_packets);
self.in_bytes.get_max();
self.max_bytes = self.in_bytes.get_max();
// update sent packets traffic data
self.out_packets
.update_series(out_packets_point, self.is_live_capture, no_more_packets);
self.out_packets.get_min();
self.min_packets = self.out_packets.get_min();
// update received packets traffic data
self.in_packets
.update_series(in_packets_point, self.is_live_capture, no_more_packets);
self.in_packets.get_max();
self.max_packets = self.in_packets.get_max();
}
pub fn push_offline_gap_to_splines(&mut self, gap: u32) {