Improve autoscaling when no traces are visible, fix display issue of long tick labels

This commit is contained in:
Jan Käberich 2022-10-25 13:23:08 +02:00
parent 53702a8154
commit c343cdf69f
6 changed files with 36 additions and 9 deletions

View file

@ -474,6 +474,33 @@ double XAxis::sampleToCoordinate(Trace::Data data, Trace *t, unsigned int sample
void XAxis::set(Type type, bool log, bool autorange, double min, double max, double div)
{
if(max <= min) {
auto info = VirtualDevice::getInfo(VirtualDevice::getConnected());
// invalid selection, use default instead
switch(type) {
case Type::Frequency:
min = info.Limits.minFreq;
max = info.Limits.maxFreq;
break;
case Type::Power:
min = info.Limits.mindBm;
max = info.Limits.maxdBm;
break;
case Type::Time:
case Type::TimeZeroSpan:
min = 0.0;
max = 1.0;
break;
case Type::Distance:
min = 0.0;
max = 0.01;
break;
default:
min = 0.0;
max = 1.0;
break;
}
}
this->type = type;
this->log = log;
this->autorange = autorange;