Skip to content

Commit

Permalink
Fix last hour being rendered weirdly in forecasts
Browse files Browse the repository at this point in the history
  • Loading branch information
the-codeboy committed Aug 20, 2023
1 parent 1b9d99e commit 19072bc
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/main/java/ml/codeboy/thebot/WeatherUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static BufferedImage generateForecastImage(List<Forecast> forecasts, int
}

Forecast last = null;
for (int i = 0; i < values; i++) {
for (int i = 0; i <= values; i++) {
Forecast forecast = forecasts.get(i);

double lastTemp = forecast.getAirTemperature();
Expand All @@ -59,18 +59,6 @@ public static BufferedImage generateForecastImage(List<Forecast> forecasts, int

g.fillPolygon(new int[]{startX, endX, endX, startX}, new int[]{startY, endY, image.getHeight(), image.getHeight()}, 4);

if (i == values - 1) {
g.setColor(Color.ORANGE);
startX += (size + space);
endX += (size + space);

g.drawLine(startX, endY, endX, endY);

g.setColor(transparentYellow);

g.fillPolygon(new int[]{startX, endX, endX, startX}, new int[]{endY, endY, image.getHeight(), image.getHeight()}, 4);
}

g.setColor(Color.BLACK);
int x = i * (size + space) - space / 2;
if (i != 0)
Expand Down

0 comments on commit 19072bc

Please sign in to comment.