Fixed display of bottom captions in chart view with long date strings.

This commit is contained in:
23rd
2023-12-06 22:28:57 +03:00
committed by John Preston
parent 59099a8d46
commit 1a856e359f
4 changed files with 17 additions and 6 deletions
@@ -107,7 +107,8 @@ void PaintBottomLine(
startXIndex,
xPercentageLimits.max);
const auto edgeAlphaSize = st::statisticsChartBottomCaptionMaxWidth / 4.;
const auto captionMaxWidth = chartData.dayStringMaxWidth;
const auto edgeAlphaSize = captionMaxWidth / 4.;
for (auto k = 0; k < dates.size(); k++) {
const auto &date = dates[k];
@@ -145,9 +146,9 @@ void PaintBottomLine(
/ float64(chartData.x.back() - chartData.x.front());
const auto xPoint = xPercentage * fullWidth - offset;
const auto r = QRectF(
xPoint - st::statisticsChartBottomCaptionMaxWidth / 2.,
xPoint - captionMaxWidth / 2.,
y,
st::statisticsChartBottomCaptionMaxWidth,
captionMaxWidth,
st::statisticsChartBottomCaptionHeight);
const auto edgeAlpha = (r.x() < 0)
? std::max(
@@ -1018,7 +1019,7 @@ void ChartWidget::updateBottomDates() {
const auto by = int(_chartArea->width() / float64(_chartData.x.size()));
_bottomLine.captionIndicesOffset = 0
+ st::statisticsChartBottomCaptionMaxWidth / std::max(by, 1);
+ _chartData.dayStringMaxWidth / std::max(by, 1);
const auto isCurrentNull = (_bottomLine.current.stepMinFast == 0);
if (!isCurrentNull
@@ -37,8 +37,6 @@ statisticsChartRulerCaptionSkip: 4px;
statisticsChartBottomCaptionHeight: 15px;
statisticsChartBottomCaptionSkip: 6px;
statisticsChartBottomCaptionMaxWidth: 44px;
statisticsChartFlatCheckboxMargins: margins(4px, 3px, 4px, 5px);
statisticsChartFlatCheckboxCheckWidth: 3px;
statisticsChartFlatCheckboxShrinkkWidth: 4px;