1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-08-18 18:32:30 +02:00

Merge pull request #235 from Scorgan01/master

Fix vertical time axis label in graphical charts
This commit is contained in:
Norbert Walter
2026-04-09 22:23:22 +02:00
committed by GitHub
+3 -2
View File
@@ -476,11 +476,11 @@ void Chart::drawChrtTimeAxis(const char chrtDir, const int8_t chrtSz, const int8
intv = 60; // print axis label each 60 pixels = seconds intv = 60; // print axis label each 60 pixels = seconds
axSlots = timAxis / intv; // number of axis labels; value will be truncated to full number axSlots = timAxis / intv; // number of axis labels; value will be truncated to full number
i = axSlots * chrtIntv * -1; // current minute label
if (chrtDir == HORIZONTAL) { if (chrtDir == HORIZONTAL) {
getdisplay().fillRect(0, cRoot.y, dWidth, 2, fgColor); getdisplay().fillRect(0, cRoot.y, dWidth, 2, fgColor);
i = axSlots * chrtIntv * -1; // current minute label
// LOG_DEBUG(GwLog::DEBUG, "Chart::drawChrtTimeAxis: intv: %d, axSlots: %d, timAxis: %d, chrtIntv: %d", intv, axSlots, timAxis, chrtIntv); // LOG_DEBUG(GwLog::DEBUG, "Chart::drawChrtTimeAxis: intv: %d, axSlots: %d, timAxis: %d, chrtIntv: %d", intv, axSlots, timAxis, chrtIntv);
for (int j = intv; j < timAxis - 1; j += intv) { // fill time axis with values but keep area free on right hand side for value label for (int j = intv; j < timAxis - 1; j += intv) { // fill time axis with values but keep area free on right hand side for value label
@@ -495,6 +495,7 @@ void Chart::drawChrtTimeAxis(const char chrtDir, const int8_t chrtSz, const int8
} else { // vertical chart } else { // vertical chart
i = chrtIntv * -1; // current minute label
for (float j = intv; j < timAxis - 1; j += intv) { // don't print time label at upper and lower end of time axis for (float j = intv; j < timAxis - 1; j += intv) { // don't print time label at upper and lower end of time axis
snprintf(sTime, sizeof(sTime), "%d", i); snprintf(sTime, sizeof(sTime), "%d", i);
@@ -507,7 +508,7 @@ void Chart::drawChrtTimeAxis(const char chrtDir, const int8_t chrtSz, const int8
} else if (chrtSz == HALF_SIZE_RIGHT) { // half size chart; right side } else if (chrtSz == HALF_SIZE_RIGHT) { // half size chart; right side
drawTextCenter(dWidth / 2, cRoot.y + j, sTime); // time value; print mid screen drawTextCenter(dWidth / 2, cRoot.y + j, sTime); // time value; print mid screen
} }
i += chrtIntv; i -= chrtIntv;
} }
} }
} }