0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

Fix text offset for vertical lines

This commit is contained in:
Emil Sawicki 2022-01-21 08:14:21 +01:00
parent dfa378970f
commit 096336ed40

View File

@ -720,11 +720,12 @@ void AbstractSeriesChart::paintVerticalGrid(QPainter *painter, QRectF gridRect)
const qreal valuesHMargin = this->valuesHMargin(painter); const qreal valuesHMargin = this->valuesHMargin(painter);
const int fontHeight = painter->fontMetrics().height(); const int fontHeight = painter->fontMetrics().height();
const int halfFontHeight = fontHeight / 2; const int halfFontHeight = fontHeight / 2;
const qreal textPositionOffset = valuesHMargin * 0.2;
const QTextOption verticalTextOption(Qt::AlignRight); const QTextOption verticalTextOption(Qt::AlignRight);
for (int i = 0 ; i < lineCount ; i++ ) { for (int i = 0 ; i < lineCount ; i++ ) {
const qreal y = vStep * i; const qreal y = vStep * i;
painter->drawText(QRectF(gridRect.bottomLeft()-QPointF(fontHeight,y+halfFontHeight), painter->drawText(QRectF(gridRect.bottomLeft()-QPointF(textPositionOffset,y+halfFontHeight),
QSizeF(valuesHMargin,fontHeight)), QSizeF(valuesHMargin,fontHeight)),
verticalLabel(i, yAxisData.step(), yAxisData.rangeMin()), verticalLabel(i, yAxisData.step(), yAxisData.rangeMin()),
verticalTextOption); verticalTextOption);