From: Ben Pfaff Date: Wed, 24 Dec 2025 23:24:01 +0000 (-0800) Subject: improved styling X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff8e5cabefe4f281b604f35d75efbc082d573eb9;p=pspp improved styling --- diff --git a/rust/pspp/src/spv/read/legacy_xml.rs b/rust/pspp/src/spv/read/legacy_xml.rs index 428da5aebf..d707bb54ee 100644 --- a/rust/pspp/src/spv/read/legacy_xml.rs +++ b/rust/pspp/src/spv/read/legacy_xml.rs @@ -397,29 +397,32 @@ impl Visualization { dims: &mut Vec>, ) { let base_level = variables[0].1; - let show_label = if let Ok(a) = Axis2::try_from(a) + let (show_label, dimension_style) = if let Ok(a) = Axis2::try_from(a) && let Some(axis) = axes.get(&(base_level + variables.len())) && let Some(label) = &axis.label { - let out = &mut look.areas[Area::Labels(a)]; - *out = AreaStyle::default_for_area(Area::Labels(a)); + let mut dimension_style = AreaStyle::default_for_area(Area::Labels(a)); let style = label.style.get(&styles); + dbg!(variables, label, style); Style::decode_area( style, label.text_frame_style.as_ref().and_then(|r| r.get(styles)), - out, + &mut dimension_style, ); - style.is_some_and(|s| s.visible.unwrap_or(true)) + ( + style.is_some_and(|s| s.visible.unwrap_or(true)), + Some(dimension_style), + ) } else { - false + (false, None) }; - if a == Axis3::Y + if let Ok(a) = Axis2::try_from(a) && let Some(axis) = axes.get(&(base_level + variables.len() - 1)) { Style::decode_area( axis.major_ticks.style.get(&styles), axis.major_ticks.tick_frame_style.get(&styles), - &mut look.areas[Area::Labels(Axis2::Y)], + &mut look.areas[Area::Labels(a)], ); } @@ -522,15 +525,22 @@ impl Visualization { cats = next_cats; } + let dimension_label = variables[0] + .label + .as_ref() + .map_or_else(|| Value::new_empty(), |label| Value::new_user_text(label)); + let dimension_label = if let Some(style) = dimension_style { + dimension_label + .with_cell_style(style.cell_style) + .with_font_style(style.font_style) + } else { + dimension_label + }; + let dimension = Dimension::new( - Group::new( - variables[0] - .label - .as_ref() - .map_or_else(|| Value::new_empty(), |label| Value::new_user_text(label)), - ) - .with_multiple(cats.into_iter().map(|cb| cb.category)) - .with_show_label(show_label), + Group::new(dimension_label) + .with_multiple(cats.into_iter().map(|cb| cb.category)) + .with_show_label(show_label), ) .with_hide_all_labels(hide_all_labels); diff --git a/rust/pspp/src/spv/testdata/legacy3.expected b/rust/pspp/src/spv/testdata/legacy3.expected index 22821935f1..457ebbb2ea 100644 --- a/rust/pspp/src/spv/testdata/legacy3.expected +++ b/rust/pspp/src/spv/testdata/legacy3.expected @@ -1,8 +1,8 @@ Excluded Variables[d] ╭───────┬────────┬──────┬────┬───────────────────┬───────────────────────╮ -│ │ │ │ │ │Collinearity Statistics│ +│Model │ │ │ │ │Collinearity Statistics│ │ │ │ │ │ ├───────────────────────┤ -│Model │ Beta In│ t │Sig.│Partial Correlation│ Tolerance │ +│ │ Beta In│ t │Sig.│Partial Correlation│ Tolerance │ ├───────┼────────┼──────┼────┼───────────────────┼───────────────────────┤ │1 A│-.304[a]│-2.216│.032│ -.317│ .987│ │ B│ .611[a]│ 5.532│.000│ .641│ .999│