Improve autoscaling when no traces are visible, fix display issue of long tick labels
This commit is contained in:
parent
53702a8154
commit
c343cdf69f
@ -818,7 +818,7 @@ VirtualDevice::Info::Info()
|
|||||||
.maxIFBW = 1000000,
|
.maxIFBW = 1000000,
|
||||||
.maxPoints = 10000,
|
.maxPoints = 10000,
|
||||||
.mindBm = -100,
|
.mindBm = -100,
|
||||||
.maxdBm = 100,
|
.maxdBm = 30,
|
||||||
.minRBW = 1,
|
.minRBW = 1,
|
||||||
.maxRBW = 1000000,
|
.maxRBW = 1000000,
|
||||||
};
|
};
|
||||||
|
@ -546,7 +546,7 @@ void EyeDiagramPlot::draw(QPainter &p)
|
|||||||
auto tickValue = Unit::ToString(t, unit, prefixes, significantDigits);
|
auto tickValue = Unit::ToString(t, unit, prefixes, significantDigits);
|
||||||
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
||||||
QRect bounding;
|
QRect bounding;
|
||||||
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*2, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*4,
|
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8,
|
||||||
pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
||||||
lastTickLabelEnd = bounding.x() + bounding.width();
|
lastTickLabelEnd = bounding.x() + bounding.width();
|
||||||
}
|
}
|
||||||
|
@ -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)
|
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->type = type;
|
||||||
this->log = log;
|
this->log = log;
|
||||||
this->autorange = autorange;
|
this->autorange = autorange;
|
||||||
|
@ -328,7 +328,7 @@ void TraceWaterfall::draw(QPainter &p)
|
|||||||
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
||||||
if(displayFullFreq) {
|
if(displayFullFreq) {
|
||||||
QRect bounding;
|
QRect bounding;
|
||||||
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*2, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*4,
|
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8,
|
||||||
pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
||||||
lastTickLabelEnd = bounding.x() + bounding.width();
|
lastTickLabelEnd = bounding.x() + bounding.width();
|
||||||
} else {
|
} else {
|
||||||
@ -340,7 +340,7 @@ void TraceWaterfall::draw(QPainter &p)
|
|||||||
|
|
||||||
tickValue.remove(0, tickValue.size() - displayLastDigits - unit.length());
|
tickValue.remove(0, tickValue.size() - displayLastDigits - unit.length());
|
||||||
QRect bounding;
|
QRect bounding;
|
||||||
p.drawText(QRect(xCoord - 40, plotAreaBottom + 5, 80, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
||||||
lastTickLabelEnd = bounding.x() + bounding.width();
|
lastTickLabelEnd = bounding.x() + bounding.width();
|
||||||
p.setPen(QPen(QColor("orange")));
|
p.setPen(QPen(QColor("orange")));
|
||||||
p.drawText(QRect(0, plotAreaBottom + 5, bounding.x() - 1, pref.Graphs.fontSizeAxis), Qt::AlignRight, "..", &bounding);
|
p.drawText(QRect(0, plotAreaBottom + 5, bounding.x() - 1, pref.Graphs.fontSizeAxis), Qt::AlignRight, "..", &bounding);
|
||||||
|
@ -279,6 +279,8 @@ int TraceXYPlot::sideMargin(bool YAxisEnabled)
|
|||||||
void TraceXYPlot::axisSetupDialog()
|
void TraceXYPlot::axisSetupDialog()
|
||||||
{
|
{
|
||||||
auto setup = new XYplotAxisDialog(this);
|
auto setup = new XYplotAxisDialog(this);
|
||||||
|
setup->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
connect(setup, &QDialog::finished, this, &TraceXYPlot::updateAxisTicks);
|
||||||
if(AppWindow::showGUI()) {
|
if(AppWindow::showGUI()) {
|
||||||
setup->show();
|
setup->show();
|
||||||
}
|
}
|
||||||
@ -691,7 +693,7 @@ void TraceXYPlot::draw(QPainter &p)
|
|||||||
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
||||||
if(displayFullFreq) {
|
if(displayFullFreq) {
|
||||||
QRect bounding;
|
QRect bounding;
|
||||||
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*2, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*4,
|
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8,
|
||||||
pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
||||||
lastTickLabelEnd = bounding.x() + bounding.width();
|
lastTickLabelEnd = bounding.x() + bounding.width();
|
||||||
} else {
|
} else {
|
||||||
@ -703,7 +705,7 @@ void TraceXYPlot::draw(QPainter &p)
|
|||||||
|
|
||||||
tickValue.remove(0, tickValue.size() - displayLastDigits - unit.length());
|
tickValue.remove(0, tickValue.size() - displayLastDigits - unit.length());
|
||||||
QRect bounding;
|
QRect bounding;
|
||||||
p.drawText(QRect(xCoord - 40, plotAreaBottom + 5, 80, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8, pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
|
||||||
lastTickLabelEnd = bounding.x() + bounding.width();
|
lastTickLabelEnd = bounding.x() + bounding.width();
|
||||||
p.setPen(QPen(QColor("orange")));
|
p.setPen(QPen(QColor("orange")));
|
||||||
p.drawText(QRect(0, plotAreaBottom + 5, bounding.x() - 1, pref.Graphs.fontSizeAxis), Qt::AlignRight, "..", &bounding);
|
p.drawText(QRect(0, plotAreaBottom + 5, bounding.x() - 1, pref.Graphs.fontSizeAxis), Qt::AlignRight, "..", &bounding);
|
||||||
@ -823,9 +825,7 @@ void TraceXYPlot::updateAxisTicks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(min < max) {
|
xAxis.set(xAxis.getType(), xAxis.getLog(), true, min, max, 0);
|
||||||
xAxis.set(xAxis.getType(), xAxis.getLog(), true, min, max, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0;i<2;i++) {
|
for(int i=0;i<2;i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user