• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generating dynamic graphs @ runtime?  RSS feed

 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This task is very new for me. Ok, here is what I have to do:

1) The user will input a square matrix in a text file.
2) Java program will read this text file and will validate whether the input matrix is square or not? If yes then continue; else error screen.
3) After successfull validation, it will create a graph based on the values of matrix.
4) The created (generated) graph (image) will be displayed as an output to the user on his browser.

The business logic here is the method of creating graph based on matrix values. This method I know well on paper-pencil. But implementing the same in Java code and generating the graph is bit new. The later part, i.e. generating the graph is in fact the actual task.

I've developed an explained example with matrix (input) and the generated graph (output) here.

In the graph, you will see objects are linked with each other via arrows. This linking is decided on the matrix values. Most probably, I will be having images of objets saved in my haardisk. Only Linking them @ runtime have to be done.

Looking forward for the guideline to start implementing the task.

Thanks,

Bye,
Viki.
 
Joni Salonen
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You'll need an algorithm to layout graphs. There are several algorithms, most of them fairly complicated. Most likely you'll want to use a 3rd party library. Searching the web for the words "java graph layout algorithm" or some subset of them will get you results.

There's an applet demo from Sun that lays out a graph "live" here:
http://java.sun.com/applets/jdk/1.4/demo/applets/GraphLayout/example1.html
 
Chunduru Anil Kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well as far as I think, using a third party library will not help you much, as you would be spending quite a lot of time in searching for an appropriate library. Moreover it might not be flexible for your future needs. I would suggest that you write code for yourself.

You will have to write a program using Java Swing, which deals with graphics, and that would surely help you out.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!