int baseY = computeYPixelValue(adjustedRect, axisDefinition, baseValue);
getBaselineGraphics(context).drawLine((int) x, baseY, (int) maxX, baseY);
}
PreferenceManager prefs = PreferenceManager.getInstance();
Color altColor = track.getAltColor();
Color borderColor = (prefs.getAsBoolean(PreferenceManager.CHART_COLOR_BORDERS) && altColor != null && altColor.equals(track.getColor()) )
? track.getColor() : Color.lightGray;
Graphics2D borderGraphics = context.getGraphic2DForColor(borderColor);
// Draw the baseline -- todo, this is a wig track option?
double zeroValue = axisDefinition.getBaseline();
int zeroY = computeYPixelValue(adjustedRect, axisDefinition, zeroValue);
borderGraphics.drawLine(adjustedRect.x, zeroY, adjustedRect.x + adjustedRect.width, zeroY);
// Optionally draw "Y" line (UCSC track line option)
if (track.isDrawYLine()) {
Graphics2D yLineGraphics = context.getGraphic2DForColor(Color.gray);
int yLine = computeYPixelValue(adjustedRect, axisDefinition, track.getYLine());
GraphicUtils.drawDashedLine(borderGraphics, adjustedRect.x, yLine, adjustedRect.x + adjustedRect.width, yLine);
}
// If the chart has + and - numbers draw both borders or none. This
// needs documented somewhere.
boolean drawBorders = true;
if (minValue * maxValue < 0) {
drawBorders = prefs.getAsBoolean(PreferenceManager.CHART_DRAW_BOTTOM_BORDER) &&
prefs.getAsBoolean(PreferenceManager.CHART_DRAW_TOP_BORDER);
}
if (drawBorders && prefs.getAsBoolean(PreferenceManager.CHART_DRAW_TOP_BORDER)) {
borderGraphics.drawLine(adjustedRect.x, adjustedRect.y,
adjustedRect.x + adjustedRect.width, adjustedRect.y);
}
if (drawBorders && prefs.getAsBoolean(PreferenceManager.CHART_DRAW_BOTTOM_BORDER)) {
borderGraphics.drawLine(adjustedRect.x, adjustedRect.y + adjustedRect.height,
adjustedRect.x + adjustedRect.width,
adjustedRect.y + adjustedRect.height);
}
}