mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20: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)
|
void PieChart::paintChartLegend(QPainter *painter, QRectF legendRect)
|
||||||
{
|
{
|
||||||
// TODO_ES Fix bottom legend when axis is at the bottom
|
|
||||||
prepareLegendToPaint(legendRect, painter);
|
prepareLegendToPaint(legendRect, painter);
|
||||||
|
|
||||||
int indicatorSize = painter->fontMetrics().height()/2;
|
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);
|
const QRectF titleRect = QRectF(borderMargin,borderMargin,rect().width()-borderMargin*2,titleOffset);
|
||||||
QRectF legendRect = QRectF(0, 0, 0, 0);
|
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) {
|
if (m_showLegend) {
|
||||||
legendRect = m_chart->calcChartLegendRect(painter->font(), rect(), false, borderMargin, titleOffset);
|
legendRect = m_chart->calcChartLegendRect(painter->font(), rect(), false, borderMargin, titleOffset);
|
||||||
switch(legendAlign()) {
|
switch(legendAlign()) {
|
||||||
case LegendAlignRightTop:
|
case LegendAlignRightTop:
|
||||||
case LegendAlignRightBottom:
|
case LegendAlignRightBottom:
|
||||||
case LegendAlignRightCenter:
|
case LegendAlignRightCenter:
|
||||||
diagramRect = rect().adjusted(borderMargin, titleOffset + borderMargin,
|
diagramRect.adjust(0, 0, -legendRect.width(), 0);
|
||||||
-(legendRect.width() + borderMargin * 2), -borderMargin);
|
|
||||||
break;
|
break;
|
||||||
case LegendAlignBottomLeft:
|
case LegendAlignBottomLeft:
|
||||||
case LegendAlignBottomCenter:
|
case LegendAlignBottomCenter:
|
||||||
case LegendAlignBottomRight:
|
case LegendAlignBottomRight:
|
||||||
diagramRect = rect().adjusted(borderMargin, titleOffset + borderMargin,
|
diagramRect.adjust(0, 0, 0, -(legendRect.height() + borderMargin * 2));
|
||||||
(borderMargin * 2), -legendRect.height());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
diagramRect = rect().adjusted(borderMargin, titleOffset + borderMargin,
|
|
||||||
-(borderMargin * 2), -borderMargin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
painter->fillRect(diagramRect, Qt::yellow);
|
||||||
paintChartTitle(painter, titleRect);
|
paintChartTitle(painter, titleRect);
|
||||||
if (m_showLegend)
|
if (m_showLegend)
|
||||||
m_chart->paintChartLegend(painter,legendRect);
|
m_chart->paintChartLegend(painter,legendRect);
|
||||||
|
Loading…
Reference in New Issue
Block a user