2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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.renderer;
20 import jalview.analysis.AAFrequency;
21 import jalview.analysis.StructureFrequency;
22 import jalview.api.AlignViewportI;
23 import jalview.datamodel.AlignmentAnnotation;
24 import jalview.datamodel.Annotation;
25 import jalview.datamodel.ColumnSelection;
26 import jalview.schemes.ColourSchemeI;
28 import java.awt.BasicStroke;
29 import java.awt.Color;
31 import java.awt.FontMetrics;
32 import java.awt.Graphics;
33 import java.awt.Graphics2D;
34 import java.awt.Image;
35 import java.awt.font.LineMetrics;
36 import java.awt.geom.AffineTransform;
37 import java.awt.image.ImageObserver;
38 import java.util.BitSet;
39 import java.util.Hashtable;
41 import com.stevesoft.pat.Regex;
43 public class AnnotationRenderer
46 public AnnotationRenderer()
48 // TODO Auto-generated constructor stub
51 public void drawStemAnnot(Graphics g, Annotation[] row_annotations,
52 int lastSSX, int x, int y, int iconOffset, int startRes,
53 int column, boolean validRes, boolean validEnd)
55 g.setColor(STEM_COLOUR);
56 int sCol = (lastSSX / charWidth) + startRes;
58 int x2 = (x * charWidth);
59 Regex closeparen = new Regex("(\\))");
61 String dc = (column == 0 || row_annotations[column - 1] == null) ? ""
62 : row_annotations[column - 1].displayCharacter;
64 boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
65 || !dc.equals(row_annotations[sCol - 1].displayCharacter);
66 boolean diffdownstream = !validRes || !validEnd
67 || row_annotations[column] == null
68 || !dc.equals(row_annotations[column].displayCharacter);
69 // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
70 // If a closing base pair half of the stem, display a backward arrow
71 if (column > 0 && closeparen.search(dc))
74 // if (validRes && column>1 && row_annotations[column-2]!=null &&
75 // dc.equals(row_annotations[column-2].displayCharacter))
77 g.fillPolygon(new int[]
78 { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
79 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
89 // display a forward arrow
92 g.fillPolygon(new int[]
93 { x2 - 5, x2 - 5, x2 }, new int[]
94 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
103 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
106 private int charWidth, endRes, charHeight;
108 private boolean validCharWidth, hasHiddenColumns;
110 private FontMetrics fm;
112 private final boolean MAC = new jalview.util.Platform().isAMac();
114 boolean av_renderHistogram = true, av_renderProfile = true,
115 av_normaliseProfile = false;
117 ColourSchemeI profcolour = null;
119 private ColumnSelection columnSelection;
121 private Hashtable[] hconsensus;
123 private Hashtable[] hStrucConsensus;
125 private boolean av_ignoreGapsConsensus;
128 * attributes set from AwtRenderPanelI
131 * old image used when data is currently being calculated and cannot be
134 private Image fadedImage;
137 * panel being rendered into
139 private ImageObserver annotationPanel;
142 * width of image to render in panel
144 private int imgWidth;
146 // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
148 public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
151 fm = annotPanel.getFontMetrics();
152 annotationPanel = annotPanel;
153 fadedImage = annotPanel.getFadedImage();
154 imgWidth = annotPanel.getFadedImageWidth();
155 updateFromAlignViewport(av);
158 public void updateFromAlignViewport(AlignViewportI av)
160 charWidth = av.getCharWidth();
161 endRes = av.getEndRes();
162 charHeight = av.getCharHeight();
163 hasHiddenColumns = av.hasHiddenColumns();
164 validCharWidth = av.isValidCharWidth();
165 av_renderHistogram = av.isShowConsensusHistogram();
166 av_renderProfile = av.isShowSequenceLogo();
167 av_normaliseProfile = av.isNormaliseSequenceLogo();
168 profcolour = av.getGlobalColourScheme();
169 if (profcolour == null)
171 // Set the default colour for sequence logo if the alignnent has no
173 profcolour = av.getAlignment().isNucleotide() ? new jalview.schemes.NucleotideColourScheme()
174 : new jalview.schemes.ZappoColourScheme();
176 columnSelection = av.getColumnSelection();
177 hconsensus = av.getSequenceConsensusHash();// hconsensus;
178 hStrucConsensus = av.getRnaStructureConsensusHash(); // hStrucConsensus;
179 av_ignoreGapsConsensus = av.getIgnoreGapsConsensus();
182 public int[] getProfileFor(AlignmentAnnotation aa, int column)
184 // TODO : consider refactoring the global alignment calculation
185 // properties/rendering attributes as a global 'alignment group' which holds
186 // all vis settings for the alignment as a whole rather than a subset
188 if (aa.autoCalculated && aa.label.startsWith("Consensus"))
190 if (aa.groupRef != null && aa.groupRef.consensusData != null
191 && aa.groupRef.isShowSequenceLogo())
193 return AAFrequency.extractProfile(
194 aa.groupRef.consensusData[column],
195 aa.groupRef.getIgnoreGapsConsensus());
197 // TODO extend annotation row to enable dynamic and static profile data to
199 if (aa.groupRef == null && aa.sequenceRef == null && av_renderProfile)
201 return AAFrequency.extractProfile(hconsensus[column],
202 av_ignoreGapsConsensus);
207 if (aa.autoCalculated && aa.label.startsWith("StrucConsensus"))
209 // TODO implement group structure consensus
211 * if (aa.groupRef != null && aa.groupRef.consensusData != null &&
212 * aa.groupRef.isShowSequenceLogo()) { //TODO check what happens for
213 * group selections return StructureFrequency.extractProfile(
214 * aa.groupRef.consensusData[column], aa.groupRef
215 * .getIgnoreGapsConsensus()); }
217 // TODO extend annotation row to enable dynamic and static profile data
220 if (aa.groupRef == null && aa.sequenceRef == null
221 && av_renderProfile && hStrucConsensus != null
222 && hStrucConsensus.length > column)
224 return StructureFrequency.extractProfile(hStrucConsensus[column],
225 av_ignoreGapsConsensus);
233 * Render the annotation rows associated with an alignment.
238 * data and view settings to render
240 * destination for graphics
242 * row where a mouse event occured (or -1)
244 * first column that will be drawn
246 * last column that will be drawn
247 * @return true if the fadedImage was used for any alignment annotation rows
248 * currently being calculated
250 public boolean drawComponent(AwtRenderPanelI annotPanel,
251 AlignViewportI av, Graphics g, int activeRow, int startRes,
254 boolean usedFaded = false;
256 // AnnotationPanel needs to implement: ImageObserver, access to
258 updateFromAwtRenderPanel(annotPanel, av);
259 fm = g.getFontMetrics();
260 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
270 boolean validRes = false;
271 boolean validEnd = false;
272 boolean labelAllCols = false;
273 boolean centreColLabels, centreColLabelsDef = av
274 .getCentreColumnLabels();
275 boolean scaleColLabel = false;
277 BitSet graphGroupDrawn = new BitSet();
278 int charOffset = 0; // offset for a label
279 float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
281 Font ofont = g.getFont();
283 for (int i = 0; i < aa.length; i++)
285 AlignmentAnnotation row = aa[i];
286 Annotation[] row_annotations = row.annotations;
291 centreColLabels = row.centreColLabels || centreColLabelsDef;
292 labelAllCols = row.showAllColLabels;
293 scaleColLabel = row.scaleColLabel;
298 if (row.graphGroup > -1 && graphGroupDrawn.get(row.graphGroup)) {
302 // this is so that we draw the characters below the graph
307 iconOffset = charHeight - fm.getDescent();
311 else if (row.hasText)
313 iconOffset = charHeight - fm.getDescent();
321 if (row.autoCalculated && av.isCalculationInProgress(row))
325 g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
326 - row.height, imgWidth, y, annotationPanel);
327 g.setColor(Color.black);
328 // g.drawString("Calculating "+aa[i].label+"....",20, y-row.height/2);
334 * else if (annotationPanel.av.updatingConservation &&
335 * aa[i].label.equals("Conservation")) {
337 * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
338 * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
339 * annotationPanel.imgWidth, y, annotationPanel);
341 * g.setColor(Color.black); //
342 * g.drawString("Calculating Conservation.....",20, y-row.height/2);
344 * continue; } else if (annotationPanel.av.updatingConservation &&
345 * aa[i].label.equals("Quality")) {
347 * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
348 * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
349 * annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black);
350 * // / g.drawString("Calculating Quality....",20, y-row.height/2);
354 // first pass sets up state for drawing continuation from left-hand column
356 x = (startRes == 0) ? 0 : -1;
357 while (x < endRes - startRes)
359 if (hasHiddenColumns)
361 column = columnSelection.adjustForHiddenColumns(startRes + x);
362 if (column > row_annotations.length - 1)
369 column = startRes + x;
372 if ((row_annotations == null) || (row_annotations.length <= column)
373 || (row_annotations[column] == null))
385 g.setColor(Color.red);
387 if (columnSelection != null)
389 for (int n = 0; n < columnSelection.size(); n++)
391 int v = columnSelection.columnAt(n);
395 g.fillRect(x * charWidth, y, charWidth, charHeight);
400 if (!row.isValidStruc())
402 g.setColor(Color.orange);
403 g.fillRect((int) row.getInvalidStrucPos() * charWidth, y,
404 charWidth, charHeight);
408 && row_annotations[column].displayCharacter != null
409 && (row_annotations[column].displayCharacter.length() > 0))
412 if (centreColLabels || scaleColLabel)
414 fmWidth = fm.charsWidth(
415 row_annotations[column].displayCharacter
417 row_annotations[column].displayCharacter.length());
421 // justify the label and scale to fit in column
422 if (fmWidth > charWidth)
424 // scale only if the current font isn't already small enough
425 fmScaling = charWidth;
426 fmScaling /= fmWidth;
427 g.setFont(ofont.deriveFont(AffineTransform
428 .getScaleInstance(fmScaling, 1.0)));
429 // and update the label's width to reflect the scaling.
437 .charWidth(row_annotations[column].displayCharacter
440 charOffset = (int) ((charWidth - fmWidth) / 2f);
442 if (row_annotations[column].colour == null)
443 g.setColor(Color.black);
445 g.setColor(row_annotations[column].colour);
447 if (column == 0 || row.graph > 0)
449 g.drawString(row_annotations[column].displayCharacter,
450 (x * charWidth) + charOffset, y + iconOffset);
452 else if (row_annotations[column - 1] == null
454 || !row_annotations[column].displayCharacter
455 .equals(row_annotations[column - 1].displayCharacter) || (row_annotations[column].displayCharacter
456 .length() < 2 && row_annotations[column].secondaryStructure == ' ')))
458 g.drawString(row_annotations[column].displayCharacter, x
459 * charWidth + charOffset, y + iconOffset);
466 char ss = validRes ? row_annotations[column].secondaryStructure
470 // distinguish between forward/backward base-pairing
471 if (row_annotations[column].displayCharacter.indexOf(')') > -1)
476 if (!validRes || (ss != lastSS))
483 drawHelixAnnot(g, row_annotations, lastSSX, x, y,
484 iconOffset, startRes, column, validRes, validEnd);
488 drawSheetAnnot(g, row_annotations, lastSSX, x, y,
489 iconOffset, startRes, column, validRes, validEnd);
492 case 'S': // Stem case for RNA secondary structure
493 case 's': // and opposite direction
494 drawStemAnnot(g, row_annotations, lastSSX, x, y,
495 iconOffset, startRes, column, validRes, validEnd);
499 g.setColor(Color.gray);
500 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
516 lastSSX = (x * charWidth);
523 if (column >= row_annotations.length)
525 column = row_annotations.length - 1;
532 if ((row_annotations == null) || (row_annotations.length <= column)
533 || (row_annotations[column] == null))
549 drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
550 startRes, column, validRes, validEnd);
554 drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
555 startRes, column, validRes, validEnd);
558 case 'S': // Stem case for RNA secondary structure
559 drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
560 startRes, column, validRes, validEnd);
563 drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset,
564 startRes, column, validRes, validEnd);
569 if (row.graph > 0 && row.graphHeight > 0)
571 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
573 if (row.graphGroup > -1 && !graphGroupDrawn.get(row.graphGroup))
575 float groupmax = -999999, groupmin = 9999999;
576 for (int gg = 0; gg < aa.length; gg++)
578 if (aa[gg].graphGroup != row.graphGroup)
585 aa[gg].visible = false;
587 if (aa[gg].graphMax > groupmax)
589 groupmax = aa[gg].graphMax;
591 if (aa[gg].graphMin < groupmin)
593 groupmin = aa[gg].graphMin;
597 for (int gg = 0; gg < aa.length; gg++)
599 if (aa[gg].graphGroup == row.graphGroup)
601 drawLineGraph(g, aa[gg], aa[gg].annotations, startRes,
602 endRes, y, groupmin, groupmax, row.graphHeight);
606 graphGroupDrawn.set(row.graphGroup);
610 drawLineGraph(g, row, row_annotations, startRes, endRes, y,
611 row.graphMin, row.graphMax, row.graphHeight);
614 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
616 drawBarGraph(g, row, row_annotations, startRes, endRes,
617 row.graphMin, row.graphMax, y);
621 if (row.graph > 0 && row.hasText)
634 private final Color GLYPHLINE_COLOR = Color.gray;
636 private final Color SHEET_COLOUR = Color.green;
638 private final Color HELIX_COLOUR = Color.red;
640 private final Color STEM_COLOUR = Color.blue;
642 public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX,
643 int x, int y, int iconOffset, int startRes, int column,
644 boolean validRes, boolean validEnd)
646 g.setColor(GLYPHLINE_COLOR);
647 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2);
650 public void drawSheetAnnot(Graphics g, Annotation[] row, int lastSSX,
651 int x, int y, int iconOffset, int startRes, int column,
652 boolean validRes, boolean validEnd)
654 g.setColor(SHEET_COLOUR);
656 if (!validEnd || !validRes || row == null || row[column] == null
657 || row[column].secondaryStructure != 'E')
659 g.fillRect(lastSSX, y + 4 + iconOffset,
660 (x * charWidth) - lastSSX - 4, 7);
661 g.fillPolygon(new int[]
662 { (x * charWidth) - 4, (x * charWidth) - 4, (x * charWidth) },
664 { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset },
669 g.fillRect(lastSSX, y + 4 + iconOffset,
670 (x + 1) * charWidth - lastSSX, 7);
675 public void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX,
676 int x, int y, int iconOffset, int startRes, int column,
677 boolean validRes, boolean validEnd)
679 g.setColor(HELIX_COLOUR);
681 int sCol = (lastSSX / charWidth) + startRes;
683 int x2 = (x * charWidth);
687 int ofs = charWidth / 2;
688 // Off by 1 offset when drawing rects and ovals
689 // to offscreen image on the MAC
690 g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1, 8, 8, 8);
691 if (sCol == 0 || row[sCol - 1] == null
692 || row[sCol - 1].secondaryStructure != 'H')
697 // g.setColor(Color.orange);
698 g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1 - ofs + 1, 8,
701 if (!validRes || row[column] == null
702 || row[column].secondaryStructure != 'H')
708 // g.setColor(Color.magenta);
709 g.fillRoundRect(lastSSX + ofs, y + 4 + iconOffset, x2 - x1 - ofs
717 if (sCol == 0 || row[sCol - 1] == null
718 || row[sCol - 1].secondaryStructure != 'H')
720 g.fillArc(lastSSX, y + 4 + iconOffset, charWidth, 8, 90, 180);
724 if (!validRes || row[column] == null
725 || row[column].secondaryStructure != 'H')
727 g.fillArc((x * charWidth) - charWidth, y + 4 + iconOffset, charWidth,
732 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
735 public void drawLineGraph(Graphics g, AlignmentAnnotation _aa,
736 Annotation[] aa_annotations, int sRes, int eRes, int y,
737 float min, float max, int graphHeight)
739 if (sRes > aa_annotations.length)
746 // Adjustment for fastpaint to left
752 eRes = Math.min(eRes, aa_annotations.length);
760 float range = max - min;
765 y2 = y - (int) ((0 - min / range) * graphHeight);
768 g.setColor(Color.gray);
769 g.drawLine(x - charWidth, y2, (eRes - sRes + 1) * charWidth, y2);
771 eRes = Math.min(eRes, aa_annotations.length);
774 int aaMax = aa_annotations.length - 1;
776 while (x < eRes - sRes)
779 if (hasHiddenColumns)
781 column = columnSelection.adjustForHiddenColumns(column);
789 if (aa_annotations[column] == null
790 || aa_annotations[column - 1] == null)
796 if (aa_annotations[column].colour == null)
797 g.setColor(Color.black);
799 g.setColor(aa_annotations[column].colour);
802 - (int) (((aa_annotations[column - 1].value - min) / range) * graphHeight);
804 - (int) (((aa_annotations[column].value - min) / range) * graphHeight);
806 g.drawLine(x * charWidth - charWidth / 2, y1, x * charWidth
807 + charWidth / 2, y2);
811 if (_aa.threshold != null)
813 g.setColor(_aa.threshold.colour);
814 Graphics2D g2 = (Graphics2D) g;
815 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
816 BasicStroke.JOIN_ROUND, 3f, new float[]
819 y2 = (int) (y - ((_aa.threshold.value - min) / range) * graphHeight);
820 g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
821 g2.setStroke(new BasicStroke());
825 public void drawBarGraph(Graphics g, AlignmentAnnotation _aa,
826 Annotation[] aa_annotations, int sRes, int eRes, float min,
829 if (sRes > aa_annotations.length)
833 Font ofont = g.getFont();
834 eRes = Math.min(eRes, aa_annotations.length);
836 int x = 0, y1 = y, y2 = y;
838 float range = max - min;
842 y2 = y - (int) ((0 - min / (range)) * _aa.graphHeight);
845 g.setColor(Color.gray);
847 g.drawLine(x, y2, (eRes - sRes) * charWidth, y2);
850 int aaMax = aa_annotations.length - 1;
851 boolean renderHistogram = true, renderProfile = true, normaliseProfile = false;
852 // if (aa.autoCalculated && aa.label.startsWith("Consensus"))
854 // TODO: generalise this to have render styles for consensus/profile data
855 if (_aa.groupRef != null)
857 renderHistogram = _aa.groupRef.isShowConsensusHistogram();
858 renderProfile = _aa.groupRef.isShowSequenceLogo();
859 normaliseProfile = _aa.groupRef.isNormaliseSequenceLogo();
863 renderHistogram = av_renderHistogram;
864 renderProfile = av_renderProfile;
865 normaliseProfile = av_normaliseProfile;
868 while (x < eRes - sRes)
871 if (hasHiddenColumns)
873 column = columnSelection.adjustForHiddenColumns(column);
881 if (aa_annotations[column] == null)
886 if (aa_annotations[column].colour == null)
887 g.setColor(Color.black);
889 g.setColor(aa_annotations[column].colour);
892 - (int) (((aa_annotations[column].value - min) / (range)) * _aa.graphHeight);
898 g.fillRect(x * charWidth, y2, charWidth, y1 - y2);
902 g.fillRect(x * charWidth, y1, charWidth, y2 - y1);
905 // draw profile if available
909 int profl[] = getProfileFor(_aa, column);
910 // just try to draw the logo if profl is not null
911 if (profl != null && profl[1] != 0)
913 float ht = normaliseProfile ? y - _aa.graphHeight : y1;
914 double htn = normaliseProfile ? _aa.graphHeight : (y2 - y1);// aa.graphHeight;
921 * profl.length == 74 indicates that the profile of a secondary
922 * structure conservation row was accesed. Therefore dc gets length 2,
923 * to have space for a basepair instead of just a single nucleotide
925 if (profl.length == 74)
933 LineMetrics lm = g.getFontMetrics(ofont).getLineMetrics("Q", g);
934 double scale = 1f / (normaliseProfile ? profl[1] : 100f);
935 float ofontHeight = 1f / lm.getAscent();// magnify to fill box
937 for (int c = 2; c < profl[0];)
939 dc[0] = (char) profl[c++];
941 if (_aa.label.startsWith("StrucConsensus"))
943 dc[1] = (char) profl[c++];
947 wdth /= fm.charsWidth(dc, 0, dc.length);
951 scl = htn * scale * profl[c++];
952 lm = ofont.getLineMetrics(dc, 0, 1, g.getFontMetrics()
953 .getFontRenderContext());
954 g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
955 wdth, scl / lm.getAscent())));
956 lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
958 // Debug - render boxes around characters
959 // g.setColor(Color.red);
960 // g.drawRect(x*av.charWidth, (int)ht, av.charWidth,
962 // g.setColor(profcolour.findColour(dc[0]).darker());
963 g.setColor(profcolour.findColour(dc[0], column, null));
965 hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
966 .getBaselineIndex()]));
968 g.drawChars(dc, 0, dc.length, x * charWidth, (int) hght);
976 if (_aa.threshold != null)
978 g.setColor(_aa.threshold.colour);
979 Graphics2D g2 = (Graphics2D) g;
980 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
981 BasicStroke.JOIN_ROUND, 3f, new float[]
984 y2 = (int) (y - ((_aa.threshold.value - min) / range)
986 g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
987 g2.setStroke(new BasicStroke());
991 // used by overview window
992 public void drawGraph(Graphics g, AlignmentAnnotation _aa,
993 Annotation[] aa_annotations, int width, int y, int sRes, int eRes)
995 eRes = Math.min(eRes, aa_annotations.length);
996 g.setColor(Color.white);
997 g.fillRect(0, 0, width, y);
998 g.setColor(new Color(0, 0, 180));
1002 for (int j = sRes; j < eRes; j++)
1004 if (aa_annotations[j] != null)
1006 if (aa_annotations[j].colour == null)
1007 g.setColor(Color.black);
1009 g.setColor(aa_annotations[j].colour);
1011 height = (int) ((aa_annotations[j].value / _aa.graphMax) * y);
1017 g.fillRect(x, y - height, charWidth, height);