work on table rendering
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 4 Apr 2025 20:20:41 +0000 (13:20 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 4 Apr 2025 20:20:41 +0000 (13:20 -0700)
rust/pspp/src/output/pivot/mod.rs
rust/pspp/src/output/pivot/output.rs
rust/pspp/src/output/render.rs

index 6f55a81c250b063fb19cd426b540b1c0eecfbbb0..f5350aa1b9c211f1ffb8da8b1552142824424be2 100644 (file)
@@ -982,11 +982,12 @@ impl Look {
 }
 
 #[derive(Copy, Clone, Debug, Default, Deserialize, PartialEq, Eq)]
-#[serde(rename_all = "camelCase")]
 pub enum RowLabelPosition {
+    #[serde(rename = "nested")]
     Nested,
 
     #[default]
+    #[serde(rename = "inCorner")]
     Corner,
 }
 
index 14d6ccaafb16c03dd05d3e2302e4073b0c2027fa..868bb81df8fa996f4a49b39b934ae7c73d7c2111 100644 (file)
@@ -163,13 +163,7 @@ impl PivotTable {
 
     pub fn output_body(&self, layer_indexes: &[usize], printing: bool) -> Table {
         let column_enumeration = self.enumerate_axis(Axis3::X, layer_indexes, self.look.omit_empty);
-        for column in column_enumeration.iter() {
-            println!("column {column:?}");
-        }
         let row_enumeration = self.enumerate_axis(Axis3::Y, layer_indexes, self.look.omit_empty);
-        for row in row_enumeration.iter() {
-            println!("row {row:?}");
-        }
         let data = Coord2::new(column_enumeration.len(), row_enumeration.len());
         let stub = Coord2::new(
             self.axes[Axis3::Y].label_depth,
@@ -369,7 +363,7 @@ fn find_category<'a>(
     Some(c)
 }
 
-/// Fills row or column headings into T.
+/// Fills row or column headings into `table`.
 ///
 /// This function uses terminology and variable names for column headings, but
 /// it also applies to row headings because it uses variables for the
index 546d3842be1e4b325d092ba466db630b1ee445ea..c02a385dffcbe74a98d6b103f9f0af095b1df8ad 100644 (file)
@@ -373,11 +373,12 @@ impl Page {
     fn new(table: Arc<Table>, device: &dyn Device, min_width: usize, look: &Look) -> Self {
         use Axis2::*;
 
+        println!("{table:#?}");
         let n = table.n.clone();
 
         // Figure out rule widths.
         let rules = EnumMap::from_fn(|axis| {
-            (0..n[axis])
+            (0..=n[axis])
                 .map(|z| measure_rule(&*device, &*table, axis, z))
                 .collect::<Vec<_>>()
         });
@@ -1064,8 +1065,11 @@ fn distribute_spanned_width(
     spanned: &mut [usize],
     rules: &[usize],
 ) {
+    println!("{unspanned:?}");
+    println!("{spanned:?}");
+    println!("{rules:?}");
     let n = unspanned.len();
-    debug_assert!(n >= 2);
+    debug_assert!(n >= 1);
     debug_assert_eq!(spanned.len(), n);
     debug_assert_eq!(rules.len(), n + 1);