}
- int scale = Math
- .max(1, _aa.graphHeight / contacts.getContactHeight());
- int step = _aa.graphHeight / scale;
- int valuesProcessed = 0;
+ // cell height to render
+ double scale = (_aa.graphHeight < contacts.getContactHeight()) ? 1
+ : (((double) _aa.graphHeight) / (double) contacts
+ .getContactHeight());
+ // distance between contact map per cell
+ int step = (int) ((contacts.getContactHeight()) * scale / _aa.graphHeight);
+
// profl[1] is the number of values in the profile
- for (int stp = 0, ht = y2, eht = y2 + _aa.graphHeight; ht < eht; ht += scale, stp++)
+ for (int stp = 0, ht = y2, eht = y2 - _aa.graphHeight; ht > eht; ht -= scale, stp++)
{
- valuesProcessed = stp * step;
- g.setColor(contacts.getColorForScore(stp * step));
+ g.setColor(contacts
+ .getColorForScore((int) (stp * step * ((double) _aa.graphHeight / (double) contacts
+ .getContactHeight()))));
if (scale > 1)
{
- g.fillRect(x * charWidth, ht, charWidth, scale);
+ g.fillRect(x * charWidth, ht, charWidth, 1 + (int) scale);
} else {
g.drawLine(x * charWidth, ht, (x + 1) * charWidth, ht);
}
}
+ x++;
}
- x++;
}
}