Post

3 followers Follow
0
Avatar

Legend for Graphs

I'm developing a plugin to show crossovers between parental sequences and a descendant.

 

Here an output example:

I would like to have a legend included in the name. Ideally it would allow colors

but at least something like

Crossover new line

AAV2 in Blue

AAV5 in Green

 

If I do:


@Override
public String getName() {
return "Crossover\nAAV2 in Blue\nAAV5in Green";
}


is not working since I expect that to be a textfield. I also see a couple of methods like drawscale and getLegendName.

How can that be done?

 

Cheers,

Adrian

Adrian

Please sign in to leave a comment.

4 comments

0
Avatar

Hi Adrian,

It sounds like you want to implement the following:

https://assets.geneious.com/developer/geneious/javadoc/latest/com/biomatters/geneious/publicapi/plugin/SequenceGraph.html#getScaleBarWidth--

https://assets.geneious.com/developer/geneious/javadoc/latest/com/biomatters/geneious/publicapi/plugin/GeneiousGraphics2D.html

This will allow you to draw whatever you want to the right of the name.  You could just draw the two strings in the colours you want.

Geneious Team 0 votes
Comment actions Permalink
0
Avatar

Hello Matthew,

 

 

Thank you. That works perfectly. 

Is there any way to set 

@Override
public int getScaleBarWidth() {
return dynamically;
}

dynamically? I need a handle to graphics so I could get the fontMetrics
and calculate the width of the longest sequence name string.

Cheers,
Adrian

Adrian 0 votes
Comment actions Permalink
0
Avatar

Hi Adrian,

Sorry for the extremely late reply.  I just realised that I had been replying to posts using our shared Geneious Team account and didn't get notified of your responses.

Anyway hopefully you already figured this one out.  There isn't really a way to do it dynamically so you should just return a value that you think is reasonably big enough.  If the sequence name extends beyond that then perhaps use "...".

Matthew Cheung 0 votes
Comment actions Permalink
0
Avatar

Hi Matt,

 

I guess I'll leave it like as is. Maybe you could consider for further versions offering a way to access the Graphics context.

That's fine with the late reply. As a company you are still one of the fastest respondents to the customer queries, well above industry standards.

 

 

Cheers

Adrian 0 votes
Comment actions Permalink