int prevX = 0;
int prevY = 0;
boolean drawLine = false;
boolean lastIsBleeding = true;
for (int day = 0; day < observations.size(); day++) {
Observation observation = (Observation) observations.elementAt(day);
if(observation == null) {
if(lastIsBleeding)
drawInterval(g, new Interval(day, day+1), 0xff6060, true);
continue;
}
if(observation.isBleeding()) {
drawInterval(g, new Interval(day, day+1), 0x800000, true);
if(day == selectedDay)
drawInterval(g, new Interval(day, day+1), 0xff0000, true);
continue;
}else lastIsBleeding = false;
if(!observation.hasTemperature())
continue;
int x = tx.get(day) + offset;
int y = ty.get(observation.getTemperature());
g.setColor(Color.BLACK);
if (drawLine)
g.drawLine(prevX + DOT_RADIUS, prevY, x - DOT_RADIUS, y);
if (day == selectedDay) {
g.setColor(Color.BLACK);
drawDot(g, x, y, DOT_RADIUS + 2);
}
setMucusColor(g, observation);
drawDot(g, x, y);
g.setColor(Color.BLACK);
fillDot(g, x, y);
if(observation.isDisturbed()) {
//draw a red cross
g.setColor(DISTURBED_CROSS_COLOR);
int r = DOT_RADIUS+2;
g.drawLine(x - r, y - r, x + r, y + r);
g.drawLine(x - r, y + r, x + r, y - r);