Fixed reversing y axis

This commit is contained in:
Emil Sawicki 2022-03-13 11:13:22 +01:00
parent 55c5e577fb
commit e7a301c8b6
2 changed files with 7 additions and 1 deletions

View File

@ -115,6 +115,7 @@ void ChartAxisEditor::on_pushButtonOk_clicked()
} else {
axisData->update();
}
m_chartItem->update();
close();
}

View File

@ -1177,7 +1177,12 @@ QString AbstractSeriesChart::axisLabel(int i, const AxisData &axisData)
{
const qreal min = axisData.rangeMin();
const qreal step = axisData.step();
qreal value = min + i * step;
qreal value = 0;
if (axisData.reverseDirection() && min >= 0) {
value = min + (axisData.segmentCount() - i) * step;
} else {
value = min + i * step;
}
if (std::floor(step) == step) {
return QString::number(value);
}