Add type for axis data for corner cases

This commit is contained in:
Emil Sawicki
2022-03-13 22:49:39 +01:00
parent e7a301c8b6
commit c45aef0efd
4 changed files with 22 additions and 9 deletions

View File

@@ -70,7 +70,7 @@ void LinesChart::drawDesignMode(QPainter* painter, qreal hStep, qreal vStep, qre
qreal LinesChart::calculatePos(const AxisData &data, qreal value, qreal rectSize) const
{
if (data.reverseDirection() && data.rangeMin() >= 0) {
if (data.type() == AxisData::XAxis || (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 {