2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.appletgui;
23 import java.awt.event.*;
24 import jalview.datamodel.*;
25 import jalview.schemes.ColourSchemeI;
27 public class AnnotationPanel extends Panel implements AdjustmentListener,
28 ActionListener, MouseListener, MouseMotionListener
38 static String HELIX = "Helix";
40 static String SHEET = "Sheet";
42 static String LABEL = "Label";
44 static String REMOVE = "Remove Annotation";
46 static String COLOUR = "Colour";
48 static Color HELIX_COLOUR = Color.red.darker();
50 static Color SHEET_COLOUR = Color.green.darker().darker();
60 boolean fastPaint = false;
62 // Used For mouse Dragging and resizing graphs
63 int graphStretch = -1;
65 int graphStretchY = -1;
67 boolean mouseDragging = false;
69 public static int GRAPH_HEIGHT = 40;
73 public AnnotationPanel(AlignmentPanel ap)
75 MAC = new jalview.util.Platform().isAMac();
81 addMouseMotionListener(this);
83 addMouseListener(this);
85 // ap.annotationScroller.getVAdjustable().addAdjustmentListener( this );
88 public AnnotationPanel(AlignViewport av)
93 public void adjustmentValueChanged(AdjustmentEvent evt)
95 ap.alabels.setScrollOffset(-evt.getValue());
104 public void actionPerformed(ActionEvent evt)
106 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
111 Annotation[] anot = aa[activeRow].annotations;
113 if (anot.length < av.getColumnSelection().getMax())
115 Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + 2];
116 System.arraycopy(anot, 0, temp, 0, anot.length);
118 aa[activeRow].annotations = anot;
122 if (av.colSel != null && av.colSel.size() > 0
123 && anot[av.colSel.getMin()] != null)
124 label = anot[av.getColumnSelection().getMin()].displayCharacter;
126 if (evt.getActionCommand().equals(REMOVE))
128 for (int i = 0; i < av.getColumnSelection().size(); i++)
130 anot[av.getColumnSelection().columnAt(i)] = null;
133 else if (evt.getActionCommand().equals(LABEL))
135 label = enterLabel(label, "Enter Label");
142 if ((label.length() > 0) && !aa[activeRow].hasText)
144 aa[activeRow].hasText = true;
147 for (int i = 0; i < av.getColumnSelection().size(); i++)
149 int index = av.getColumnSelection().columnAt(i);
151 if (!av.colSel.isVisible(index))
154 if (anot[index] == null)
156 anot[index] = new Annotation(label, "", ' ', 0);
159 anot[index].displayCharacter = label;
162 else if (evt.getActionCommand().equals(COLOUR))
164 UserDefinedColours udc = new UserDefinedColours(this, Color.black,
167 Color col = udc.getColor();
169 for (int i = 0; i < av.getColumnSelection().size(); i++)
171 int index = av.getColumnSelection().columnAt(i);
173 if (!av.colSel.isVisible(index))
176 if (anot[index] == null)
178 anot[index] = new Annotation("", "", ' ', 0);
181 anot[index].colour = col;
188 String symbol = "\u03B1";
190 if (evt.getActionCommand().equals(HELIX))
194 else if (evt.getActionCommand().equals(SHEET))
200 if (!aa[activeRow].hasIcons)
202 aa[activeRow].hasIcons = true;
205 label = enterLabel(symbol, "Enter Label");
212 if ((label.length() > 0) && !aa[activeRow].hasText)
214 aa[activeRow].hasText = true;
217 for (int i = 0; i < av.getColumnSelection().size(); i++)
219 int index = av.getColumnSelection().columnAt(i);
221 if (!av.colSel.isVisible(index))
224 if (anot[index] == null)
226 anot[index] = new Annotation(label, "", type, 0);
229 anot[index].secondaryStructure = type;
230 anot[index].displayCharacter = label;
240 String enterLabel(String text, String label)
242 EditNameDialog dialog = new EditNameDialog(text, null, label, null,
243 ap.alignFrame, "Enter Label", 400, 200, true);
246 return dialog.getName();
251 public void mousePressed(MouseEvent evt)
253 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
262 for (int i = 0; i < aa.length; i++)
266 height += aa[i].height;
269 if (evt.getY() < height)
275 else if (aa[i].graph > 0)
279 graphStretchY = evt.getY();
286 if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK
289 if (av.getColumnSelection() == null)
294 PopupMenu pop = new PopupMenu("Structure type");
295 MenuItem item = new MenuItem(HELIX);
296 item.addActionListener(this);
298 item = new MenuItem(SHEET);
299 item.addActionListener(this);
301 item = new MenuItem(LABEL);
302 item.addActionListener(this);
304 item = new MenuItem(COLOUR);
305 item.addActionListener(this);
307 item = new MenuItem(REMOVE);
308 item.addActionListener(this);
310 ap.alignFrame.add(pop);
311 pop.show(this, evt.getX(), evt.getY());
321 ap.scalePanel.mousePressed(evt);
324 public void mouseReleased(MouseEvent evt)
328 mouseDragging = false;
332 needValidating = false;
334 ap.scalePanel.mouseReleased(evt);
337 public void mouseClicked(MouseEvent evt)
341 boolean needValidating = false;
343 public void mouseDragged(MouseEvent evt)
345 if (graphStretch > -1)
347 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
349 if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
351 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
353 graphStretchY = evt.getY();
355 needValidating = true;
356 ap.paintAlignment(true);
360 ap.scalePanel.mouseDragged(evt);
364 public void mouseMoved(MouseEvent evt)
366 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
374 for (int i = 0; i < aa.length; i++)
379 height += aa[i].height;
382 if (evt.getY() < height)
389 int res = evt.getX() / av.getCharWidth() + av.getStartRes();
391 if (av.hasHiddenColumns)
393 res = av.getColumnSelection().adjustForHiddenColumns(res);
396 if (row > -1 && res < aa[row].annotations.length
397 && aa[row].annotations[res] != null)
399 StringBuffer text = new StringBuffer("Sequence position " + (res + 1));
400 if (aa[row].annotations[res].description != null)
402 text.append(" " + aa[row].annotations[res].description);
404 ap.alignFrame.statusBar.setText(text.toString());
408 public void mouseEntered(MouseEvent evt)
410 ap.scalePanel.mouseEntered(evt);
413 public void mouseExited(MouseEvent evt)
415 ap.scalePanel.mouseExited(evt);
418 public int adjustPanelHeight()
420 // setHeight of panels
421 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
426 for (int i = 0; i < aa.length; i++)
437 aa[i].height += av.charHeight;
447 aa[i].height += aa[i].graphHeight;
450 if (aa[i].height == 0)
455 height += aa[i].height;
462 this.setSize(getSize().width, height);
469 public void addEditableColumn(int i)
473 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
479 for (int j = 0; j < aa.length; j++)
489 if (activeRes == null)
491 activeRes = new Vector();
492 activeRes.addElement(String.valueOf(i));
496 activeRes.addElement(String.valueOf(i));
499 public void update(Graphics g)
504 public void paint(Graphics g)
507 imgWidth = getSize().width;
508 // (av.endRes - av.startRes + 1) * av.charWidth;
510 if (image == null || imgWidth != image.getWidth(this))
512 image = createImage(imgWidth, ap.annotationPanel.getSize().height);
513 gg = image.getGraphics();
514 gg.setFont(av.getFont());
515 fm = gg.getFontMetrics();
521 g.drawImage(image, 0, 0, this);
526 gg.setColor(Color.white);
527 gg.fillRect(0, 0, getSize().width, getSize().height);
528 drawComponent(gg, av.startRes, av.endRes + 1);
530 g.drawImage(image, 0, 0, this);
533 public void fastPaint(int horizontal)
535 if (horizontal == 0 || av.alignment.getAlignmentAnnotation() == null
536 || av.alignment.getAlignmentAnnotation().length < 1)
542 gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal
544 int sr = av.startRes, er = av.endRes + 1, transX = 0;
546 if (horizontal > 0) // scrollbar pulled right, image to the left
548 transX = (er - sr - horizontal) * av.charWidth;
549 sr = er - horizontal;
551 else if (horizontal < 0)
553 er = sr - horizontal;
556 gg.translate(transX, 0);
558 drawComponent(gg, sr, er);
560 gg.translate(-transX, 0);
576 public void drawComponent(Graphics g, int startRes, int endRes)
578 Font ofont = av.getFont();
581 g.setColor(Color.white);
582 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getSize().height);
586 fm = g.getFontMetrics();
589 if ((av.alignment.getAlignmentAnnotation() == null)
590 || (av.alignment.getAlignmentAnnotation().length < 1))
592 g.setColor(Color.white);
593 g.fillRect(0, 0, getSize().width, getSize().height);
594 g.setColor(Color.black);
595 if (av.validCharWidth)
597 g.drawString("Alignment has no annotations", 20, 15);
603 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
610 int iconOffset = av.charHeight / 2;
611 boolean validRes = false;
612 boolean validEnd = false;
613 boolean labelAllCols = false;
614 boolean centreColLabels, centreColLabelsDef = av
615 .getCentreColumnLabels();
616 boolean scaleColLabel = false;
617 boolean[] graphGroupDrawn = new boolean[aa.length];
618 int charOffset = 0; // offset for a label
619 float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
622 for (int i = 0; i < aa.length; i++)
624 AlignmentAnnotation row = aa[i];
630 centreColLabels = row.centreColLabels || centreColLabelsDef;
631 labelAllCols = row.showAllColLabels;
632 scaleColLabel = row.scaleColLabel;
638 if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
643 // this is so that we draw the characters below the graph
648 iconOffset = av.charHeight - fm.getDescent();
652 // TODO: else is the logic used in application, applet had no 'else'
653 else if (row.hasText)
655 iconOffset = av.charHeight - fm.getDescent();
664 while (x < endRes - startRes)
666 if (av.hasHiddenColumns)
668 column = av.getColumnSelection().adjustForHiddenColumns(
670 if (column > row.annotations.length - 1)
677 column = startRes + x;
680 if ((row.annotations.length <= column)
681 || (row.annotations[column] == null))
692 g.setColor(Color.red);
694 if (av.getColumnSelection() != null)
696 for (int n = 0; n < av.getColumnSelection().size(); n++)
698 int v = av.getColumnSelection().columnAt(n);
702 g.fillRect(x * av.charWidth, y, av.charWidth, av.charHeight);
708 if (av.validCharWidth
710 && (row.annotations[column].displayCharacter != null && row.annotations[column].displayCharacter
714 if (centreColLabels || scaleColLabel)
716 fmWidth = (float) fm.charsWidth(
717 row.annotations[column].displayCharacter.toCharArray(),
718 0, row.annotations[column].displayCharacter.length());
722 // justify the label and scale to fit in column
723 if (fmWidth > av.charWidth)
725 // scale only if the current font isn't already small enough
726 fmScaling = av.charWidth;
727 fmScaling /= fmWidth;
728 // not 1.1 // g.setFont(new
729 // Font(ofont,AffineTransform.getScaleInstance(fmScaling,
731 // and update the label's width to reflect the scaling.
732 fmWidth = av.charWidth;
739 .charWidth(row.annotations[column].displayCharacter
742 charOffset = (int) ((av.charWidth - fmWidth) / 2f);
744 if (row.annotations[column].colour == null)
745 g.setColor(Color.black);
747 g.setColor(row.annotations[column].colour);
749 if (column == 0 || row.graph > 0)
751 g.drawString(row.annotations[column].displayCharacter,
752 (x * av.charWidth) + charOffset, y + iconOffset + 3); // +
755 else if (row.annotations[column - 1] == null
757 || !row.annotations[column].displayCharacter
758 .equals(row.annotations[column - 1].displayCharacter) || (row.annotations[column].displayCharacter
759 .length() < 2 && row.annotations[column].secondaryStructure == ' ')))
761 g.drawString(row.annotations[column].displayCharacter,
762 (x * av.charWidth) + charOffset, y + iconOffset + 3); // +3?
770 || (row.annotations[column].secondaryStructure != lastSS))
775 g.setColor(HELIX_COLOUR);
778 // Off by 1 offset when drawing rects and ovals
779 // to offscreen image on the MAC
780 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
781 (x * av.charWidth) - lastSSX, 7, 8, 8);
785 int sCol = (lastSSX / av.charWidth) + startRes;
787 int x2 = (x * av.charWidth);
790 || row.annotations[sCol - 1] == null
791 || row.annotations[sCol - 1].secondaryStructure != 'H')
793 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
795 x1 += av.charWidth / 2;
798 if (!validRes || row.annotations[column] == null
799 || row.annotations[column].secondaryStructure != 'H')
801 g.fillArc((x * av.charWidth) - av.charWidth, y + 4
802 + iconOffset, av.charWidth, 8, 270, 180);
803 x2 -= av.charWidth / 2;
806 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
810 g.setColor(SHEET_COLOUR);
811 g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
813 g.fillPolygon(new int[]
814 { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
815 (x * av.charWidth) }, new int[]
816 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
822 g.setColor(Color.gray);
823 g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
831 lastSS = row.annotations[column].secondaryStructure;
838 lastSSX = (x * av.charWidth);
846 if (column >= row.annotations.length)
848 column = row.annotations.length - 1;
863 g.setColor(HELIX_COLOUR);
866 // Off by 1 offset when drawing rects and ovals
867 // to offscreen image on the MAC
868 g.fillRoundRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
873 int sCol = (lastSSX / av.charWidth) + startRes;
875 int x2 = (x * av.charWidth);
877 if (sCol == 0 || row.annotations[sCol - 1] == null
878 || row.annotations[sCol - 1].secondaryStructure != 'H')
880 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);
881 x1 += av.charWidth / 2;
884 if (row.annotations[column] == null
885 || row.annotations[column].secondaryStructure != 'H')
887 g.fillArc((x * av.charWidth) - av.charWidth,
888 y + 4 + iconOffset, av.charWidth, 8, 270, 180);
889 x2 -= av.charWidth / 2;
892 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
897 g.setColor(SHEET_COLOUR);
899 if (!validEnd || row.annotations[endRes] == null
900 || row.annotations[endRes].secondaryStructure != 'E')
902 g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
904 g.fillPolygon(new int[]
905 { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
906 (x * av.charWidth) }, new int[]
907 { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset }, 3);
911 g.fillRect(lastSSX, y + 4 + iconOffset, x * av.charWidth
917 g.setColor(Color.gray);
918 if (!av.wrapAlignment || endRes == av.endRes)
920 g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
928 if (row.graph > 0 && row.graphHeight > 0)
930 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
932 if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
934 float groupmax = -999999, groupmin = 9999999;
935 for (int gg = 0; gg < aa.length; gg++)
937 if (aa[gg].graphGroup != row.graphGroup)
944 aa[gg].visible = false;
947 if (aa[gg].graphMax > groupmax)
949 groupmax = aa[gg].graphMax;
951 if (aa[gg].graphMin < groupmin)
953 groupmin = aa[gg].graphMin;
957 for (int gg = 0; gg < aa.length; gg++)
959 if (aa[gg].graphGroup == row.graphGroup)
961 drawLineGraph(g, aa[gg], startRes, endRes, y, groupmin,
962 groupmax, row.graphHeight);
966 graphGroupDrawn[row.graphGroup] = true;
970 drawLineGraph(g, row, startRes, endRes, y, row.graphMin,
971 row.graphMax, row.graphHeight);
974 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
976 drawBarGraph(g, row, startRes, endRes, row.graphMin,
981 if (row.graph > 0 && row.hasText)
993 public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
994 int eRes, int y, float min, float max, int graphHeight)
996 if (sRes > aa.annotations.length)
1003 // Adjustment for fastpaint to left
1004 if (eRes < av.endRes)
1009 eRes = Math.min(eRes, aa.annotations.length);
1012 float range = max - min;
1017 y2 = y - (int) ((0 - min / range) * graphHeight);
1020 g.setColor(Color.gray);
1021 g.drawLine(x - av.charWidth, y2, (eRes - sRes) * av.charWidth, y2);
1023 eRes = Math.min(eRes, aa.annotations.length);
1026 int aaMax = aa.annotations.length - 1;
1028 while (x < eRes - sRes)
1031 if (av.hasHiddenColumns)
1033 column = av.getColumnSelection().adjustForHiddenColumns(column);
1041 if (aa.annotations[column] == null) // || coaa.annotations[column - 1] ==
1048 if (aa.annotations[column].colour == null)
1049 g.setColor(Color.black);
1051 g.setColor(aa.annotations[column].colour);
1052 if (column == 0 || aa.annotations[column - 1] == null)
1055 - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
1060 - (int) (((aa.annotations[column - 1].value - min) / range) * graphHeight);
1063 - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
1065 g.drawLine(x * av.charWidth - av.charWidth / 2, y1, x * av.charWidth
1066 + av.charWidth / 2, y2);
1070 if (aa.threshold != null)
1072 g.setColor(aa.threshold.colour);
1074 y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
1075 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1079 public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
1080 int eRes, float min, float max, int y)
1082 ColourSchemeI profcolour = av.getGlobalColourScheme();
1083 if (profcolour == null)
1085 profcolour = new jalview.schemes.ZappoColourScheme();
1087 if (sRes > aa.annotations.length)
1091 Font ofont = g.getFont();
1092 eRes = Math.min(eRes, aa.annotations.length);
1094 int x = 0, y1 = y, y2 = y;
1096 float range = max - min;
1100 y2 = y - (int) ((0 - min / (range)) * aa.graphHeight);
1103 g.setColor(Color.gray);
1105 g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
1108 int aaMax = aa.annotations.length - 1;
1109 boolean renderHistogram = true, renderProfile = false;
1111 * Logos are disabled for 2.5 release : Bug # 0060064 if (aa.autoCalculated
1112 * && aa.label.startsWith("Consensus")) { // TODO: generalise this to have
1113 * render styles for consensus/profile data if (aa.groupRef!=null) {
1114 * renderHistogram = aa.groupRef.isShowConsensusHistogram(); renderProfile =
1115 * aa.groupRef.isShowSequenceLogo(); } else { renderHistogram =
1116 * av.isShowConsensusHistogram(); renderProfile = av.isShowSequenceLogo(); }
1119 while (x < eRes - sRes)
1122 if (av.hasHiddenColumns)
1124 column = av.getColumnSelection().adjustForHiddenColumns(column);
1132 if (aa.annotations[column] == null)
1138 if (aa.annotations[column].colour == null)
1139 g.setColor(Color.black);
1141 g.setColor(aa.annotations[column].colour);
1144 - (int) (((aa.annotations[column].value - min) / (range)) * aa.graphHeight);
1146 if (renderHistogram)
1150 g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
1154 g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
1157 // draw profile if available
1158 // Disabled for 2.5 release: see bug #0060064
1160 * if (aa.annotations[column].value!=0 && renderProfile) { int profl[] =
1161 * getProfileFor(aa,column); int ht = y1; //,htn=y2-y1;//aa.graphHeight;
1162 * float wdth; double ht2=0; char[] dc = new char[1]; // LineMetrics lm;
1163 * for (int c=1;profl!=null && c<profl[0];) { dc[0] = (char) profl[c++];
1164 * wdth = av.charWidth; wdth/=(float) fm .charsWidth(dc,0,1);
1166 * if (c>2) { ht+=(int)ht2; } { // not java 1.1 compatible: Bug # 0060064
1167 * g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(wdth,
1168 * (ht2=(htn*((double)profl[c++])/100.0))/av.charHeight))); lm =
1169 * g.getFontMetrics().getLineMetrics(dc,0,1, g);
1170 * g.setColor(profcolour.findColour(dc[0]));
1171 * g.drawChars(dc,0,1,x*av.charWidth, (int) (ht+lm.getHeight())); } }
1172 * g.setFont(ofont); }
1177 if (aa.threshold != null)
1179 g.setColor(aa.threshold.colour);
1180 y2 = (int) (y - ((aa.threshold.value - min) / range) * aa.graphHeight);
1181 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1186 * Disabled for 2.5 release - see bug #0060064 private int[]
1187 * getProfileFor(AlignmentAnnotation aa, int column) { // if
1188 * (aa.autoCalculated && aa.label.startsWith("Consensus")) { if
1189 * (aa.groupRef!=null && aa.groupRef.consensusData!=null) { // &&
1190 * aa.groupRef.isShowSequenceLogo()) { return
1191 * AAFrequency.extractProfile(aa.groupRef
1192 * .consensusData[column],aa.groupRef.getIgnoreGapsConsensus()); } // TODO
1193 * extend annotation row to enable dynamic and static profile data to be
1194 * stored if (aa.groupRef==null && aa.sequenceRef==null) // &&
1195 * av.isShowSequenceLogo()) { return
1196 * AAFrequency.extractProfile(av.hconsensus[column
1197 * ],av.getIgnoreGapsConsensus()); } // } return null; }
1200 // used by overview window
1201 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
1202 int y, int sRes, int eRes)
1204 eRes = Math.min(eRes, aa.annotations.length);
1205 g.setColor(Color.white);
1206 g.fillRect(0, 0, width, y);
1207 g.setColor(new Color(0, 0, 180));
1211 for (int j = sRes; j < eRes; j++)
1213 if (aa.annotations[j].colour == null)
1214 g.setColor(Color.black);
1216 g.setColor(aa.annotations[j].colour);
1218 height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);
1223 g.fillRect(x, y - height, av.charWidth, height);