Fixed paint of zoomed footer in stack linear chart view.
This commit is contained in:
parent
9046daa1a6
commit
5a2b8d06e3
|
@ -494,7 +494,7 @@ void StackLinearChartView::paintChartOrZoomAnimation(
|
||||||
auto o = ScopedPainterOpacity(p, progress);
|
auto o = ScopedPainterOpacity(p, progress);
|
||||||
paintPieText(p, c);
|
paintPieText(p, c);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (_transition.progress) {
|
||||||
paintZoomedFooter(p, c);
|
paintZoomedFooter(p, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,14 +585,12 @@ void StackLinearChartView::paintZoomedFooter(
|
||||||
auto o = ScopedPainterOpacity(p, _transition.progress);
|
auto o = ScopedPainterOpacity(p, _transition.progress);
|
||||||
auto hq = PainterHighQualityEnabler(p);
|
auto hq = PainterHighQualityEnabler(p);
|
||||||
const auto &[zoomedStart, zoomedEnd] = _transition.zoomedInLimitXIndices;
|
const auto &[zoomedStart, zoomedEnd] = _transition.zoomedInLimitXIndices;
|
||||||
const auto &[leftStart, w] = ComputeLeftStartAndStep(
|
const auto sideW = st::statisticsChartFooterSideWidth;
|
||||||
c.chartData,
|
const auto width = c.rect.width() - sideW * 2.;
|
||||||
{
|
const auto leftStart = c.rect.x() + sideW;
|
||||||
c.chartData.xPercentage[zoomedStart],
|
const auto &xPercentage = c.chartData.xPercentage;
|
||||||
c.chartData.xPercentage[zoomedEnd],
|
auto previousX = leftStart;
|
||||||
},
|
const auto offset = (xPercentage[zoomedEnd] == 1.) ? 0 : 1;
|
||||||
c.rect,
|
|
||||||
zoomedStart);
|
|
||||||
for (auto i = zoomedStart; i <= zoomedEnd; i++) {
|
for (auto i = zoomedStart; i <= zoomedEnd; i++) {
|
||||||
auto sum = 0.;
|
auto sum = 0.;
|
||||||
auto lastEnabledId = int(0);
|
auto lastEnabledId = int(0);
|
||||||
|
@ -604,6 +602,18 @@ void StackLinearChartView::paintZoomedFooter(
|
||||||
lastEnabledId = line.id;
|
lastEnabledId = line.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto columnMargins = QMarginsF(
|
||||||
|
(i == zoomedStart) ? sideW : 0,
|
||||||
|
0,
|
||||||
|
(i == zoomedEnd - offset) ? sideW : 0,
|
||||||
|
0);
|
||||||
|
|
||||||
|
const auto next = std::clamp(i + offset, zoomedStart, zoomedEnd);
|
||||||
|
const auto xPointPercentage =
|
||||||
|
(xPercentage[next] - xPercentage[zoomedStart])
|
||||||
|
/ (xPercentage[zoomedEnd] - xPercentage[zoomedStart]);
|
||||||
|
const auto xPoint = leftStart + width * xPointPercentage;
|
||||||
|
|
||||||
auto stack = 0.;
|
auto stack = 0.;
|
||||||
for (auto k = int(c.chartData.lines.size() - 1); k >= 0; k--) {
|
for (auto k = int(c.chartData.lines.size() - 1); k >= 0; k--) {
|
||||||
const auto &line = c.chartData.lines[k];
|
const auto &line = c.chartData.lines[k];
|
||||||
|
@ -615,16 +625,17 @@ void StackLinearChartView::paintZoomedFooter(
|
||||||
? c.rect.height()
|
? c.rect.height()
|
||||||
: visibleHeight;
|
: visibleHeight;
|
||||||
|
|
||||||
const auto column = QRectF(
|
const auto column = columnMargins + QRectF(
|
||||||
leftStart + (i - zoomedStart) * w,
|
previousX,
|
||||||
stack,
|
stack,
|
||||||
w,
|
xPoint - previousX,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.fillRect(column, line.color);
|
p.fillRect(column, line.color);
|
||||||
stack += visibleHeight;
|
stack += visibleHeight;
|
||||||
}
|
}
|
||||||
|
previousX = xPoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue