Improve graph axis labeling

- Use correct Y height to display full font
- Fix floating point issue when calculating amount of displayed digits
  in Unit::ToString
This commit is contained in:
Jan Käberich 2023-04-05 17:13:21 +02:00
parent 5f022c42b6
commit 1aaba21723
4 changed files with 15 additions and 15 deletions

View file

@ -478,7 +478,7 @@ void EyeDiagramPlot::draw(QPainter &p)
prefix = "um ";
}
auto tickValue = Unit::ToString(yAxis.getTicks()[j], unit, prefix, significantDigits);
p.drawText(QRectF(0, yCoord - pref.Graphs.fontSizeAxis/2 - 2, tickStart + 2 * tickLen, pref.Graphs.fontSizeAxis), Qt::AlignRight, tickValue);
p.drawText(QRectF(0, yCoord - pref.Graphs.fontSizeAxis/2 - 2, tickStart + 2 * tickLen, pref.Graphs.fontSizeAxis*1.5), Qt::AlignRight, tickValue);
// tick lines
if(yCoord == plotAreaTop || yCoord == plotAreaBottom) {
@ -547,7 +547,7 @@ void EyeDiagramPlot::draw(QPainter &p)
p.setPen(QPen(pref.Graphs.Color.axis, 1));
QRect bounding;
p.drawText(QRect(xCoord - pref.Graphs.fontSizeAxis*4, plotAreaBottom + 5, pref.Graphs.fontSizeAxis*8,
pref.Graphs.fontSizeAxis), Qt::AlignHCenter, tickValue, &bounding);
pref.Graphs.fontSizeAxis*1.5), Qt::AlignHCenter, tickValue, &bounding);
lastTickLabelEnd = bounding.x() + bounding.width();
}
}