From cdee74b23f0ae34b6ce3aee9e79e36b245f730ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedrich=20V=C3=B6lkers?= Date: Tue, 3 Mar 2026 13:54:06 +0100 Subject: [PATCH 1/3] update plotly docs (added filter) --- docs/ref-plotly.md | 71 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/docs/ref-plotly.md b/docs/ref-plotly.md index 52de584..87f23c0 100644 --- a/docs/ref-plotly.md +++ b/docs/ref-plotly.md @@ -35,12 +35,22 @@ traces: y: $trips.totalTrips ... ``` + SimWrapper will read the file and insert the appropriate data columns into the configuration automatically. Note the `$` before the keyword that you used for identifying the dataset. - You can read _multiple datasets_ and refer to columns from each using `$key.column` for each. +- A dataset can also be configured as an object (`file`, `filter`, `pivot`, `rename`, `normalize`, ...), not only as a simple file string. **Layout.** Layout is handled by SimWrapper automatically; however if you want to override some layout defaults, you can include a `layout` section. The contents will be merged with the default layout values. +### Layout behavior updates + +- `layout.legend` from YAML is now merged with SimWrapper defaults (instead of replacing them). +- Axis titles support both Plotly object syntax and legacy string syntax: + - `title: "Distance group"` + - `title: { text: "Distance group", standoff: 12 }` +- If axis titles are present (`xaxis`, `yaxis`, `yaxis2`), margins are automatically enlarged to avoid clipped titles. + ### Additional properties SimWrapper can preprocess datasets with the following special properties for use with the Plotly plug-in. Note, these are not part of the official Plotly library, but are SimWrapper-specific additions. @@ -105,6 +115,53 @@ layout: | educ_higher | 7 | 2.587991718426501E-4 | 5.175983436853002E-4 | | ... | ... | ... | ... | +### Filter + +You can filter dataset rows before trace generation using `datasets..filter`. + +- Filtering is applied before `pivot`, `rename`, `normalize`, and `aggregate`. +- Filter definitions are column-based. +- Multiple filter columns are combined with AND. + +```yaml +datasets: + dataset: + file: "analysis/population/trip_purposes_by_hour.csv" + filter: + purpose: "business,educ_higher" # categorical list (comma-separated shorthand) + h: ">= 6" # comparison shorthand +``` + +Equivalent explicit form: + +```yaml +datasets: + dataset: + file: "analysis/population/trip_purposes_by_hour.csv" + filter: + h: + conditional: ">=" + value: 6 + arrival: + range: true + values: [0.0, 0.25] # inclusive range + departure: + value: 0 + invert: true # keep rows where departure != 0 + purpose: + values: [business, educ_higher] +``` + +Supported filter options per column: + +|**Field**|**Description**| +|---------|---------------| +|value|Single value to match| +|values|List of values to match| +|conditional|One of `<`, `<=`, `>`, `>=`| +|range|Boolean. If `true`, `values` is treated as inclusive `[min, max]`| +|invert|Boolean. Invert the filter result for this column| + ### Pivot With the pivot attribute, you can modify the dataset by converting it from wide to long format. @@ -134,14 +191,14 @@ dataset: namesTo: names valuesTo: values rename: - ref_share: Ref. - sim_share: Sim. + ref_share: Ref. + sim_share: Sim. normalize: - target: values - groupBy: - - names - - dist_group - - age + target: values + groupBy: + - names + - dist_group + - age ``` ### Facets From 3a1909772528c9f145d9bd97172f688419d57e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedrich=20V=C3=B6lkers?= Date: Tue, 3 Mar 2026 13:54:52 +0100 Subject: [PATCH 2/3] update plotly docs (added filter) --- docs/ref-plotly.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/ref-plotly.md b/docs/ref-plotly.md index 87f23c0..290cc05 100644 --- a/docs/ref-plotly.md +++ b/docs/ref-plotly.md @@ -35,7 +35,6 @@ traces: y: $trips.totalTrips ... ``` - SimWrapper will read the file and insert the appropriate data columns into the configuration automatically. Note the `$` before the keyword that you used for identifying the dataset. - You can read _multiple datasets_ and refer to columns from each using `$key.column` for each. From 103a8185725a02ac188a2468777fe9d022a4d1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedrich=20V=C3=B6lkers?= Date: Tue, 3 Mar 2026 13:57:47 +0100 Subject: [PATCH 3/3] update plotly docs (added filter) --- docs/ref-plotly.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/ref-plotly.md b/docs/ref-plotly.md index 290cc05..56aee96 100644 --- a/docs/ref-plotly.md +++ b/docs/ref-plotly.md @@ -38,18 +38,9 @@ traces: SimWrapper will read the file and insert the appropriate data columns into the configuration automatically. Note the `$` before the keyword that you used for identifying the dataset. - You can read _multiple datasets_ and refer to columns from each using `$key.column` for each. -- A dataset can also be configured as an object (`file`, `filter`, `pivot`, `rename`, `normalize`, ...), not only as a simple file string. **Layout.** Layout is handled by SimWrapper automatically; however if you want to override some layout defaults, you can include a `layout` section. The contents will be merged with the default layout values. -### Layout behavior updates - -- `layout.legend` from YAML is now merged with SimWrapper defaults (instead of replacing them). -- Axis titles support both Plotly object syntax and legacy string syntax: - - `title: "Distance group"` - - `title: { text: "Distance group", standoff: 12 }` -- If axis titles are present (`xaxis`, `yaxis`, `yaxis2`), margins are automatically enlarged to avoid clipped titles. - ### Additional properties SimWrapper can preprocess datasets with the following special properties for use with the Plotly plug-in. Note, these are not part of the official Plotly library, but are SimWrapper-specific additions.