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.Hashtable;
40 import com.stevesoft.pat.Regex;
42 public class AnnotationRenderer
45 public AnnotationRenderer()
47 // TODO Auto-generated constructor stub
50 public void drawStemAnnot(Graphics g, Annotation[] row_annotations,
51 int lastSSX, int x, int y, int iconOffset, int startRes,
52 int column, boolean validRes, boolean validEnd)
54 g.setColor(STEM_COLOUR);
55 int sCol = (lastSSX / charWidth) + startRes;
57 int x2 = (x * charWidth);
58 Regex closeparen = new Regex("(\\))");
60 String dc = (column == 0 || row_annotations[column - 1] == null) ? ""
61 : row_annotations[column - 1].displayCharacter;
63 boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
64 || !dc.equals(row_annotations[sCol - 1].displayCharacter);
65 boolean diffdownstream = !validRes || !validEnd
66 || row_annotations[column] == null
67 || !dc.equals(row_annotations[column].displayCharacter);
68 // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
69 // If a closing base pair half of the stem, display a backward arrow
70 if (column > 0 && closeparen.search(dc))
73 // if (validRes && column>1 && row_annotations[column-2]!=null &&
74 // dc.equals(row_annotations[column-2].displayCharacter))
76 g.fillPolygon(new int[]
77 { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
78 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
88 // display a forward arrow
91 g.fillPolygon(new int[]
92 { x2 - 5, x2 - 5, x2 }, new int[]
93 { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
102 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
105 private int charWidth, endRes, charHeight;
107 private boolean validCharWidth, hasHiddenColumns;
109 private FontMetrics fm;
111 private final boolean MAC = new jalview.util.Platform().isAMac();
113 boolean av_renderHistogram = true, av_renderProfile = true,
114 av_normaliseProfile = false;
116 ColourSchemeI profcolour = null;
118 private ColumnSelection columnSelection;
120 private Hashtable[] hconsensus;
122 private Hashtable[] hStrucConsensus;
124 private boolean av_ignoreGapsConsensus;
127 * attributes set from AwtRenderPanelI
130 * old image used when data is currently being calculated and cannot be
133 private Image fadedImage;
136 * panel being rendered into
138 private ImageObserver annotationPanel;
141 * width of image to render in panel
143 private int imgWidth;
145 // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
147 public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
150 fm = annotPanel.getFontMetrics();
151 annotationPanel = annotPanel;
152 fadedImage = annotPanel.getFadedImage();
153 imgWidth = annotPanel.getFadedImageWidth();
154 updateFromAlignViewport(av);
157 public void updateFromAlignViewport(AlignViewportI av)
159 charWidth = av.getCharWidth();
160 endRes = av.getEndRes();
161 charHeight = av.getCharHeight();
162 hasHiddenColumns = av.hasHiddenColumns();
163 validCharWidth = av.isValidCharWidth();
164 av_renderHistogram = av.isShowConsensusHistogram();
165 av_renderProfile = av.isShowSequenceLogo();
166 av_normaliseProfile = av.isNormaliseSequenceLogo();
167 profcolour = av.getGlobalColourScheme();
168 if (profcolour == null)
170 // Set the default colour for sequence logo if the alignnent has no
172 profcolour = av.getAlignment().isNucleotide() ? new jalview.schemes.NucleotideColourScheme()
173 : new jalview.schemes.ZappoColourScheme();
175 columnSelection = av.getColumnSelection();
176 hconsensus = av.getSequenceConsensusHash();// hconsensus;
177 hStrucConsensus = av.getRnaStructureConsensusHash(); // hStrucConsensus;
178 av_ignoreGapsConsensus = av.getIgnoreGapsConsensus();
181 public int[] getProfileFor(AlignmentAnnotation aa, int column)
183 // TODO : consider refactoring the global alignment calculation
184 // properties/rendering attributes as a global 'alignment group' which holds
185 // all vis settings for the alignment as a whole rather than a subset
187 if (aa.autoCalculated && aa.label.startsWith("Consensus"))
189 if (aa.groupRef != null && aa.groupRef.consensusData != null
190 && aa.groupRef.isShowSequenceLogo())
192 return AAFrequency.extractProfile(
193 aa.groupRef.consensusData[column],
194 aa.groupRef.getIgnoreGapsConsensus());
196 // TODO extend annotation row to enable dynamic and static profile data to
198 if (aa.groupRef == null && aa.sequenceRef == null && av_renderProfile)
200 return AAFrequency.extractProfile(hconsensus[column],
201 av_ignoreGapsConsensus);
206 if (aa.autoCalculated && aa.label.startsWith("StrucConsensus"))
208 // TODO implement group structure consensus
210 * if (aa.groupRef != null && aa.groupRef.consensusData != null &&
211 * aa.groupRef.isShowSequenceLogo()) { //TODO check what happens for
212 * group selections return StructureFrequency.extractProfile(
213 * aa.groupRef.consensusData[column], aa.groupRef
214 * .getIgnoreGapsConsensus()); }
216 // TODO extend annotation row to enable dynamic and static profile data
219 if (aa.groupRef == null && aa.sequenceRef == null
220 && av_renderProfile && hStrucConsensus != null
221 && hStrucConsensus.length > column)
223 return StructureFrequency.extractProfile(hStrucConsensus[column],
224 av_ignoreGapsConsensus);
232 * Render the annotation rows associated with an alignment.
237 * data and view settings to render
239 * destination for graphics
241 * row where a mouse event occured (or -1)
243 * first column that will be drawn
245 * last column that will be drawn
246 * @return true if the fadedImage was used for any alignment annotation rows
247 * currently being calculated
249 public boolean drawComponent(AwtRenderPanelI annotPanel,
250 AlignViewportI av, Graphics g, int activeRow, int startRes,
253 boolean usedFaded = false;
255 // AnnotationPanel needs to implement: ImageObserver, access to
257 updateFromAwtRenderPanel(annotPanel, av);
258 fm = g.getFontMetrics();
259 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
269 boolean validRes = false;
270 boolean validEnd = false;
271 boolean labelAllCols = false;
272 boolean centreColLabels, centreColLabelsDef = av
273 .getCentreColumnLabels();
274 boolean scaleColLabel = false;
275 boolean[] graphGroupDrawn = new boolean[aa.length];
276 int charOffset = 0; // offset for a label
277 float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
279 Font ofont = g.getFont();
281 for (int i = 0; i < aa.length; i++)
283 AlignmentAnnotation row = aa[i];
284 Annotation[] row_annotations = row.annotations;
289 centreColLabels = row.centreColLabels || centreColLabelsDef;
290 labelAllCols = row.showAllColLabels;
291 scaleColLabel = row.scaleColLabel;
296 if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
301 // this is so that we draw the characters below the graph
306 iconOffset = charHeight - fm.getDescent();
310 else if (row.hasText)
312 iconOffset = charHeight - fm.getDescent();
320 if (row.autoCalculated && av.isCalculationInProgress(row))
324 g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
325 - row.height, imgWidth, y, annotationPanel);
326 g.setColor(Color.black);
327 // g.drawString("Calculating "+aa[i].label+"....",20, y-row.height/2);
333 * else if (annotationPanel.av.updatingConservation &&
334 * aa[i].label.equals("Conservation")) {
336 * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
337 * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
338 * annotationPanel.imgWidth, y, annotationPanel);
340 * g.setColor(Color.black); //
341 * g.drawString("Calculating Conservation.....",20, y-row.height/2);
343 * continue; } else if (annotationPanel.av.updatingConservation &&
344 * aa[i].label.equals("Quality")) {
346 * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
347 * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
348 * annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black);
349 * // / g.drawString("Calculating Quality....",20, y-row.height/2);
353 // first pass sets up state for drawing continuation from left-hand column
355 x = (startRes == 0) ? 0 : -1;
356 while (x < endRes - startRes)
358 if (hasHiddenColumns)
360 column = columnSelection.adjustForHiddenColumns(startRes + x);
361 if (column > row_annotations.length - 1)
368 column = startRes + x;
371 if ((row_annotations == null) || (row_annotations.length <= column)
372 || (row_annotations[column] == null))
384 g.setColor(Color.red);
386 if (columnSelection != null)
388 for (int n = 0; n < columnSelection.size(); n++)
390 int v = columnSelection.columnAt(n);
394 g.fillRect(x * charWidth, y, charWidth, charHeight);
399 if (!row.isValidStruc())
401 g.setColor(Color.orange);
402 g.fillRect((int) row.getInvalidStrucPos() * charWidth, y,
403 charWidth, charHeight);
407 && row_annotations[column].displayCharacter != null
408 && (row_annotations[column].displayCharacter.length() > 0))
411 if (centreColLabels || scaleColLabel)
413 fmWidth = fm.charsWidth(
414 row_annotations[column].displayCharacter
416 row_annotations[column].displayCharacter.length());
420 // justify the label and scale to fit in column
421 if (fmWidth > charWidth)
423 // scale only if the current font isn't already small enough
424 fmScaling = charWidth;
425 fmScaling /= fmWidth;
426 g.setFont(ofont.deriveFont(AffineTransform
427 .getScaleInstance(fmScaling, 1.0)));
428 // and update the label's width to reflect the scaling.
436 .charWidth(row_annotations[column].displayCharacter
439 charOffset = (int) ((charWidth - fmWidth) / 2f);
441 if (row_annotations[column].colour == null)
442 g.setColor(Color.black);
444 g.setColor(row_annotations[column].colour);
446 if (column == 0 || row.graph > 0)
448 g.drawString(row_annotations[column].displayCharacter,
449 (x * charWidth) + charOffset, y + iconOffset);
451 else if (row_annotations[column - 1] == null
453 || !row_annotations[column].displayCharacter
454 .equals(row_annotations[column - 1].displayCharacter) || (row_annotations[column].displayCharacter
455 .length() < 2 && row_annotations[column].secondaryStructure == ' ')))
457 g.drawString(row_annotations[column].displayCharacter, x
458 * charWidth + charOffset, y + iconOffset);
465 char ss = validRes ? row_annotations[column].secondaryStructure
469 // distinguish between forward/backward base-pairing
470 if (row_annotations[column].displayCharacter.indexOf(')') > -1)
475 if (!validRes || (ss != lastSS))
482 drawHelixAnnot(g, row_annotations, lastSSX, x, y,
483 iconOffset, startRes, column, validRes, validEnd);
487 drawSheetAnnot(g, row_annotations, lastSSX, x, y,
488 iconOffset, startRes, column, validRes, validEnd);
491 case 'S': // Stem case for RNA secondary structure
492 case 's': // and opposite direction
493 drawStemAnnot(g, row_annotations, lastSSX, x, y,
494 iconOffset, startRes, column, validRes, validEnd);
498 g.setColor(Color.gray);
499 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
515 lastSSX = (x * charWidth);
522 if (column >= row_annotations.length)
524 column = row_annotations.length - 1;
531 if ((row_annotations == null) || (row_annotations.length <= column)
532 || (row_annotations[column] == null))
548 drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
549 startRes, column, validRes, validEnd);
553 drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
554 startRes, column, validRes, validEnd);
557 case 'S': // Stem case for RNA secondary structure
558 drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
559 startRes, column, validRes, validEnd);
562 drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset,
563 startRes, column, validRes, validEnd);
568 if (row.graph > 0 && row.graphHeight > 0)
570 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
572 if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
574 float groupmax = -999999, groupmin = 9999999;
575 for (int gg = 0; gg < aa.length; gg++)
577 if (aa[gg].graphGroup != row.graphGroup)
584 aa[gg].visible = false;
586 if (aa[gg].graphMax > groupmax)
588 groupmax = aa[gg].graphMax;
590 if (aa[gg].graphMin < groupmin)
592 groupmin = aa[gg].graphMin;
596 for (int gg = 0; gg < aa.length; gg++)
598 if (aa[gg].graphGroup == row.graphGroup)
600 drawLineGraph(g, aa[gg], aa[gg].annotations, startRes,
601 endRes, y, groupmin, groupmax, row.graphHeight);
605 graphGroupDrawn[row.graphGroup] = true;
609 drawLineGraph(g, row, row_annotations, startRes, endRes, y,
610 row.graphMin, row.graphMax, row.graphHeight);
613 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
615 drawBarGraph(g, row, row_annotations, startRes, endRes,
616 row.graphMin, row.graphMax, y);
620 if (row.graph > 0 && row.hasText)
633 private final Color GLYPHLINE_COLOR = Color.gray;
635 private final Color SHEET_COLOUR = Color.green;
637 private final Color HELIX_COLOUR = Color.red;
639 private final Color STEM_COLOUR = Color.blue;
641 public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX,
642 int x, int y, int iconOffset, int startRes, int column,
643 boolean validRes, boolean validEnd)
645 g.setColor(GLYPHLINE_COLOR);
646 g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2);
649 public void drawSheetAnnot(Graphics g, Annotation[] row, int lastSSX,
650 int x, int y, int iconOffset, int startRes, int column,
651 boolean validRes, boolean validEnd)
653 g.setColor(SHEET_COLOUR);
655 if (!validEnd || !validRes || row == null || row[column] == null
656 || row[column].secondaryStructure != 'E')
658 g.fillRect(lastSSX, y + 4 + iconOffset,
659 (x * charWidth) - lastSSX - 4, 7);
660 g.fillPolygon(new int[]
661 { (x * charWidth) - 4, (x * charWidth) - 4, (x * charWidth) },
663 { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset },
668 g.fillRect(lastSSX, y + 4 + iconOffset,
669 (x + 1) * charWidth - lastSSX, 7);
674 public void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX,
675 int x, int y, int iconOffset, int startRes, int column,
676 boolean validRes, boolean validEnd)
678 g.setColor(HELIX_COLOUR);
680 int sCol = (lastSSX / charWidth) + startRes;
682 int x2 = (x * charWidth);
686 int ofs = charWidth / 2;
687 // Off by 1 offset when drawing rects and ovals
688 // to offscreen image on the MAC
689 g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1, 8, 8, 8);
690 if (sCol == 0 || row[sCol - 1] == null
691 || row[sCol - 1].secondaryStructure != 'H')
696 // g.setColor(Color.orange);
697 g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1 - ofs + 1, 8,
700 if (!validRes || row[column] == null
701 || row[column].secondaryStructure != 'H')
707 // g.setColor(Color.magenta);
708 g.fillRoundRect(lastSSX + ofs, y + 4 + iconOffset, x2 - x1 - ofs
716 if (sCol == 0 || row[sCol - 1] == null
717 || row[sCol - 1].secondaryStructure != 'H')
719 g.fillArc(lastSSX, y + 4 + iconOffset, charWidth, 8, 90, 180);
723 if (!validRes || row[column] == null
724 || row[column].secondaryStructure != 'H')
726 g.fillArc((x * charWidth) - charWidth, y + 4 + iconOffset, charWidth,
731 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
734 public void drawLineGraph(Graphics g, AlignmentAnnotation _aa,
735 Annotation[] aa_annotations, int sRes, int eRes, int y,
736 float min, float max, int graphHeight)
738 if (sRes > aa_annotations.length)
745 // Adjustment for fastpaint to left
751 eRes = Math.min(eRes, aa_annotations.length);
759 float range = max - min;
764 y2 = y - (int) ((0 - min / range) * graphHeight);
767 g.setColor(Color.gray);
768 g.drawLine(x - charWidth, y2, (eRes - sRes + 1) * charWidth, y2);
770 eRes = Math.min(eRes, aa_annotations.length);
773 int aaMax = aa_annotations.length - 1;
775 while (x < eRes - sRes)
778 if (hasHiddenColumns)
780 column = columnSelection.adjustForHiddenColumns(column);
788 if (aa_annotations[column] == null
789 || aa_annotations[column - 1] == null)
795 if (aa_annotations[column].colour == null)
796 g.setColor(Color.black);
798 g.setColor(aa_annotations[column].colour);
801 - (int) (((aa_annotations[column - 1].value - min) / range) * graphHeight);
803 - (int) (((aa_annotations[column].value - min) / range) * graphHeight);
805 g.drawLine(x * charWidth - charWidth / 2, y1, x * charWidth
806 + charWidth / 2, y2);
810 if (_aa.threshold != null)
812 g.setColor(_aa.threshold.colour);
813 Graphics2D g2 = (Graphics2D) g;
814 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
815 BasicStroke.JOIN_ROUND, 3f, new float[]
818 y2 = (int) (y - ((_aa.threshold.value - min) / range) * graphHeight);
819 g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
820 g2.setStroke(new BasicStroke());
824 public void drawBarGraph(Graphics g, AlignmentAnnotation _aa,
825 Annotation[] aa_annotations, int sRes, int eRes, float min,
828 if (sRes > aa_annotations.length)
832 Font ofont = g.getFont();
833 eRes = Math.min(eRes, aa_annotations.length);
835 int x = 0, y1 = y, y2 = y;
837 float range = max - min;
841 y2 = y - (int) ((0 - min / (range)) * _aa.graphHeight);
844 g.setColor(Color.gray);
846 g.drawLine(x, y2, (eRes - sRes) * charWidth, y2);
849 int aaMax = aa_annotations.length - 1;
850 boolean renderHistogram = true, renderProfile = true, normaliseProfile = false;
851 // if (aa.autoCalculated && aa.label.startsWith("Consensus"))
853 // TODO: generalise this to have render styles for consensus/profile data
854 if (_aa.groupRef != null)
856 renderHistogram = _aa.groupRef.isShowConsensusHistogram();
857 renderProfile = _aa.groupRef.isShowSequenceLogo();
858 normaliseProfile = _aa.groupRef.isNormaliseSequenceLogo();
862 renderHistogram = av_renderHistogram;
863 renderProfile = av_renderProfile;
864 normaliseProfile = av_normaliseProfile;
867 while (x < eRes - sRes)
870 if (hasHiddenColumns)
872 column = columnSelection.adjustForHiddenColumns(column);
880 if (aa_annotations[column] == null)
885 if (aa_annotations[column].colour == null)
886 g.setColor(Color.black);
888 g.setColor(aa_annotations[column].colour);
891 - (int) (((aa_annotations[column].value - min) / (range)) * _aa.graphHeight);
897 g.fillRect(x * charWidth, y2, charWidth, y1 - y2);
901 g.fillRect(x * charWidth, y1, charWidth, y2 - y1);
904 // draw profile if available
908 int profl[] = getProfileFor(_aa, column);
909 // just try to draw the logo if profl is not null
910 if (profl != null && profl[1] != 0)
912 float ht = normaliseProfile ? y - _aa.graphHeight : y1;
913 double htn = normaliseProfile ? _aa.graphHeight : (y2 - y1);// aa.graphHeight;
920 * profl.length == 74 indicates that the profile of a secondary
921 * structure conservation row was accesed. Therefore dc gets length 2,
922 * to have space for a basepair instead of just a single nucleotide
924 if (profl.length == 74)
932 LineMetrics lm = g.getFontMetrics(ofont).getLineMetrics("Q", g);
933 double scale = 1f / (normaliseProfile ? profl[1] : 100f);
934 float ofontHeight = 1f / lm.getAscent();// magnify to fill box
936 for (int c = 2; c < profl[0];)
938 dc[0] = (char) profl[c++];
940 if (_aa.label.startsWith("StrucConsensus"))
942 dc[1] = (char) profl[c++];
946 wdth /= fm.charsWidth(dc, 0, dc.length);
950 scl = htn * scale * profl[c++];
951 lm = ofont.getLineMetrics(dc, 0, 1, g.getFontMetrics()
952 .getFontRenderContext());
953 g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
954 wdth, scl / lm.getAscent())));
955 lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
957 // Debug - render boxes around characters
958 // g.setColor(Color.red);
959 // g.drawRect(x*av.charWidth, (int)ht, av.charWidth,
961 // g.setColor(profcolour.findColour(dc[0]).darker());
962 g.setColor(profcolour.findColour(dc[0], column, null));
964 hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
965 .getBaselineIndex()]));
967 g.drawChars(dc, 0, dc.length, x * charWidth, (int) hght);
975 if (_aa.threshold != null)
977 g.setColor(_aa.threshold.colour);
978 Graphics2D g2 = (Graphics2D) g;
979 g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
980 BasicStroke.JOIN_ROUND, 3f, new float[]
983 y2 = (int) (y - ((_aa.threshold.value - min) / range)
985 g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
986 g2.setStroke(new BasicStroke());
990 // used by overview window
991 public void drawGraph(Graphics g, AlignmentAnnotation _aa,
992 Annotation[] aa_annotations, int width, int y, int sRes, int eRes)
994 eRes = Math.min(eRes, aa_annotations.length);
995 g.setColor(Color.white);
996 g.fillRect(0, 0, width, y);
997 g.setColor(new Color(0, 0, 180));
1001 for (int j = sRes; j < eRes; j++)
1003 if (aa_annotations[j] != null)
1005 if (aa_annotations[j].colour == null)
1006 g.setColor(Color.black);
1008 g.setColor(aa_annotations[j].colour);
1010 height = (int) ((aa_annotations[j].value / _aa.graphMax) * y);
1016 g.fillRect(x, y - height, charWidth, height);