File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,8 +66,11 @@ DRAW rect
6666If ` x ` is continuous, then ` width ` can be variable. Likewise for ` y ` and ` height ` .
6767
6868``` {ggsql}
69- SELECT *, Temp / (SELECT MAX(Temp) FROM ggsql:airquality) AS norm_temp
69+ SELECT
70+ *,
71+ CAST(Temp AS REAL) / (SELECT MAX(Temp) FROM ggsql:airquality) AS norm_temp
7072FROM ggsql:airquality
73+
7174VISUALISE Day AS x, Month AS y, Temp AS colour
7275DRAW rect
7376 MAPPING norm_temp AS width, norm_temp AS height
Original file line number Diff line number Diff line change 33//! This module handles building SQL queries for layers, applying pre-stat
44//! transformations, stat transforms, and post-query operations.
55
6- use crate :: plot:: aesthetic:: AestheticContext ;
6+ use crate :: plot:: aesthetic:: { self , AestheticContext } ;
77use crate :: plot:: layer:: is_transposed;
88use crate :: plot:: layer:: orientation:: { flip_positional_aesthetics, resolve_orientation} ;
99use crate :: plot:: {
@@ -579,6 +579,20 @@ where
579579 let original_name = consumed_original_names
580580 . get ( aesthetic)
581581 . cloned ( )
582+ . or_else ( || {
583+ // For variant positional aesthetics (e.g., pos1min, pos2max),
584+ // fall back to the primary aesthetic's original name (pos1, pos2).
585+ // This ensures rect's expanded min/max aesthetics inherit the
586+ // original column name from the user's x/y mapping.
587+ aesthetic:: parse_positional ( aesthetic) . and_then ( |( slot, suffix) | {
588+ if !suffix. is_empty ( ) {
589+ let primary = format ! ( "pos{}" , slot) ;
590+ consumed_original_names. get ( & primary) . cloned ( )
591+ } else {
592+ None
593+ }
594+ } )
595+ } )
582596 . or_else ( || Some ( stat. clone ( ) ) ) ;
583597
584598 let value = AestheticValue :: Column {
You can’t perform that action at this time.
0 commit comments