diff --git a/src/workbook.rs b/src/workbook.rs index c1d1076..4376f15 100644 --- a/src/workbook.rs +++ b/src/workbook.rs @@ -26,9 +26,12 @@ pub struct Workbook { impl Workbook { /// Create a new workbook with a fresh `Model` and a single `Default` view. /// Virtual categories (`_Index`, `_Dim`, `_Measure`) are registered on the - /// default view with their conventional axes (`_Index`=Row, `_Dim`=Column, - /// `_Measure`=Page so aggregated pivot views show a single measure by - /// default; see improvise-kos). + /// default view. All virtuals default to `Axis::None` via + /// `on_category_added` (see improvise-709f2df), then `_Measure` is bumped + /// to `Axis::Page` so aggregated pivot views show a single measure at a + /// time (see improvise-kos). Leaving `_Index`/`_Dim` on None keeps pivot + /// mode the default — records mode activates only when the user moves + /// both onto axes. pub fn new(name: impl Into) -> Self { let model = Model::new(name); let mut views = IndexMap::new(); @@ -42,8 +45,6 @@ impl Workbook { for cat_name in wb.model.categories.keys() { view.on_category_added(cat_name); } - view.set_axis("_Index", Axis::Row); - view.set_axis("_Dim", Axis::Column); view.set_axis("_Measure", Axis::Page); } wb @@ -150,8 +151,12 @@ mod tests { let wb = Workbook::new("Test"); assert_eq!(wb.active_view, "Default"); let v = wb.active_view(); - assert_eq!(v.axis_of("_Index"), Axis::Row); - assert_eq!(v.axis_of("_Dim"), Axis::Column); + // Virtual categories default to Axis::None; _Measure is bumped to Page + // so aggregated pivot views show a single measure by default + // (improvise-kos, improvise-709f2df). + assert_eq!(v.axis_of("_Index"), Axis::None); + assert_eq!(v.axis_of("_Dim"), Axis::None); + assert_eq!(v.axis_of("_Measure"), Axis::Page); } #[test]