Java graphics suggestion.

Status
Not open for further replies.

lordhughes

Seniorius Lurkius
37
Hello all,

This is not a 'help me its not working thread', I am writing a new program but I am not sure how to go about one part of it.

I need to graphically represent binary strings, basically one colour for 0 another for 1. This is to show the evolution of a population of chromosomes(binary strings) over a certain number of generations.

What 3rd part library or java functions would people recommend to complete this task? I am not asking for code just a point in the direction towards a possibly solution.

Cheers,

John.
 

ShuggyCoUk

Ars Legatus Legionis
10,387
Subscriptor++
How many bits to a chromosome?
If the number is big then is there any locality you wish to represent? (i.e. 'genes' which are close to each other have relevance).
If so take a look at space filling curves such as the Hilbert curve.
For a simple java implementation google is your friend but here's the top one

If the chromosome is short then a simple bitmap will do the trick (that's what you have).

It does all rather depend on what sort of data you have and what is important about the visualization though...
 

dezzroy

Ars Scholae Palatinae
604
No need for a third party library. You can use the AWT or Swing libraries included in the JDK.

You could have a window and simply draw lines, fill shapes with colors, etc. after you devised a scheme to represent your binary strings.

You could just have a JPanel (if using Swing), and call drawLine() and fillRect() [draw rectangle with a solid color]... of course, there are a few more details, but it all depends on how complicated you want things.

http://docs.oracle.com/javase/tutorial/2d/TOC.html
 
Status
Not open for further replies.