2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
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)
340 boolean needValidating=false;
341 public void mouseDragged(MouseEvent evt)
343 if (graphStretch > -1)
345 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
347 if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
349 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
351 graphStretchY = evt.getY();
354 ap.paintAlignment(true);
358 ap.scalePanel.mouseDragged(evt);
362 public void mouseMoved(MouseEvent evt)
364 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
372 for (int i = 0; i < aa.length; i++)
377 height += aa[i].height;
380 if (evt.getY() < height)
387 int res = evt.getX() / av.getCharWidth() + av.getStartRes();
389 if (av.hasHiddenColumns)
391 res = av.getColumnSelection().adjustForHiddenColumns(res);
394 if (row > -1 && res < aa[row].annotations.length
395 && aa[row].annotations[res] != null)
397 StringBuffer text = new StringBuffer("Sequence position " + (res + 1));
398 if (aa[row].annotations[res].description != null)
400 text.append(" " + aa[row].annotations[res].description);
402 ap.alignFrame.statusBar.setText(text.toString());
406 public void mouseEntered(MouseEvent evt)
408 ap.scalePanel.mouseEntered(evt);
411 public void mouseExited(MouseEvent evt)
413 ap.scalePanel.mouseExited(evt);
416 public int adjustPanelHeight()
418 // setHeight of panels
419 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
424 for (int i = 0; i < aa.length; i++)
435 aa[i].height += av.charHeight;
445 aa[i].height += aa[i].graphHeight;
448 if (aa[i].height == 0)
453 height += aa[i].height;
460 this.setSize(getSize().width, height);
467 public void addEditableColumn(int i)
471 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
477 for (int j = 0; j < aa.length; j++)
487 if (activeRes == null)
489 activeRes = new Vector();
490 activeRes.addElement(String.valueOf(i));
494 activeRes.addElement(String.valueOf(i));
497 public void update(Graphics g)
502 public void paint(Graphics g)
505 imgWidth = getSize().width;
506 // (av.endRes - av.startRes + 1) * av.charWidth;
508 if (image == null || imgWidth != image.getWidth(this))
510 image = createImage(imgWidth, ap.annotationPanel.getSize().height);
511 gg = image.getGraphics();
512 gg.setFont(av.getFont());
513 fm = gg.getFontMetrics();
519 g.drawImage(image, 0, 0, this);
524 gg.setColor(Color.white);
525 gg.fillRect(0, 0, getSize().width, getSize().height);
526 drawComponent(gg, av.startRes, av.endRes + 1);
528 g.drawImage(image, 0, 0, this);
531 public void fastPaint(int horizontal)
533 if (horizontal == 0 || av.alignment.getAlignmentAnnotation() == null
534 || av.alignment.getAlignmentAnnotation().length < 1)
540 gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal
542 int sr = av.startRes, er = av.endRes + 1, transX = 0;
544 if (horizontal > 0) // scrollbar pulled right, image to the left
546 transX = (er - sr - horizontal) * av.charWidth;
547 sr = er - horizontal;
549 else if (horizontal < 0)
551 er = sr - horizontal;
554 gg.translate(transX, 0);
556 drawComponent(gg, sr, er);
558 gg.translate(-transX, 0);
574 public void drawComponent(Graphics g, int startRes, int endRes)
576 Font ofont = av.getFont();
579 g.setColor(Color.white);
580 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getSize().height);
584 fm = g.getFontMetrics();
587 if ((av.alignment.getAlignmentAnnotation() == null)
588 || (av.alignment.getAlignmentAnnotation().length < 1))
590 g.setColor(Color.white);
591 g.fillRect(0, 0, getSize().width, getSize().height);
592 g.setColor(Color.black);
593 if (av.validCharWidth)
595 g.drawString("Alignment has no annotations", 20, 15);
601 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
608 int iconOffset = av.charHeight / 2;
609 boolean validRes = false;
610 boolean validEnd = false;
611 boolean labelAllCols = false;
612 boolean centreColLabels, centreColLabelsDef = av
613 .getCentreColumnLabels();
614 boolean scaleColLabel = false;
615 boolean[] graphGroupDrawn = new boolean[aa.length];
616 int charOffset = 0; // offset for a label
617 float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
620 for (int i = 0; i < aa.length; i++)
622 AlignmentAnnotation row = aa[i];
628 centreColLabels = row.centreColLabels || centreColLabelsDef;
629 labelAllCols = row.showAllColLabels;
630 scaleColLabel = row.scaleColLabel;
636 if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
641 // this is so that we draw the characters below the graph
646 iconOffset = av.charHeight - fm.getDescent();
650 // TODO: else is the logic used in application, applet had no 'else'
651 else if (row.hasText)
653 iconOffset = av.charHeight - fm.getDescent();
662 while (x < endRes - startRes)
664 if (av.hasHiddenColumns)
666 column = av.getColumnSelection().adjustForHiddenColumns(
668 if (column > row.annotations.length - 1)
675 column = startRes + x;
678 if ((row.annotations.length <= column)
679 || (row.annotations[column] == null))
690 g.setColor(Color.red);
692 if (av.getColumnSelection() != null)
694 for (int n = 0; n < av.getColumnSelection().size(); n++)
696 int v = av.getColumnSelection().columnAt(n);
701 .fillRect(x * av.charWidth, y, av.charWidth,
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')
881 .fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8,
883 x1 += av.charWidth / 2;
886 if (row.annotations[column] == null
887 || row.annotations[column].secondaryStructure != 'H')
889 g.fillArc((x * av.charWidth) - av.charWidth,
890 y + 4 + iconOffset, av.charWidth, 8, 270, 180);
891 x2 -= av.charWidth / 2;
894 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
899 g.setColor(SHEET_COLOUR);
901 if (!validEnd || row.annotations[endRes] == null
902 || row.annotations[endRes].secondaryStructure != 'E')
904 g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
906 g.fillPolygon(new int[]
907 { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
908 (x * av.charWidth) }, new int[]
909 { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset }, 3);
913 g.fillRect(lastSSX, y + 4 + iconOffset, x * av.charWidth
919 g.setColor(Color.gray);
920 if (!av.wrapAlignment || endRes == av.endRes)
922 g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
930 if (row.graph > 0 && row.graphHeight > 0)
932 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
934 if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
936 float groupmax = -999999, groupmin = 9999999;
937 for (int gg = 0; gg < aa.length; gg++)
939 if (aa[gg].graphGroup != row.graphGroup)
946 aa[gg].visible = false;
949 if (aa[gg].graphMax > groupmax)
951 groupmax = aa[gg].graphMax;
953 if (aa[gg].graphMin < groupmin)
955 groupmin = aa[gg].graphMin;
959 for (int gg = 0; gg < aa.length; gg++)
961 if (aa[gg].graphGroup == row.graphGroup)
963 drawLineGraph(g, aa[gg], startRes, endRes, y, groupmin,
964 groupmax, row.graphHeight);
968 graphGroupDrawn[row.graphGroup] = true;
972 drawLineGraph(g, row, startRes, endRes, y, row.graphMin,
973 row.graphMax, row.graphHeight);
976 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
978 drawBarGraph(g, row, startRes, endRes, row.graphMin,
983 if (row.graph > 0 && row.hasText)
995 public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
996 int eRes, int y, float min, float max, int graphHeight)
998 if (sRes > aa.annotations.length)
1005 // Adjustment for fastpaint to left
1006 if (eRes < av.endRes)
1011 eRes = Math.min(eRes, aa.annotations.length);
1014 float range = max - min;
1019 y2 = y - (int) ((0 - min / range) * graphHeight);
1022 g.setColor(Color.gray);
1023 g.drawLine(x - av.charWidth, y2, (eRes - sRes) * av.charWidth, y2);
1025 eRes = Math.min(eRes, aa.annotations.length);
1028 int aaMax = aa.annotations.length - 1;
1030 while (x < eRes - sRes)
1033 if (av.hasHiddenColumns)
1035 column = av.getColumnSelection().adjustForHiddenColumns(column);
1043 if (aa.annotations[column] == null) // || coaa.annotations[column - 1] ==
1050 if (aa.annotations[column].colour == null)
1051 g.setColor(Color.black);
1053 g.setColor(aa.annotations[column].colour);
1054 if (column == 0 || aa.annotations[column - 1] == null)
1057 - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
1062 - (int) (((aa.annotations[column - 1].value - min) / range) * graphHeight);
1065 - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
1067 g.drawLine(x * av.charWidth - av.charWidth / 2, y1, x * av.charWidth
1068 + av.charWidth / 2, y2);
1072 if (aa.threshold != null)
1074 g.setColor(aa.threshold.colour);
1076 y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
1077 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1081 public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
1082 int eRes, float min, float max, int y)
1084 ColourSchemeI profcolour = av.getGlobalColourScheme();
1085 if (profcolour == null)
1087 profcolour = new jalview.schemes.ZappoColourScheme();
1089 if (sRes > aa.annotations.length)
1093 Font ofont = g.getFont();
1094 eRes = Math.min(eRes, aa.annotations.length);
1096 int x = 0, y1 = y, y2 = y;
1098 float range = max - min;
1102 y2 = y - (int) ((0 - min / (range)) * aa.graphHeight);
1105 g.setColor(Color.gray);
1107 g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
1110 int aaMax = aa.annotations.length - 1;
1111 boolean renderHistogram = true, renderProfile = false;
1113 * Logos are disabled for 2.5 release : Bug # 0060064 if (aa.autoCalculated
1114 * && aa.label.startsWith("Consensus")) { // TODO: generalise this to have
1115 * render styles for consensus/profile data if (aa.groupRef!=null) {
1116 * renderHistogram = aa.groupRef.isShowConsensusHistogram(); renderProfile =
1117 * aa.groupRef.isShowSequenceLogo(); } else { renderHistogram =
1118 * av.isShowConsensusHistogram(); renderProfile = av.isShowSequenceLogo(); }
1121 while (x < eRes - sRes)
1124 if (av.hasHiddenColumns)
1126 column = av.getColumnSelection().adjustForHiddenColumns(column);
1134 if (aa.annotations[column] == null)
1140 if (aa.annotations[column].colour == null)
1141 g.setColor(Color.black);
1143 g.setColor(aa.annotations[column].colour);
1146 - (int) (((aa.annotations[column].value - min) / (range)) * aa.graphHeight);
1148 if (renderHistogram)
1152 g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
1156 g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
1159 // draw profile if available
1160 // Disabled for 2.5 release: see bug #0060064
1162 * if (aa.annotations[column].value!=0 && renderProfile) { int profl[] =
1163 * getProfileFor(aa,column); int ht = y1; //,htn=y2-y1;//aa.graphHeight;
1164 * float wdth; double ht2=0; char[] dc = new char[1]; // LineMetrics lm;
1165 * for (int c=1;profl!=null && c<profl[0];) { dc[0] = (char) profl[c++];
1166 * wdth = av.charWidth; wdth/=(float) fm .charsWidth(dc,0,1);
1168 * if (c>2) { ht+=(int)ht2; } { // not java 1.1 compatible: Bug # 0060064
1169 * g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(wdth,
1170 * (ht2=(htn*((double)profl[c++])/100.0))/av.charHeight))); lm =
1171 * g.getFontMetrics().getLineMetrics(dc,0,1, g);
1172 * g.setColor(profcolour.findColour(dc[0]));
1173 * g.drawChars(dc,0,1,x*av.charWidth, (int) (ht+lm.getHeight())); } }
1174 * g.setFont(ofont); }
1179 if (aa.threshold != null)
1181 g.setColor(aa.threshold.colour);
1182 y2 = (int) (y - ((aa.threshold.value - min) / range) * aa.graphHeight);
1183 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1188 * Disabled for 2.5 release - see bug #0060064 private int[]
1189 * getProfileFor(AlignmentAnnotation aa, int column) { // if
1190 * (aa.autoCalculated && aa.label.startsWith("Consensus")) { if
1191 * (aa.groupRef!=null && aa.groupRef.consensusData!=null) { // &&
1192 * aa.groupRef.isShowSequenceLogo()) { return
1193 * AAFrequency.extractProfile(aa.groupRef
1194 * .consensusData[column],aa.groupRef.getIgnoreGapsConsensus()); } // TODO
1195 * extend annotation row to enable dynamic and static profile data to be
1196 * stored if (aa.groupRef==null && aa.sequenceRef==null) // &&
1197 * av.isShowSequenceLogo()) { return
1198 * AAFrequency.extractProfile(av.hconsensus[column
1199 * ],av.getIgnoreGapsConsensus()); } // } return null; }
1202 // used by overview window
1203 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
1204 int y, int sRes, int eRes)
1206 eRes = Math.min(eRes, aa.annotations.length);
1207 g.setColor(Color.white);
1208 g.fillRect(0, 0, width, y);
1209 g.setColor(new Color(0, 0, 180));
1213 for (int j = sRes; j < eRes; j++)
1215 if (aa.annotations[j].colour == null)
1216 g.setColor(Color.black);
1218 g.setColor(aa.annotations[j].colour);
1220 height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);
1225 g.fillRect(x, y - height, av.charWidth, height);