From e75185452772cc0440c0050fad0403b73ed9472b Mon Sep 17 00:00:00 2001
From: tcarver <tjc>
Date: Fri, 20 Sep 2013 12:32:22 +0100
Subject: [PATCH] display the line label if present in the legend
---
uk/ac/sanger/artemis/plot/BaseAlgorithm.java | 41 +++++++-------------
1 file changed, 14 insertions(+), 27 deletions(-)
diff --git a/uk/ac/sanger/artemis/plot/BaseAlgorithm.java b/uk/ac/sanger/artemis/plot/BaseAlgorithm.java
index 9bb8e4eef..f644cc2ea 100644
--- a/uk/ac/sanger/artemis/plot/BaseAlgorithm.java
+++ b/uk/ac/sanger/artemis/plot/BaseAlgorithm.java
@@ -118,45 +118,32 @@ public abstract class BaseAlgorithm extends Algorithm
if( (strand.isForwardStrand() && !isRevCompDisplay()) ||
(!strand.isForwardStrand() && isRevCompDisplay()))
- {
+ {
+ int width = 0;
for(int i=0; i<numPlots; i++)
{
g2d.setColor(Color.black);
- g2d.drawString(Integer.toString(i+1),i*5*font_width,font_height);
+
+ if(lines[i].getLabel() != null) // user defined label
+ {
+ g2d.drawString(lines[i].getLabel(),width,font_height);
+ width += lines[i].getLabelWidth(fm);
+ }
+ else
+ {
+ g2d.drawString(Integer.toString(i+1),width,font_height);
+ width += 5*font_width;
+ }
BasicStroke stroke = (BasicStroke)g2d.getStroke();
g2d.setStroke(new BasicStroke(3.f));
g2d.setColor(lines[i].getLineColour());
- g2d.drawLine(font_width*(2 + (i*5)), lineHgt, font_width*(4 + (i*5)), lineHgt);
+ g2d.drawLine(width - (font_width*1), lineHgt, width - (font_width*3), lineHgt);
g2d.setStroke(stroke);
}
}
else
{
-
- /*
- int frame = strand.getSequenceLength() % 3;
- g2d.setColor(Color.black);
-
- g2d.drawString("4",0,font_height);
- g2d.drawString("5",font_width*5,font_height);
- g2d.drawString("6",font_width*10,font_height);
-
- BasicStroke stroke = (BasicStroke)g2d.getStroke();
- g2d.setStroke(new BasicStroke(3.f));
-
-
- g2d.setColor(frameColour[0]);
- g2d.drawLine(font_width*2, lineHgt, font_width*4, lineHgt);
-
- g2d.setColor(frameColour[2]);
- g2d.drawLine(font_width*7, lineHgt, font_width*9, lineHgt);
-
- g2d.setColor(frameColour[1]);
- g2d.drawLine(font_width*12, lineHgt, font_width*14, lineHgt);
- g2d.setStroke(stroke);
- */
-
g2d.setColor(Color.black);
g2d.drawString("4",0,font_height);
g2d.drawString("5",font_width*5,font_height);
--
GitLab