+ float range = max - min;\r
+\r
+ if (min < 0)\r
+ {\r
+ y2 = y - (int) ( (0 - min / (range)) * aa.graphHeight);\r
+ }\r
+\r
+ g.setColor(Color.gray);\r
+\r
+ g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);\r
+\r
+ int column;\r
+ int aaMax = aa.annotations.length - 1;\r
+\r
+ while (x < eRes - sRes)\r
+ {\r
+ column = sRes + x;\r
+ if (av.hasHiddenColumns)\r
+ {\r
+ column = av.getColumnSelection().adjustForHiddenColumns(column);\r
+ }\r
+\r
+ if (column > aaMax)\r
+ {\r
+ break;\r
+ }\r
+\r
+ if (aa.annotations[column] == null)\r
+ {\r
+ x++;\r
+ continue;\r
+ }\r
+\r
+ if (aa.annotations[column].colour == null)\r
+ g.setColor(Color.black);\r
+ else\r
+ g.setColor(aa.annotations[column].colour);\r
+\r
+ y1 = y -\r
+ (int) ( ( (aa.annotations[column].value - min) / (range)) * aa.graphHeight);\r
+\r
+ if (y1 - y2 > 0)\r
+ {\r
+ g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);\r
+ }\r
+ else\r
+ {\r
+ g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);\r
+ }\r
+\r
+ x++;\r
+\r
+ }\r
+ if (aa.threshold != null)\r
+ {\r
+ g.setColor(aa.threshold.colour);\r
+ Graphics2D g2 = (Graphics2D) g;\r
+ g2.setStroke(new BasicStroke(1,\r
+ BasicStroke.CAP_SQUARE,\r
+ BasicStroke.JOIN_ROUND, 3f,\r
+ new float[]\r
+ {5f, 3f}, 0f));\r
+\r
+ y2 = (int) (y - ( (aa.threshold.value - min) / range) * aa.graphHeight);\r
+ g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);\r
+ g2.setStroke(new BasicStroke());\r
+ }\r
+ }\r
+\r
+ // used by overview window\r
+ public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y,\r
+ int sRes, int eRes)\r
+ {\r
+ eRes = Math.min(eRes, aa.annotations.length);\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, width, y);\r
+ g.setColor(new Color(0, 0, 180));\r
+\r
+ int x = 0, height;\r
+\r
+ for (int j = sRes; j < eRes; j++)\r
+ {\r
+ if (aa.annotations[j] != null)\r
+ {\r
+ if (aa.annotations[j].colour == null)\r
+ g.setColor(Color.black);\r
+ else\r
+ g.setColor(aa.annotations[j].colour);\r
+\r
+ height = (int) ( (aa.annotations[j].value / aa.graphMax) * y);\r
+ if (height > y)\r
+ {\r
+ height = y;\r