revert the smaller values thing

This commit is contained in:
ClementTsang 2025-04-14 02:18:59 -04:00
parent 55b5eebc2a
commit 79615aed2f
No known key found for this signature in database
GPG Key ID: DC3B7867D8D97095
5 changed files with 7 additions and 7 deletions

View File

@ -104,7 +104,7 @@ impl TimeGraph<'_> {
if self.hide_x_labels {
Axis::default().bounds(adjusted_x_bounds)
} else {
let x_bound_left = ((-self.x_min) as u64).to_string();
let x_bound_left = ((-self.x_min) as u64 / 1000).to_string();
let x_bound_right = "0s";
let x_labels = vec![
@ -230,7 +230,7 @@ mod test {
fn create_time_graph() -> TimeGraph<'static> {
TimeGraph {
title: " Network ".into(),
x_min: -15.0,
x_min: -15000.0,
hide_x_labels: false,
y_bounds: AxisBound::Max(100.5),
y_labels: &Y_LABELS,
@ -254,7 +254,7 @@ mod test {
let x_axis = tg.generate_x_axis();
let actual = Axis::default()
.bounds(AxisBound::Min(-15.0))
.bounds(AxisBound::Min(-15000.0))
.labels(vec![Span::styled("15s", style), Span::styled("0s", style)])
.style(style);
assert_eq!(x_axis.bounds, actual.bounds);

View File

@ -46,7 +46,7 @@ impl TimeChart<'_> {
.iter_along_base(times)
.rev()
.map(|(&time, &val)| {
let from_start = current_time.duration_since(time).as_secs_f64() * -1.0;
let from_start = current_time.duration_since(time).as_millis() as f64 * -1.0;
// XXX: Should this be generic over dataset.graph_type instead? That would allow us to move
// transformations behind a type - however, that also means that there's some complexity added.

View File

@ -180,7 +180,7 @@ impl Painter {
let data = app_state.data_store.get_data();
let border_style = self.get_border_style(widget_id, app_state.current_widget.widget_id);
let x_min = -(cpu_widget_state.current_display_time as f64) / 1000.0;
let x_min = -(cpu_widget_state.current_display_time as f64);
let hide_x_labels = should_hide_x_label(
app_state.app_config_fields.hide_time,
app_state.app_config_fields.autohide_time,

View File

@ -62,7 +62,7 @@ impl Painter {
if let Some(mem_state) = app_state.states.mem_state.widget_states.get_mut(&widget_id) {
let border_style = self.get_border_style(widget_id, app_state.current_widget.widget_id);
let x_min = -(mem_state.current_display_time as f64) / 1000.0;
let x_min = -(mem_state.current_display_time as f64);
let hide_x_labels = should_hide_x_label(
app_state.app_config_fields.hide_time,
app_state.app_config_fields.autohide_time,

View File

@ -67,7 +67,7 @@ impl Painter {
let rx_points = &(shared_data.timeseries_data.rx);
let tx_points = &(shared_data.timeseries_data.tx);
let time = &(shared_data.timeseries_data.time);
let time_start = -(network_widget_state.current_display_time as f64) / 1000.0;
let time_start = -(network_widget_state.current_display_time as f64);
let border_style = self.get_border_style(widget_id, app_state.current_widget.widget_id);
let hide_x_labels = should_hide_x_label(