0

I'm looking for a way to have more features than the basic JavaFx charts provide.

  • "realtime" plotting of < 50 points divided into multiple scatter series
  • adding custom text labels to points in scatter
  • drawing some lines inside the chart
  • maybe custom color for single some scatter points

I've already seen some people using multiple charts overlayed with transparent background. I'm not sure if this is good solution that will work with future updates to JavaFx.

Now I'm looking for suggestions. Thanks in advance!

user3639812
  • 93
  • 2
  • 5

3 Answers3

1

I spent a lot of time looking for a free Java plotting library that is compatible to the Eclipse Public License (JFreeChart is not), supports SVG export (JavaFx charting does not) and let me specify plots in detail. The plotting capabilities should be similar to the features of the free scientific plotting tool Veusz that is based on python and QT. Veusz allows for example to set the orientation and size of minor ticks and everything else I ever wanted to tweek.

I used the charting features of JavaFx and tried to write a converter from JavaFx to SVG ... and stopped that after a certain amount of frustration: https://github.com/stefaneidelloth/JavaFxNodeToSvg

Finally I decided to write javafxd3, a Java wrapper for d3.js based on the WebView and the code from gwt-d3:

https://github.com/stefaneidelloth/javafx-d3

enter image description here

That wrapper is applied in my main project Treez to provide some atoms for scientific plotting in Eclipse:

https://github.com/stefaneidelloth/treez

Treez Eclipse plugins

javafxd3 works well if you do not need to transfer much data between Java and JavaScript. The WebView has some performance issues/limits that can be relevant for more advanced applications. Have a look at the demo suite of javafxd3 to get an idea of that limitations and read

Performance of WebView in JavaFX

With the wrapping strategy of javafxd3 it is also possible to use plotly.js and other advanced JavaScript plotting libraries that are based on d3.js for your JavaFx application.

In the last two years there has not been much progress in JavaFx. The SceneBuilder has been abandoned by Oracle and JavaFx might be a dead end. If the charting features of JavaFx do not fit your needs and you don't want to use my JavaScript embedding work around javafxd3 ... check if JFreeChart fulfills your needs regarding licensing and features:

http://www.jfree.org/jfreechart/

If you are actually not limited to Java I would recommend Veusz/Python:

https://veusz.github.io/

or the direct usage of some JavaScript libraries:

https://d3js.org/

https://plot.ly/javascript/

Edit

I do not use Java and the wrapper any more but directly JavaScript.

Stefan
  • 10,010
  • 7
  • 61
  • 117
0

I don't have an exact solution, but I had a similar need. I found that charting libraries were fairly poor in most programming languages.

However, I found that JavaScript had a huge selection of good charting (plotting) libraries.

My suggestion is to use a webview, and then display the chart in that using JavaScript and html using a library like d3 or dimple. If you don't know any CSS/html/JavaScript there might be a learning curve.

  • The base JavaFX charting libraries coupled with a few customizations can do everything asked in about a page of code. Bringing in a webview solution would decrease performance and result in an overly complex solution. – Birdasaur Nov 30 '16 at 15:26
0

Maybe it is worth looking into the ChartFX-library

https://github.com/fair-acc/chart-fx

It is designed for plotting in a scientific environment, mostly tuned for speed. It can plot XY line charts with error bars and XYZ heatmaps and contour plots. Furthermore it is able to handle large numbers of data points efficiently - say in the thousands.

Some images from the project's samples:

candlestick plot

Visualization of an image as contour/heatmap plot with coloring/contrast options.

Polar plot

However, it does not support a lot of interactive features like drawing lines inside the chart, as the chart is based on canvas/pixel graphics, but this can be built on top.

WolfiG
  • 1,059
  • 14
  • 31