SVGHMI: fix XY graph init (consequence of earlier change) + reindent
authorEdouard Tisserant
Thu, 24 Nov 2022 12:05:43 +0100
changeset 3691 9289fdda0222
parent 3690 f41733be17a8
child 3692 a9b787d84846
child 3702 6dc619fa28aa
SVGHMI: fix XY graph init (consequence of earlier change) + reindent

Earlier change did modify the variables attributes (options) are stored in widget objects. XY graph uses variables' min and max to determine range.
svghmi/widget_xygraph.ysl2
--- a/svghmi/widget_xygraph.ysl2	Thu Nov 24 11:47:56 2022 +0100
+++ b/svghmi/widget_xygraph.ysl2	Thu Nov 24 12:05:43 2022 +0100
@@ -58,20 +58,21 @@
             let y_min = Infinity, y_max = -Infinity;
 
             // Compute visible Y range by merging fixed curves Y ranges
-            for(let minmax of this.minmaxes){
-               if(minmax){
-                   let [min,max] = minmax;
-                   if(min < y_min)
-                       y_min = min;
-                   if(max > y_max)
-                       y_max = max;
-               }
+            for(let varopts of this.variables_options){
+                let minmax = varopts.minmax 
+                if(minmax){
+                    let [min,max] = minmax;
+                    if(min < y_min)
+                        y_min = min;
+                    if(max > y_max)
+                        y_max = max;
+                }
             }
 
             if(y_min !== Infinity && y_max !== -Infinity){
-               this.fixed_y_range = true;
+                this.fixed_y_range = true;
             } else {
-               this.fixed_y_range = false;
+                this.fixed_y_range = false;
             }
 
             this.ymin = y_min;