5

I would create a java program to save a graph as image PNG for example with the following data:

x-axis: 01  02  03  04  05  06  07  08  09  10 
y-axis: 610 635 659 680 699 712 722 732 736 749
Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
ezzitt
  • 117
  • 2
  • 5
  • 1
    Your question is very broad meaning you're likely coming here too soon in your development process. I suggest that you break the big problem into small constituent steps and then try to solve each single step one at a time. Come back with your specific answerable question and your code if stuck after attempting this. – Hovercraft Full Of Eels Apr 17 '16 at 18:40

3 Answers3

2

Theoretically you'd do that following these steps. Actually you have to first learn how to work with particular parts:

  1. Save these coordinates to an array or a List.
  2. Draw the content using javafx or any graphics library.
  3. Read the: https://community.oracle.com/thread/2450090?tstart=0
  4. In case of using javafx, you can capture its canvas with canvas.snapshot(..)
  5. Save the file using ImageIO.write(SwingFXUtils.fromFXImage(wim, null), "png", file);
  6. Hooray!

I recommend you to start with learning all about variables, data types, arrays, loops and lists/maps. Don't start with 2D drawing unless you can handle with data :)

Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
1

Try dotty.exe to create graphs. Use graphviz open source.

Bart Mensfort
  • 995
  • 11
  • 21
1

Try to use JGraphX to create graphs in java. You could find maven dependency on github. To save tree graph try java JGraphx save as an image

Jens Bannmann
  • 4,845
  • 5
  • 49
  • 76
Damian JK
  • 479
  • 1
  • 3
  • 9