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