Real-time Java graph / chart library? [closed]
Asked Answered
R

12

29

There was an earlier thread on Java graph or chart library, where JFreeChart was found to be quite good, but, as stated in its FAQ, it's not meant for real-time rendering.

Can anyone recommend a comparable library that supports real-time rendering? Just some basic xy-rendering - for instance, getting a voltage signal from data acquisition system and plotting it as it comes (time on x-axis, voltage on y-axis).

Rebane answered 17/2, 2009 at 7:33 Comment(2)
do you mean real-time or "amortized" real-time? (the latter being something that is responsive enough to look real-time to a human being, but no guarantees that occasionally it may slow down. If I need a hard real-time guarantee on something, it is usually related to propagation delay limits, and not very often related to human factors.)Kailakaile
I mean the latter - it's certainly enough that it looks real-time. This probably means something like 10 redraws / second.Rebane
W
9

What the FAQ actually says is that JFreeChart doesn't support hard real-time charting, meaning that the chart isn't updated when new data arrives or at deterministic interval after it. However I have found that JFreeChart can be used for the kind of applications you are describing. You can achieve 1 update per second, which is fine. I don't think a human eye can follow something quicker than this.

If you want something more than this, I doubt you will find anything in Java (or even in another language). Operating Systems that we use aren't designed to be real time. You can't have a guaranty that they will respond in a minimum interval after an event. A tight integration with the hardware driver will be needed to show more than 1-10 frames per second.

However, if you design your application correctly, the OS will do respond quickly and your application can easily display a "real-time" graph (meaning a graph that updates once a second). Just don't use your application to shut down a valve in an emergency situation!

Wen answered 17/2, 2009 at 8:10 Comment(7)
Well, we're on a kind of boundary here. 1/s is certainly jerky for the eye if the data is changing much faster. 10/s would be fine, but JFreeChart can't probably do it.Rebane
Well if you calculate the data, then you could do 10 f/s in Java. I believe however that there is no way to do that if the data come from a data acquisition device. In that case you would need to communicate with the driver directly; this would be a much more difficult problem to solve.Wen
+1 I've used JFreeChart for a real-time graph of stock prices.Mattern
@kgiannakakis: ?! do you mean 10f/s as in 10 complete frames, or 10 incremental updates per second? I'm looking for a strip chart recorder, 1 updates/second is way too slow. Besides, there are a lot of data acquisition hardware modules that are pretty speedy, 10Ksamples/second is nothing. (whether any of them will work with Java is another story.... :( argh)Kailakaile
I mean 10 updates per second. Each update will cover more than one frame. You'll never know if it is tolerable until you do some real tests.Wen
Sorry, but I couldn't agree less... If that were true, than how would we get those games with near-realistic graphics? We can create virtual worlds, but can't guarantee a decent update rate for... Chart?Tnt
For anyone still looking at this, I'm currently using JFreeChart to generate a "real-time" graph, with up to 100 updates per second (each adding and removing a single datapoint, basically shifting the complete set). I'm not saying that it's actually doing each frame at exactly 10 ms, but it doesn't lag behind the data, and it looks real-time enough for my purpose.Bargeman
M
7

http://www.live-graph.org/

Moonfaced answered 17/2, 2009 at 8:30 Comment(0)
F
6

Just stumbled upon a description on how to use the visualvm charting library. Looks very nice!

Forswear answered 23/11, 2010 at 19:23 Comment(1)
Yes! This is pretty much exactly what I was originally looking for, although I found that JFreeChart was sufficient for my case.Rebane
T
5

have a look at processing -- it's an open-source, java-based environment designed for all sorts of animated visualizations.

Translatable answered 17/2, 2009 at 7:55 Comment(4)
Are you sure its not itself a programming language, which perhaps influenced by Java? en.wikipedia.org/wiki/Processing_(programming_language)Endocarp
you're correct. but: "[...] is written in Java. Programs written in Processing are also translated to Java and then run as Java programs. Programs written in Java and Processing [...]" (from processing.org/reference/compare/java.html) so it will integrate with existing java models & libs.Arabella
this tutorial (processing.org/learning/tutorials/eclipse) explains how to integrate the processing libraries into an existing java project -- it's focused on eclipse, but conceptually this will work with any other java IDE...Arabella
The conciseness of syntax looks somewhat similar to Groovy. Thanks for clarification.Endocarp
E
5

Well, if it has to be Java, then you might want to look into these.

Endocarp answered 17/2, 2009 at 8:51 Comment(0)
B
5

You probably have already found a good solution, but if not, I have recently done some work on a framework for producing 2D charts allowing for live updates at a rate of over 50 changes per second.

The original intention was to mimic the appearance of a chart recorder in a scrolling region of a web page, but I believe the approach has wider application.

A demo can be found at Chart Recorder Demo if anyone is interested.

The appearance is defined by a template (www.journeylog.co.uk/chart/templates/chartRecorder.xml). One feature is the ability to specify drawing either on the server or in the browser using ExplorerCanvas.

If anyone is interested I could start an open source project for it.

Blues answered 8/12, 2009 at 23:56 Comment(2)
Yes, I found that JFreeChart wass "real time enough" in my case. Anyway, your demo looks quite impressive! Open sourcing it would definitely be appreciated :-)Rebane
Very nice. I'm looking for a Java graph for Android and your solution may be adaptable... HmmmmHamper
M
4

Fast enough for real time is swtchart, at least in my experience. Even with lots of data. Don't be scared away by the version number, yes it is a rather new API, but I use it successfully without problems.

As the name implies, it is based on SWT, which uses native OS drawing. Also it does some clever optimizations for drawing fast, like not drawing all points in the dataset (see Large Series Example Snippet).

Mothering answered 17/2, 2009 at 20:21 Comment(0)
D
2

this seems like a good candidate.

http://jchart2d.sourceforge.net/

demo:

http://jchart2d.sourceforge.net/applet.shtml

Darcie answered 19/7, 2011 at 2:36 Comment(0)
H
2

JCCkit is vary good library who are targetting less memory especially in embedded environment : https://sourceforge.net/projects/jcckit .

Takes less than <100 kb .

Hatred answered 16/8, 2012 at 8:42 Comment(0)
G
1

You could dig around the source for NetBeans. The profiler does real time graphing of various things such as memory usage.

Gavrilla answered 17/2, 2009 at 8:19 Comment(0)
F
1

SWT XYGraph can plot data with your own data provider, so you can create a real time data provider providing live data. With SWTChart and JFreeChart, you have to prepare the whole array for it.

Fellers answered 7/7, 2012 at 19:46 Comment(0)
R
0

This question has been answered well in: Java Real time graph plotting

As VisualVM includes a Charting API, and this API is included in the JDK, you have a good/fast charting API available.

Ravishment answered 14/10, 2013 at 21:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.