From a4def188f05eb60a4a1b58183ea151734e5d41ba Mon Sep 17 00:00:00 2001 From: tcarver <tjc> Date: Fri, 20 Sep 2013 12:33:25 +0100 Subject: [PATCH] changes for showing line labels in the legend --- uk/ac/sanger/artemis/components/Plot.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/uk/ac/sanger/artemis/components/Plot.java b/uk/ac/sanger/artemis/components/Plot.java index 5a24f1de1..07eb3a980 100644 --- a/uk/ac/sanger/artemis/components/Plot.java +++ b/uk/ac/sanger/artemis/components/Plot.java @@ -1031,11 +1031,12 @@ public abstract class Plot extends JPanel final FontMetrics fm = g.getFontMetrics(); int font_width = fm.stringWidth("2"); - int width = getWidth() - window_changer.getWidth() - - ((5*numPlots)*font_width); + int width = 0; + for(LineAttributes ln : lines) + width += ln.getLabelWidth(fm); + width = getWidth() - window_changer.getWidth() - width; g.translate(width,0); - // note GCFrameAlgorithm overrides this ((BaseAlgorithm)getAlgorithm()).drawLegend(g,font_height, font_width,lines, numPlots); g.translate(-width,0); -- GitLab