mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-10-01 11:40:02 +03:00
Fix position calculation
This commit is contained in:
@@ -70,7 +70,12 @@ void LinesChart::drawDesignMode(QPainter* painter, qreal hStep, qreal vStep, qre
|
||||
|
||||
qreal LinesChart::calculatePos(const AxisData &data, qreal value, qreal rectSize) const
|
||||
{
|
||||
return (data.rangeMax() - value) / data.delta() * rectSize;
|
||||
if (data.reverseDirection() && data.rangeMin() >= 0) {
|
||||
// Not flipping for minimum less than 0 because lower number is at the bottom.
|
||||
return (1 - (data.rangeMax() - value) / data.delta()) * rectSize;
|
||||
} else {
|
||||
return (data.rangeMax() - value) / data.delta() * rectSize;
|
||||
}
|
||||
}
|
||||
|
||||
void LinesChart::paintSeries(QPainter *painter, SeriesItem *series, QRectF barsRect)
|
||||
|
@@ -798,16 +798,17 @@ AxisData &AbstractSeriesChart::yAxisData() const
|
||||
|
||||
void AbstractSeriesChart::updateMinAndMaxValues()
|
||||
{
|
||||
qreal maxYValue = 0;
|
||||
qreal minYValue = 0;
|
||||
qreal maxXValue = 0;
|
||||
qreal minXValue = 0;
|
||||
if (m_chartItem->itemMode() == DesignMode) {
|
||||
m_chartItem->xAxisData()->updateForDesignMode();
|
||||
m_chartItem->yAxisData()->updateForDesignMode();
|
||||
return;
|
||||
}
|
||||
|
||||
qreal maxYValue = 0;
|
||||
qreal minYValue = 0;
|
||||
qreal maxXValue = 0;
|
||||
qreal minXValue = 0;
|
||||
|
||||
for (SeriesItem* series : m_chartItem->series()){
|
||||
for (qreal value : series->data()->values()){
|
||||
minYValue = std::min(minYValue, value);
|
||||
|
Reference in New Issue
Block a user