Skip to content

Fixed #4292 - Plotter scaling by adapting margin computation based on sign #4365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/src/processing/app/SerialPlotter.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ private Ticks computeBounds() {
minY = Double.POSITIVE_INFINITY;
maxY = Double.NEGATIVE_INFINITY;
for(Graph g : graphs) {
double bMin = g.buffer.min() / 2.0;
double bMax = g.buffer.max() * 2.0;
double bMin = g.buffer.min();
double bMax = g.buffer.max();
minY = bMin < minY ? bMin : minY;
maxY = bMax > maxY ? bMax : maxY;
}

minY = minY * ((minY<0)?2:0.5);
maxY = maxY * ((maxY<0)?0.5:2);

Ticks ticks = new Ticks(minY, maxY, 3);
minY = Math.min(minY, ticks.getTick(0));
maxY = Math.max(maxY, ticks.getTick(ticks.getTickCount() - 1));
Expand Down