I'm currently trying to think of a way to plot a graph in Java.
The basic way my program is meant to work is it finds a users .csv file and in there will be some sort of habit and the date. So like drove 5 miles on 24.10.13.
So I need to be able to extract the 5 and the 24.10.13 and take those as my Y and X co-ordinates respectively as other things are measured against date and it makes sense to have that as the X value.
So is there a library I can import or a Function I'm not aware of and could you give a simple example on how to use it?
NOTE - I've done my GUI in JavaFX as I'm not that great in JFrame and I know nothing of Swing
JavaFX has built-in charts. You may check it out. That way, you won't need any external libraries.
How about using JFreeChart to plot your data? You can see some samples here. JGraph seems to be geared towards visualizing graphs, not for plotting functions.
Related
I have a table with the following structure:
[relation, variable1, variable2]
I would like to visualize those relation over a triangular matrix, something like this but with any number of variables and not only 4. Is there any free java library to do so? any ideas on how to visualize it by my own?
I don't have any code yet, Just thinking about the idea and process of how doing it.
much appreciation to all :)
I suggest you use a Swing framework that is natively provided by Java so you don't have to import any external library for this task.
I think painting this matrix (as in your link) is not difficult using Swing.
I find this discussion very useful for your case How to draw grid using swing class Java and detect mouse position when click and drag
Because it provides an example of painting a matrix.
I am going through Java AWT & Swings and came to know on how to create the basic GUI elements and I was able to work on some programs with it. But when I am trying to understand how to create Graphs for some complex mathematical equations then I was not able to find some documentation or any examples.
For example, in this post - How to solve the trigonometric equation cos(πθ/β)−cos(2πθ/β)=0?
the user has given some complex equation and also shown how the graphs looks like.
But how can we write a Java program for this equation that generates the graph GUI as output?
Can someone please point me to some documentation or links so that I can understand how to achieve this in Java?
Thanks in advance.
I had similar question on this, go through these links to understand how to create the GUI in Java:
Java Swing GUI for equation 5((θ/β) - cos(2πθ/β))
Java Swing GUI for equation 5((θ/β) - cos(2πθ/β)) - to draw continuous graph
I'm working on a new project that will require some 3d rendering. I am planning on writing all of the calculations for each individual pixel (bypassing a graphics engine), and I'd like to do it with Javascript, but I don't know if there's a way. Posting HTML to display thousands of pixels is way too slow. I need something quick and responsive, so I'm considering using JAVA.
My question is, do either of these have the ability to perform calculations on individual pixels, quickly? And how would I access the display in such a way?
Thanks
If you have the time to get familiar with OpenGL, you could use OpenGL in java:
http://en.wikipedia.org/wiki/Java_OpenGL
This would allow you to directly manipulate a specified OpenGL-frame. Kindof like what runescape does.
So I have a data file with points to make a histogram. I have no idea how I would do this. I in a first year java course and am supposed to make 'bins' and count how many of each point fall into each bin. Thanks
I'm unclear what your real objective is. Do you have to write a graphical histogram, or a text-based histogram (easy for a horizontal histogram), or make use of an existing library.
You can use the open-source JFreechart to create a histogram.
I need to draw some execution sequences for some real time systems scheduled using rate monotonic algorithm. The drawing has to be done using Java and it has to be very basic.
Do you a very simple way to do this drawing? Simpler than Graphics2D?
Thanks a lot!
The diagram I want to be as simple or even simpler as this one:
I would suggest you to try with Processing, which is able to do such things with Java in zero time.. home page here.
You can easily embed a Processing frame inside your app, but remember that they are based on AWT so they are heavy weight and don't like being overlayed (for example in a JInternalFrame)
By the way what you seem to want to draw is a Gantt chart right?
You can try with JFreeChart too (see demo here), it's quite customizable and works fine.. homepage here