mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Fix diagram size when legend is showed
This commit is contained in:
parent
b14f0be7bc
commit
f03ccdd23b
@ -91,7 +91,6 @@ void PieChart::paintChart(QPainter *painter, QRectF chartRect)
|
||||
|
||||
void PieChart::paintChartLegend(QPainter *painter, QRectF legendRect)
|
||||
{
|
||||
// TODO_ES Fix bottom legend when axis is at the bottom
|
||||
prepareLegendToPaint(legendRect, painter);
|
||||
|
||||
int indicatorSize = painter->fontMetrics().height()/2;
|
||||
|
@ -197,28 +197,25 @@ void ChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
|
||||
const QRectF titleRect = QRectF(borderMargin,borderMargin,rect().width()-borderMargin*2,titleOffset);
|
||||
QRectF legendRect = QRectF(0, 0, 0, 0);
|
||||
QRectF diagramRect = QRectF(0, 0, 0, 0);
|
||||
QRectF diagramRect = rect().adjusted(borderMargin, titleOffset + borderMargin,
|
||||
-(borderMargin * 2), -borderMargin);
|
||||
if (m_showLegend) {
|
||||
legendRect = m_chart->calcChartLegendRect(painter->font(), rect(), false, borderMargin, titleOffset);
|
||||
switch(legendAlign()) {
|
||||
case LegendAlignRightTop:
|
||||
case LegendAlignRightBottom:
|
||||
case LegendAlignRightCenter:
|
||||
diagramRect = rect().adjusted(borderMargin, titleOffset + borderMargin,
|
||||
-(legendRect.width() + borderMargin * 2), -borderMargin);
|
||||
diagramRect.adjust(0, 0, -legendRect.width(), 0);
|
||||
break;
|
||||
case LegendAlignBottomLeft:
|
||||
case LegendAlignBottomCenter:
|
||||
case LegendAlignBottomRight:
|
||||
diagramRect = rect().adjusted(borderMargin, titleOffset + borderMargin,
|
||||
(borderMargin * 2), -legendRect.height());
|
||||
diagramRect.adjust(0, 0, 0, -(legendRect.height() + borderMargin * 2));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
diagramRect = rect().adjusted(borderMargin, titleOffset + borderMargin,
|
||||
-(borderMargin * 2), -borderMargin);
|
||||
}
|
||||
|
||||
painter->fillRect(diagramRect, Qt::yellow);
|
||||
paintChartTitle(painter, titleRect);
|
||||
if (m_showLegend)
|
||||
m_chart->paintChartLegend(painter,legendRect);
|
||||
|
Loading…
Reference in New Issue
Block a user