diff --git a/examples/demo.improv b/examples/demo.improv index 3f4fe00..d5f2675 100644 --- a/examples/demo.improv +++ b/examples/demo.improv @@ -14,26 +14,22 @@ Date_Month: column format: ,.0 ## Formulas -- Profit = Revenue - Cost [_Measure] - -## Category: _Index - -## Category: _Dim +- Profit = Revenue - Cost ## Category: _Measure -- Cost, Revenue, Profit +- Cost, Revenue ## Category: Customer -- Initech, |Oceanic Airlines|, |Acme Corp|, |Globex Inc|, |Umbrella Co|, |Wonka Industries|, |Stark Enterprises|, |Cyberdyne Systems|, |Soylent Ltd| +- |Stark Enterprises|, |Soylent Ltd|, |Wonka Industries|, |Cyberdyne Systems|, |Acme Corp|, |Oceanic Airlines|, |Umbrella Co|, |Globex Inc|, Initech ## Category: Date -- |2025-01-15|, |2025-02-28|, |2025-03-03|, |2025-03-21|, |2025-01-06|, |2025-02-18|, |2025-02-10|, |2025-01-27|, |2025-01-09|, |2025-01-31|, |2025-03-25|, |2025-01-30|, |2025-01-12|, |2025-01-19|, |2025-02-14|, |2025-03-10|, |2025-01-23|, |2025-03-18|, |2025-03-30|, |2025-02-06|, |2025-01-28|, |2025-01-17|, |2025-01-08|, |2025-03-12|, |2025-01-14|, |2025-02-15|, |2025-03-14|, |2025-02-24|, |2025-03-07|, |2025-03-05|, |2025-03-28|, |2025-01-20|, |2025-02-03|, |2025-02-20|, |2025-01-11|, |2025-01-22|, |2025-02-22|, |2025-02-25|, |2025-03-19|, |2025-02-05| +- |2025-01-23|, |2025-03-25|, |2025-01-11|, |2025-03-12|, |2025-01-06|, |2025-01-15|, |2025-03-30|, |2025-03-10|, |2025-03-05|, |2025-01-19|, |2025-03-28|, |2025-01-22|, |2025-01-30|, |2025-01-12|, |2025-02-15|, |2025-03-07|, |2025-01-31|, |2025-01-27|, |2025-01-28|, |2025-03-03|, |2025-03-19|, |2025-02-05|, |2025-02-22|, |2025-02-25|, |2025-03-18|, |2025-02-20|, |2025-02-24|, |2025-01-14|, |2025-03-21|, |2025-01-08|, |2025-02-03|, |2025-02-10|, |2025-03-14|, |2025-02-14|, |2025-02-06|, |2025-01-09|, |2025-01-17|, |2025-01-20|, |2025-02-18|, |2025-02-28| ## Category: Product -- Sprockets, Widgets, Gadgets +- Gadgets, Widgets, Sprockets ## Category: Region -- West, East, North, South +- North, East, South, West ## Category: Date_Month - |2025-01|, |2025-02|, |2025-03| diff --git a/src/ui/app.rs b/src/ui/app.rs index 850d556..324c535 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -199,7 +199,16 @@ pub struct App { } impl App { - pub fn new(model: Model, file_path: Option) -> Self { + pub fn new(mut model: Model, file_path: Option) -> Self { + // Recompute formula cache before building the initial layout so + // formula-derived values are available on the first frame. + let none_cats: Vec = model + .active_view() + .categories_on(crate::view::Axis::None) + .into_iter() + .map(String::from) + .collect(); + model.recompute_formulas(&none_cats); let layout = { let view = model.active_view(); GridLayout::with_frozen_records(&model, view, None)