Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can JavaFX 2.0 serve as a scientific charting package?

I am writing a scientific experiment control program in java which includes a GUI.

I help choosing a charting library for this task. The program will contain two types of charts:

  1. A line chart with a lot of data points (in the range of 10^4-10^5 points per plot) with a refresh rate of about once every 0.5-1 seconds, so performance is a factor. This chart will have to include to sets of data points with different scaling.

  2. A scatter chart without many data points which must include error-bars, or some way of indicating the error in the points. Preferably both on the X and Y axis, in crosshair style for example.

Logarithmic scale is also a must and a good zoom tool and export tool would also be nice. I would prefer a solution for both charts with a single package of possible.

From the research I have done a nearly perfect option seems to be javaFX 2.0. From what I read, it has good performance and also looks great, but I can't seem to find an option for error-bars. Since I don't know javaFX at all, how simple is it to extend the charting library to include error bars, or is there an open source add on that includes this that I didn't find?

Another option is the Google charting library, which seems to have all the necessary features, however I am afraid that the refresh rate will be a problem in the first chart type. Is this a viable concern?

I have used JFreeChart, but I am concerned about the performance, and also found it very difficult to add small changes. These include a way to change the color of plotted points during run-time after the chart has been created as is possible in matlab. All this requires a lot of extra coding and time consumption which I am trying to avoid.

The last option which seems to be the most practical is JChart2D. It seems to have most of the functionality I need and my only problem with it is that it does not look very nice.

Does anyone have any recommendations for me? I plan to code this in as short a time as possible, and the worst case scenario is for me to discover that bugs in some third party package or that an option I need is unavailable and requires a lot of extra code, though it would be nice to learn something new.

This decision may of course affect the entire GUI package that I choose to use, which currently appears to be Swing.

Thanks,

like image 857
user1391091 Avatar asked May 12 '12 15:05

user1391091


4 Answers

Java FX 2.0 and JFreeChart are not really comparable. JFreeChart is a charting library for Swing, which is a GUI environment in Java. Whereas Java FX 2.0 is an alternative to Swing. Java FX 2.0 happens to provide a few chart objects as part of its standard library but they are definitely not as flexible / customisable as those available in JFreeChart. Of course, Java FX 2.0 being in Java, nothing prevents you from coding the very specific chart you need by extending the available components.

Java FX 2.0

  • Pros: More modern look and feel than Swing (personal subjective opinion), possibly going to be the new GUI standard in Java in a few years
  • Cons: you will have to spend more time enhancing the existing charting components, less widely used = less support + smaller community if you get stuck

Swing:

  • Pros: plenty of charting libraries available (JFreeChart is a very comprehensive one but there are alternatives as you mention). Active and wide community.
  • Cons: I personally don't like the look and feel as much - could become obsolete at some stage, but clearly not tomorrow.
like image 117
assylias Avatar answered Sep 25 '22 03:09

assylias


JFreeChart is ideal for these uses. Because it's open source, it's easy to test in context; FastScatterPlot is discussed here. Changing a plot after it's been created is straightforward, as shown here; and arbitrary color schemes are possible, as shown here and here.

like image 39
trashgod Avatar answered Sep 26 '22 03:09

trashgod


To enable JFreeChart and Orson Charts (which are Java2D-based) to be used in JavaFX, I have created a new project that provides a Graphics2D API backed by a JavaFX Canvas. The project is FXGraphics2D on GitHub. It could be used for other Java2D libraries as well (the code is under a BSD-style license).

like image 36
David Gilbert Avatar answered Sep 24 '22 03:09

David Gilbert


You can use Open Office as a charting engine , there is a java/UNO bridge ... JavaFX is nice but charts are not as flexible as JFreeChart API a solution could be to use JfreeCharts within FX patrick

like image 30
patrick Avatar answered Sep 23 '22 03:09

patrick