0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 16:44:39 +03:00

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 { } else {
axisData->update(); axisData->update();
} }
m_chartItem->update();
close(); close();
} }

View File

@ -1177,7 +1177,12 @@ QString AbstractSeriesChart::axisLabel(int i, const AxisData &axisData)
{ {
const qreal min = axisData.rangeMin(); const qreal min = axisData.rangeMin();
const qreal step = axisData.step(); 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) { if (std::floor(step) == step) {
return QString::number(value); return QString::number(value);
} }