A
A
Alexander Interesting2022-01-16 20:03:50
Java
Alexander Interesting, 2022-01-16 20:03:50

How to quickly draw a graph?

Decided to make a graph in Java, got this:

[GraphPoint{x=-3, y=9}, GraphPoint{x=-2, y=4}, GraphPoint{x=-1, y=1}, GraphPoint{x=0, y=0}, GraphPoint{x=1, y=1}, GraphPoint{x=2, y=4}, GraphPoint{x=3, y=9}]

Function: y = x*x

In general, how to draw a graph from these points, something like this:
images?q=tbn:ANd9GcRefJCp9wN98g8Q6vDttwctHLlDGdQrt43Buw&usqp=CAU
Only without any show-offs by the type of coordinate numbers, just a graph and points on it

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Orkhan, 2022-01-16
Hasanly @azerphoenix

Good afternoon.
You need to take advantage of the GUI libraries. For example, swing
https://stackoverflow.com/questions/8693342/drawin...
www.java2s.com/Code/Java/Advanced-Graphics/DrawMat...
In general, something like this...

W
Wan-Derer, 2022-01-17
@Wan-Derer

The java charting library request mostly references the JFreeChart library. If this is not quite what you need, there is also a video "JavaFX | How to plot functions?". As an approach - you can probably use it in Swing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question