File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -87,12 +87,17 @@ private Ticks computeBounds() {
8787 minY = Double .POSITIVE_INFINITY ;
8888 maxY = Double .NEGATIVE_INFINITY ;
8989 for (Graph g : graphs ) {
90- double bMin = g .buffer .min () / 2.0 ;
91- double bMax = g .buffer .max () * 2.0 ;
92- minY = bMin < minY ? bMin : minY ;
93- maxY = bMax > maxY ? bMax : maxY ;
90+ minY = Math .min (g .buffer .min (), minY );
91+ maxY = Math .max (g .buffer .max (), maxY );
9492 }
95-
93+
94+ final double MIN_DELTA = 10.0 ;
95+ if (maxY - minY < MIN_DELTA ) {
96+ double mid = (maxY + minY ) / 2 ;
97+ maxY = mid + MIN_DELTA / 2 ;
98+ minY = mid - MIN_DELTA / 2 ;
99+ }
100+
96101 Ticks ticks = new Ticks (minY , maxY , 3 );
97102 minY = Math .min (minY , ticks .getTick (0 ));
98103 maxY = Math .max (maxY , ticks .getTick (ticks .getTickCount () - 1 ));
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ ARDUINO 1.6.8
55* Fixed incorrect key bindings handling for changing tab. Thanks @matthijskooijman
66* MacOSX: Fixed handling of add indent/remove indent shortcuts (CMD+[ and CMD+])
77* Fixed incorrect update of available libraries in Library Manager. Thanks @vicnevicne
8+ * Serial plotter now correctly resize graphs with negative values. Thanks @vicnevicne
89
910[core]
1011* avr: fixed USB_SendControl(...) for buffer with len > 64. Thanks @NicoHood
You can’t perform that action at this time.
0 commit comments