Closed vicnevicne closed 8 years ago
I checked the code and it appears the cause is a typo, and the fix is just one char :-)
in processing.app.SerialPlotter.GraphPanel#computeBounds, at line 90, *the "/" should be a ""**, so
double bMin = g.buffer.min() / 2.0;
should read :
double bMin = g.buffer.min() * 2.0;
In the current situation, instead of having a scale twice as big as the graph, the scale is only half the graph in negative values. The fact that the bug shows up only when all values are <= 0 is a fortunate side-effect of the Tick computing.
Can someone apply that fix on the trunk ?
Kind regards,
Vicne
Err. Did more tests, and the universal fix was not so trivial. In fact, division indeed makes sense for the minimum only if it is positive. Same for the maximum if it is negative. So here is the fix I propose (note I moved that calculation after the loop so it is performed only once and not for each graph) :
for(Graph g : graphs) {
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);
KR, Vicne
See pull request above for an updated sketch and comparison video.
Hi,
It seems that when the sketch prints only numbers <= 0, the plotter has a scaling bug that causes only a part of the graph to be displayed.
Here is a video showing the issue with a simple case : http://screencast.com/t/fiU63ujP34wH
This is reproduced with the hourly build of 2015/12/11 03:44
Here is the above sketch in text:
Plotter is a great feature by the way, and multi-trace brings it to a new level :-) Keep on the good work !