mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-03-17 10:24:44 +01:00
use trace model source and correct units for graph axes and edit dialogs
This commit is contained in:
parent
185f8a9e16
commit
ab9605cb85
|
|
@ -715,7 +715,7 @@ QString EyeDiagramPlot::mouseText(QPoint pos)
|
|||
auto max = qMax(abs(yAxis.getRangeMax()), abs(yAxis.getRangeMin()));
|
||||
auto step = abs(yAxis.getRangeMax() - yAxis.getRangeMin()) / 1000.0;
|
||||
significantDigits = floor(log10(max)) - floor(log10(step)) + 1;
|
||||
ret += Unit::ToString(coords.y(), "V", yAxis.Prefixes(), significantDigits) + "\n";
|
||||
ret += Unit::ToString(coords.y(), "V", yAxis.Prefixes(getModel().getSource()), significantDigits) + "\n";
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,10 +284,10 @@ void TraceWaterfall::draw(QPainter &p)
|
|||
}
|
||||
QString unit = "";
|
||||
if(pref.Graphs.showUnits) {
|
||||
unit = yAxis.Unit();
|
||||
unit = yAxis.Unit(getModel().getSource());
|
||||
}
|
||||
QString labelMin = Unit::ToString(yAxis.getRangeMin(), unit, yAxis.Prefixes(), 4);
|
||||
QString labelMax = Unit::ToString(yAxis.getRangeMax(), unit, yAxis.Prefixes(), 4);
|
||||
QString labelMin = Unit::ToString(yAxis.getRangeMin(), unit, yAxis.Prefixes(getModel().getSource()), 4);
|
||||
QString labelMax = Unit::ToString(yAxis.getRangeMax(), unit, yAxis.Prefixes(getModel().getSource()), 4);
|
||||
p.setPen(QPen(pref.Graphs.Color.axis, 1));
|
||||
p.save();
|
||||
p.translate(legendRect.x(), w.height());
|
||||
|
|
|
|||
|
|
@ -510,8 +510,8 @@ void TraceXYPlot::draw(QPainter &p)
|
|||
QString unit = "";
|
||||
QString prefix = " ";
|
||||
if(pref.Graphs.showUnits) {
|
||||
unit = yAxis[i].Unit();
|
||||
prefix = yAxis[i].Prefixes();
|
||||
unit = yAxis[i].Unit(getModel().getSource());
|
||||
prefix = yAxis[i].Prefixes(getModel().getSource());
|
||||
}
|
||||
auto tickValue = Unit::ToString(yAxis[i].getTicks()[j], unit, prefix, significantDigits);
|
||||
QRect bounding;
|
||||
|
|
@ -1270,7 +1270,7 @@ QString TraceXYPlot::mouseText(QPoint pos)
|
|||
auto max = qMax(abs(yAxis[i].getRangeMax()), abs(yAxis[i].getRangeMin()));
|
||||
auto step = abs(yAxis[i].getRangeMax() - yAxis[i].getRangeMin()) / 1000.0;
|
||||
significantDigits = floor(log10(max)) - floor(log10(step)) + 1;
|
||||
ret += Unit::ToString(coords[i].y(), yAxis[i].Unit(), yAxis[i].Prefixes(), significantDigits) + "\n";
|
||||
ret += Unit::ToString(coords[i].y(), yAxis[i].Unit(getModel().getSource()), yAxis[i].Prefixes(getModel().getSource()), significantDigits) + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ WaterfallAxisDialog::WaterfallAxisDialog(TraceWaterfall *plot) :
|
|||
ui->Wmin->setEnabled(index != 0 && !autoRange);
|
||||
ui->Wmax->setEnabled(index != 0 && !autoRange);
|
||||
auto type = (YAxis::Type) index;
|
||||
QString unit = YAxis::Unit(type);
|
||||
QString unit = YAxis::Unit(type, plot->getModel().getSource());
|
||||
QString prefixes = YAxis::Prefixes(type);
|
||||
ui->Wmin->setUnit(unit);
|
||||
ui->Wmin->setPrefixes(prefixes);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) :
|
|||
}
|
||||
|
||||
// Setup GUI connections
|
||||
auto updateYenableState = [](QComboBox *type, QRadioButton *linear, QRadioButton *log, QCheckBox *CBauto, SIUnitEdit *min, SIUnitEdit *max, QSpinBox *divs, QCheckBox *autoDivs) {
|
||||
auto updateYenableState = [plot](QComboBox *type, QRadioButton *linear, QRadioButton *log, QCheckBox *CBauto, SIUnitEdit *min, SIUnitEdit *max, QSpinBox *divs, QCheckBox *autoDivs) {
|
||||
if(type->currentIndex() == 0) {
|
||||
// axis disabled
|
||||
log->setEnabled(false);
|
||||
|
|
@ -80,7 +80,7 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) :
|
|||
}
|
||||
}
|
||||
auto t = (YAxis::Type) type->currentIndex();
|
||||
QString unit = YAxis::Unit(t);
|
||||
QString unit = YAxis::Unit(t, plot->getModel().getSource());
|
||||
QString prefixes = YAxis::Prefixes(t);
|
||||
min->setUnit(unit);
|
||||
min->setPrefixes(prefixes);
|
||||
|
|
@ -202,10 +202,10 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) :
|
|||
ui->XautoDivs->setChecked(plot->xAxis.getAutoDivs());
|
||||
|
||||
// Constant line list handling
|
||||
auto editLine = [&](XYPlotConstantLine *line) {
|
||||
auto editLine = [plot, this](XYPlotConstantLine *line) {
|
||||
line->editDialog(XAxis::Unit((XAxis::Type) ui->XType->currentIndex()),
|
||||
YAxis::Unit((YAxis::Type) ui->Y1type->currentIndex()),
|
||||
YAxis::Unit((YAxis::Type) ui->Y2type->currentIndex()));
|
||||
YAxis::Unit((YAxis::Type) ui->Y1type->currentIndex(), plot->getModel().getSource()),
|
||||
YAxis::Unit((YAxis::Type) ui->Y2type->currentIndex(), plot->getModel().getSource()));
|
||||
};
|
||||
|
||||
for(auto l : plot->constantLines) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue