File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
octoprint_external_temp_reader/static/js Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,21 @@ $(function() {
100
100
return [ point . time , point . temperature ] ;
101
101
} ) ;
102
102
103
+ // Calculate adaptive Y-axis range
104
+ if ( filteredData . length > 0 ) {
105
+ var temps = filteredData . map ( function ( point ) { return point . temperature ; } ) ;
106
+ var minTemp = Math . min . apply ( Math , temps ) ;
107
+ var maxTemp = Math . max . apply ( Math , temps ) ;
108
+
109
+ // Add padding (10% on each side or at least 1 degree)
110
+ var range = maxTemp - minTemp ;
111
+ var padding = Math . max ( range * 0.1 , 1.0 ) ;
112
+
113
+ var yaxis = self . chart . getAxes ( ) . yaxis ;
114
+ yaxis . options . min = minTemp - padding ;
115
+ yaxis . options . max = maxTemp + padding ;
116
+ }
117
+
103
118
// Update chart
104
119
self . chart . setData ( [ {
105
120
label : "Chamber Temperature" ,
You can’t perform that action at this time.
0 commit comments