Completed graphing
This commit is contained in:
Binary file not shown.
@@ -9,6 +9,7 @@ import java.awt.Font;
|
|||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.GradientPaint;
|
import java.awt.GradientPaint;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.Transparency;
|
import java.awt.Transparency;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -40,6 +41,10 @@ public class HourlyForecastDisplay implements Display {
|
|||||||
private int ticksBeforeChange = 200;
|
private int ticksBeforeChange = 200;
|
||||||
private int animationTicks = -1;
|
private int animationTicks = -1;
|
||||||
|
|
||||||
|
private byte[] dewval = null;
|
||||||
|
private byte[] tempval = null;
|
||||||
|
private float[] percipval = null;
|
||||||
|
|
||||||
DateFormat simpleDateFormat = new SimpleDateFormat("ha");
|
DateFormat simpleDateFormat = new SimpleDateFormat("ha");
|
||||||
|
|
||||||
public HourlyForecastDisplay() {
|
public HourlyForecastDisplay() {
|
||||||
@@ -52,6 +57,26 @@ public class HourlyForecastDisplay implements Display {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGraphValues(TownForecast town) {
|
||||||
|
if (town != null)
|
||||||
|
{
|
||||||
|
HourlyForecast[] forecast = town.getHourlyForecast();
|
||||||
|
if (forecast != null && forecast.length > 0)
|
||||||
|
{
|
||||||
|
int size = Math.min(12, forecast.length);
|
||||||
|
dewval = new byte[size];
|
||||||
|
tempval = new byte[size];
|
||||||
|
percipval = new float[size];
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
dewval[i] = forecast[i].dewPoint;
|
||||||
|
tempval[i] = forecast[i].temp;
|
||||||
|
percipval[i] = forecast[i].percip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initDisplay(RenderPanel renderer, ForecastProvider forecastProvider, long ticks, int iconTicks) {
|
public void initDisplay(RenderPanel renderer, ForecastProvider forecastProvider, long ticks, int iconTicks) {
|
||||||
this.details = forecastProvider != null ? forecastProvider.getForecast() : null;
|
this.details = forecastProvider != null ? forecastProvider.getForecast() : null;
|
||||||
@@ -63,6 +88,7 @@ public class HourlyForecastDisplay implements Display {
|
|||||||
townIndex = 0;
|
townIndex = 0;
|
||||||
currentTown = details.getTownForecast()[townIndex];
|
currentTown = details.getTownForecast()[townIndex];
|
||||||
renderer.setCurrentTown(currentTown.getTownName());
|
renderer.setCurrentTown(currentTown.getTownName());
|
||||||
|
setGraphValues(currentTown);
|
||||||
}
|
}
|
||||||
redrawRegionlost(renderer);
|
redrawRegionlost(renderer);
|
||||||
}
|
}
|
||||||
@@ -121,9 +147,14 @@ public class HourlyForecastDisplay implements Display {
|
|||||||
int min = minTemp(forecast);
|
int min = minTemp(forecast);
|
||||||
int max = maxTemp(forecast);
|
int max = maxTemp(forecast);
|
||||||
|
|
||||||
float range = Math.abs(min)+Math.abs(max);
|
int range = max-min;
|
||||||
|
|
||||||
|
|
||||||
|
if (range == 0)
|
||||||
|
{
|
||||||
|
min -= 1;
|
||||||
|
max += 1;
|
||||||
|
range = 2;
|
||||||
|
}
|
||||||
|
|
||||||
g2d.setPaint(new GradientPaint(0, RenderConstants.TOPBAR_HEIGHT + 40, RenderConstants.BG_ORANGE, 0, RenderConstants.MAINBAR_HEIGHT, RenderConstants.BG_PURPLE));
|
g2d.setPaint(new GradientPaint(0, RenderConstants.TOPBAR_HEIGHT + 40, RenderConstants.BG_ORANGE, 0, RenderConstants.MAINBAR_HEIGHT, RenderConstants.BG_PURPLE));
|
||||||
g2d.fillRect(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + 40, RenderConstants.W - RenderConstants.SIDE_OFFSET * 2 - 60, RenderConstants.MAINBAR_HEIGHT - 124);
|
g2d.fillRect(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + 40, RenderConstants.W - RenderConstants.SIDE_OFFSET * 2 - 60, RenderConstants.MAINBAR_HEIGHT - 124);
|
||||||
@@ -143,18 +174,12 @@ public class HourlyForecastDisplay implements Display {
|
|||||||
DrawingUtil.drawOutlinedString(g2d, 260, RenderConstants.TOPBAR_HEIGHT + 35, "Dew point\u00B0c", Color.WHITE, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, 260, RenderConstants.TOPBAR_HEIGHT + 35, "Dew point\u00B0c", Color.WHITE, Color.BLACK, 2);
|
||||||
DrawingUtil.drawOutlinedString(g2d, 410, RenderConstants.TOPBAR_HEIGHT + 35, "Precipitation%", Color.CYAN, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, 410, RenderConstants.TOPBAR_HEIGHT + 35, "Precipitation%", Color.CYAN, Color.BLACK, 2);
|
||||||
|
|
||||||
|
|
||||||
String minText = min + "\u00B0";
|
String minText = min + "\u00B0";
|
||||||
String maxText = max + "\u00B0";
|
String maxText = max + "\u00B0";
|
||||||
|
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 - fm.stringWidth(maxText), RenderConstants.TOPBAR_HEIGHT + 53, maxText, Color.YELLOW, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 - fm.stringWidth(maxText), RenderConstants.TOPBAR_HEIGHT + 53, maxText, Color.YELLOW, Color.BLACK, 2);
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 - fm.stringWidth(minText), RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 92, minText, Color.YELLOW, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 - fm.stringWidth(minText), RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 92, minText, Color.YELLOW, Color.BLACK, 2);
|
||||||
|
|
||||||
int slotWidth = (RenderConstants.W - RenderConstants.SIDE_OFFSET * 2 - 60) / 12;
|
|
||||||
|
|
||||||
int lastDewpoint = 0;
|
|
||||||
int lastTemperature = 0;
|
|
||||||
int lastPercip = 0;
|
|
||||||
|
|
||||||
g2d.setColor(RenderConstants.BG_ORANGE.darker());
|
g2d.setColor(RenderConstants.BG_ORANGE.darker());
|
||||||
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40, (RenderConstants.TOPBAR_HEIGHT + 50), (RenderConstants.W - RenderConstants.SIDE_OFFSET - 20), (RenderConstants.TOPBAR_HEIGHT + 50));
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40, (RenderConstants.TOPBAR_HEIGHT + 50), (RenderConstants.W - RenderConstants.SIDE_OFFSET - 20), (RenderConstants.TOPBAR_HEIGHT + 50));
|
||||||
@@ -163,9 +188,51 @@ public class HourlyForecastDisplay implements Display {
|
|||||||
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + 50 + RenderConstants.MAINBAR_HEIGHT - 144, (RenderConstants.W - RenderConstants.SIDE_OFFSET - 20), RenderConstants.TOPBAR_HEIGHT + 50 + RenderConstants.MAINBAR_HEIGHT - 144);
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + 50 + RenderConstants.MAINBAR_HEIGHT - 144, (RenderConstants.W - RenderConstants.SIDE_OFFSET - 20), RenderConstants.TOPBAR_HEIGHT + 50 + RenderConstants.MAINBAR_HEIGHT - 144);
|
||||||
|
|
||||||
//BlackLines
|
//BlackLines
|
||||||
|
|
||||||
|
if(max > 0 && min < 0)
|
||||||
|
{
|
||||||
|
int nextTemp = (RenderConstants.TOPBAR_HEIGHT + RenderConstants.MAINBAR_HEIGHT - 94) + (int) (((min) / (float)range) * (RenderConstants.MAINBAR_HEIGHT - 144));
|
||||||
|
g2d.setColor(Color.LIGHT_GRAY);
|
||||||
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40, nextTemp, RenderConstants.W - RenderConstants.SIDE_OFFSET - 20, nextTemp);
|
||||||
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 - fm.stringWidth("0\u00B0"), nextTemp+4, "0\u00B0", Color.YELLOW, Color.BLACK, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int slotWidth = (RenderConstants.W - RenderConstants.SIDE_OFFSET * 2 - 60) / 12;
|
||||||
|
|
||||||
g2d.setClip(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + 40, RenderConstants.W - RenderConstants.SIDE_OFFSET * 2 - 60, RenderConstants.MAINBAR_HEIGHT - 124);
|
g2d.setClip(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + 40, RenderConstants.W - RenderConstants.SIDE_OFFSET * 2 - 60, RenderConstants.MAINBAR_HEIGHT - 124);
|
||||||
g2d.setStroke(new BasicStroke(2));
|
|
||||||
|
g2d.translate(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + RenderConstants.MAINBAR_HEIGHT - 94);
|
||||||
|
|
||||||
|
g2d.translate(2, 2);
|
||||||
g2d.setColor(Color.BLACK);
|
g2d.setColor(Color.BLACK);
|
||||||
|
this.graphTemp(g2d, this.dewval, min, slotWidth, range, RenderConstants.MAINBAR_HEIGHT - 144);
|
||||||
|
g2d.setColor(Color.WHITE);
|
||||||
|
g2d.translate(-2, -2);
|
||||||
|
this.graphTemp(g2d, this.dewval, min, slotWidth, range, RenderConstants.MAINBAR_HEIGHT - 144);
|
||||||
|
|
||||||
|
g2d.translate(2, 2);
|
||||||
|
g2d.setColor(Color.BLACK);
|
||||||
|
this.graphPercent(g2d, this.percipval, slotWidth, 100F, RenderConstants.MAINBAR_HEIGHT - 144);
|
||||||
|
g2d.setColor(Color.CYAN);
|
||||||
|
g2d.translate(-2, -2);
|
||||||
|
this.graphPercent(g2d, this.percipval, slotWidth, 100F, RenderConstants.MAINBAR_HEIGHT - 144);
|
||||||
|
|
||||||
|
g2d.translate(2, 2);
|
||||||
|
g2d.setColor(Color.BLACK);
|
||||||
|
this.graphTemp(g2d, this.tempval, min, slotWidth, range, RenderConstants.MAINBAR_HEIGHT - 144);
|
||||||
|
g2d.setColor(Color.RED);
|
||||||
|
g2d.translate(-2, -2);
|
||||||
|
this.graphTemp(g2d, this.tempval, min, slotWidth, range, RenderConstants.MAINBAR_HEIGHT - 144);
|
||||||
|
|
||||||
|
g2d.translate(- RenderConstants.SIDE_OFFSET - 40, 94 - RenderConstants.TOPBAR_HEIGHT - RenderConstants.MAINBAR_HEIGHT);
|
||||||
|
|
||||||
|
g2d.setClip(null);
|
||||||
|
|
||||||
|
|
||||||
|
/*g2d.setStroke(new BasicStroke(2));
|
||||||
|
g2d.setColor(Color.BLACK);
|
||||||
|
|
||||||
|
//This is so ugly
|
||||||
for (int i = 0; i < Math.min(12, forecast.length); i++)
|
for (int i = 0; i < Math.min(12, forecast.length); i++)
|
||||||
{
|
{
|
||||||
int nextDewpoint = (RenderConstants.TOPBAR_HEIGHT + 50) + (RenderConstants.MAINBAR_HEIGHT - 144) - (int) (((max - forecast[i].dewPoint) / range) * (RenderConstants.MAINBAR_HEIGHT - 144));
|
int nextDewpoint = (RenderConstants.TOPBAR_HEIGHT + 50) + (RenderConstants.MAINBAR_HEIGHT - 144) - (int) (((max - forecast[i].dewPoint) / range) * (RenderConstants.MAINBAR_HEIGHT - 144));
|
||||||
@@ -177,14 +244,14 @@ public class HourlyForecastDisplay implements Display {
|
|||||||
lastTemperature = nextTemperature;
|
lastTemperature = nextTemperature;
|
||||||
lastPercip = nextPercip;
|
lastPercip = nextPercip;
|
||||||
}
|
}
|
||||||
g2d.drawLine(RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i-1))+1, lastDewpoint+2, RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*i)+2, nextDewpoint+2);
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i - 1)) + 2, lastDewpoint + 2, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * i) + 2, nextDewpoint + 2);
|
||||||
g2d.drawLine(RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i-1))+1, lastPercip+2, RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*i)+2, nextPercip+2);
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i - 1)) + 2, lastPercip + 2, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * i) + 2, nextPercip + 2);
|
||||||
g2d.drawLine(RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i-1))+1, lastTemperature+2, RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*i)+2, nextTemperature+2);
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i - 1)) + 2, lastTemperature + 2, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * i) + 2, nextTemperature + 2);
|
||||||
if (i == Math.min(12, forecast.length) - 1)
|
if (i == Math.min(12, forecast.length) - 1)
|
||||||
{
|
{
|
||||||
g2d.drawLine(RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i)), nextDewpoint+2, RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i+2)), nextDewpoint+2);
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i)) + 2, nextDewpoint + 2, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i + 2)) + 2, nextDewpoint + 2);
|
||||||
g2d.drawLine(RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i)), nextPercip+2, RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i+2)), nextPercip+2);
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i)) + 2, nextPercip + 2, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i + 2)) + 2, nextPercip + 2);
|
||||||
g2d.drawLine(RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i)), nextTemperature+2, RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*(i+2)), nextTemperature+2);
|
g2d.drawLine(RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i)) + 2, nextTemperature + 2, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * (i + 2)) + 2, nextTemperature + 2);
|
||||||
}
|
}
|
||||||
lastPercip = nextPercip;
|
lastPercip = nextPercip;
|
||||||
lastTemperature = nextTemperature;
|
lastTemperature = nextTemperature;
|
||||||
@@ -229,15 +296,81 @@ public class HourlyForecastDisplay implements Display {
|
|||||||
String timeString = simpleDateFormat.format(forecast[i].hour);
|
String timeString = simpleDateFormat.format(forecast[i].hour);
|
||||||
if ((i % 2) == 0)
|
if ((i % 2) == 0)
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * i) - fm.stringWidth(timeString) / 2, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 70, timeString, Color.YELLOW, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * i) - fm.stringWidth(timeString) / 2, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 70, timeString, Color.YELLOW, Color.BLACK, 2);
|
||||||
else
|
else DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * i) - fm.stringWidth(timeString) / 2, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 60, timeString, Color.YELLOW, Color.BLACK, 2);
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET+40+slotWidth/2+(slotWidth*i)-fm.stringWidth(timeString)/2, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 60, timeString, Color.YELLOW, Color.BLACK, 2);
|
|
||||||
|
|
||||||
IconProvider.drawIcon(g2d, IconProvider.INDEXED_ICONS[forecast[i].iconId], RenderConstants.SIDE_OFFSET + 45 + i * slotWidth, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 55, slotWidth - 10, iconTicks);
|
IconProvider.drawIcon(g2d, IconProvider.INDEXED_ICONS[forecast[i].iconId], RenderConstants.SIDE_OFFSET + 45 + i * slotWidth, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 55, slotWidth - 10, iconTicks);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
g2d.setStroke(new BasicStroke(2));
|
g2d.setStroke(new BasicStroke(2));
|
||||||
g2d.setColor(Color.BLACK);
|
g2d.setColor(Color.BLACK);
|
||||||
g2d.drawRect(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + 40, RenderConstants.W - RenderConstants.SIDE_OFFSET * 2 - 60, RenderConstants.MAINBAR_HEIGHT - 124);
|
g2d.drawRect(RenderConstants.SIDE_OFFSET + 40, RenderConstants.TOPBAR_HEIGHT + 40, RenderConstants.W - RenderConstants.SIDE_OFFSET * 2 - 60, RenderConstants.MAINBAR_HEIGHT - 124);
|
||||||
|
|
||||||
|
for (int i = 0; i < Math.min(12, forecast.length); i++)
|
||||||
|
{
|
||||||
|
String timeString = simpleDateFormat.format(forecast[i].hour);
|
||||||
|
if ((i % 2) == 0)
|
||||||
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * i) - fm.stringWidth(timeString) / 2, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 70, timeString, Color.YELLOW, Color.BLACK, 2);
|
||||||
|
else DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + 40 + slotWidth / 2 + (slotWidth * i) - fm.stringWidth(timeString) / 2, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 60, timeString, Color.YELLOW, Color.BLACK, 2);
|
||||||
|
|
||||||
|
IconProvider.drawIcon(g2d, IconProvider.INDEXED_ICONS[forecast[i].iconId], RenderConstants.SIDE_OFFSET + 45 + i * slotWidth, RenderConstants.TOPBAR_HEIGHT + MAINBAR_HEIGHT - 55, slotWidth - 10, iconTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void graphTemp(Graphics2D g2d, byte[] tempVal, int min, int slotWidth, float range, float multiplier) {
|
||||||
|
int lastTemp = ValueCheck.NO_DATA_INT;
|
||||||
|
for (int i = 0; i < tempVal.length; i++)
|
||||||
|
{
|
||||||
|
if (ValueCheck.valueNoData(tempVal[i]))
|
||||||
|
{
|
||||||
|
lastTemp = ValueCheck.NO_DATA_INT;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int nextTemp = -(int) (((tempVal[i]-min) / range) * multiplier);
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
lastTemp = nextTemp;
|
||||||
|
}
|
||||||
|
if (ValueCheck.valueNoData(lastTemp))
|
||||||
|
{
|
||||||
|
lastTemp = nextTemp;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
g2d.drawLine(slotWidth / 2 + (slotWidth * (i - 1)), lastTemp, slotWidth / 2 + (slotWidth * i), nextTemp);
|
||||||
|
if (i == Math.min(12, tempVal.length) - 1)
|
||||||
|
{
|
||||||
|
g2d.drawLine(slotWidth / 2 + (slotWidth * (i)), nextTemp, slotWidth / 2 + (slotWidth * (i + 1)), nextTemp);
|
||||||
|
}
|
||||||
|
lastTemp = nextTemp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void graphPercent(Graphics2D g2d, float[] precVal, int slotWidth, float range, float multiplier) {
|
||||||
|
int lastTemp = ValueCheck.NO_DATA_INT;
|
||||||
|
for (int i = 0; i < tempval.length; i++)
|
||||||
|
{
|
||||||
|
if (ValueCheck.valueNoData(precVal[i]))
|
||||||
|
{
|
||||||
|
lastTemp = ValueCheck.NO_DATA_INT;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int nextTemp = -(int) (((precVal[i]) / range) * multiplier);
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
lastTemp = nextTemp;
|
||||||
|
}
|
||||||
|
if (ValueCheck.valueNoData(lastTemp))
|
||||||
|
{
|
||||||
|
lastTemp = nextTemp;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
g2d.drawLine(slotWidth / 2 + (slotWidth * (i - 1)), lastTemp, slotWidth / 2 + (slotWidth * i), nextTemp);
|
||||||
|
if (i == Math.min(12, precVal.length) - 1)
|
||||||
|
{
|
||||||
|
g2d.drawLine(slotWidth / 2 + (slotWidth * (i)), nextTemp, slotWidth / 2 + (slotWidth * (i + 1)), nextTemp);
|
||||||
|
}
|
||||||
|
lastTemp = nextTemp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#VisualForecast 1000 Properties file. Functional provider must be set for successful boot!
|
#VisualForecast 1000 Properties file. Functional provider must be set for successful boot!
|
||||||
#Fri Mar 08 21:30:25 PST 2024
|
#Sat Mar 09 23:33:26 PST 2024
|
||||||
forecast-provider-jar=MockForecastProvider.jar
|
forecast-provider-jar=MockForecastProvider.jar
|
||||||
|
|||||||
Reference in New Issue
Block a user