1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-28 17:24:47 +01:00

Variable padding for finance graph Y axis labels (#22498)

Also fixes overflows during plotting
This commit is contained in:
mrmbernardi
2024-08-11 19:35:00 +10:00
committed by GitHub
parent e2551821f3
commit c7159aa81e
2 changed files with 94 additions and 84 deletions

View File

@@ -75,8 +75,8 @@ namespace OpenRCT2::Graph
DrawPixelInfo& dpi, const T value, const int32_t hoverIdx, const ScreenRect& bounds, const int32_t xStep,
const T minValue, const T maxValue, const_utf8string text, ColourWithFlags textCol)
{
const int32_t screenRange = bounds.GetHeight();
const int32_t valueRange = maxValue - minValue;
const T screenRange = bounds.GetHeight();
const T valueRange = maxValue - minValue;
const int32_t yPosition = bounds.GetBottom() - ((value - minValue) * screenRange) / valueRange;
ScreenCoordsXY coords = { bounds.GetRight() - hoverIdx * xStep, yPosition };
@@ -103,8 +103,8 @@ namespace OpenRCT2::Graph
DrawPixelInfo& dpi, const T* series, const int32_t count, const ScreenRect& bounds, const int32_t xStep,
const T minValue, const T maxValue)
{
const int32_t screenRange = bounds.GetHeight();
const int32_t valueRange = maxValue - minValue;
const T screenRange = bounds.GetHeight();
const T valueRange = maxValue - minValue;
ScreenCoordsXY lastCoords;
bool lastCoordsValid = false;