/javafx-d3

Provides a Java API to use the JavaScript library d3.js with the JavaFx WebView

Primary LanguageJavaOtherNOASSERTION

javafx-d3

Provides a Java API for using the JavaScript library d3.js with JavaFx Applications.

Many thanks to the authors of the projects gwt-d3 [1] and d3.js [2] !!!

Most of the source code of javafx-d3 originates from gwt-d3. If you use the original gwt-d3 project your result will be a web application that is written in JavaScript. If you use javafx-d3, your aim is to create a JavaFx desktop application that is written in Java.

alt tag

Current state

  • Most code from gwt-d3 has already been transformed.
  • In order to keep my efforts focussed, the remaining parts will be done on request.
  • Therefore, if you are interested in more functionality, please create an issue ticket.

=> Please also feel free to jump in and directly contribute to the code of javafx-d3.

In terms of stability and performance javafx-d3 seems to work nicely for "smaller projects". If you want to transfer a lot of data between Java and JavaScript you might get into the limits of the JavaFx WebView. Hava a look at the scatterplot matrix example of the JavaFxD3DemoSuite and compare it to the original gwt demo to get an impression of the limitations of the WebView and javafx-d3:

https://gwtd3.github.io/demo/D3Demo.html

Please also see the following SO questions for more information:

http://stackoverflow.com/questions/41488110/java-api-for-manipulating-html-javascript-dom-elements

http://stackoverflow.com/questions/10762979/performance-of-webview-in-javafx

How it works:

Javafx-d3 uses the JavaFx WebView [3] to display an html page and to execute JavaScript. The JavaScript library d3.js is injected into the WebView. The communication between Java and JavaScript is based on
so called JSObjects [4].

With this straregy of javafx-d3 you are able to use the full power of d3.js for your Java desktop applications.

How to get started:

  • Get the source code
  • You can use the main folder as an Eclipse workspace including two projects:
  • Import the two Eclipse Maven projects javafx-d3 and javafx-d3-demo
  • Build the maven projects
  • Run the demo suite com.github.javafxd3.d3.JavaFxD3DemoSuite
  • If you do not get javafx-d3 up and running please create an issue ticket.

License

This project is licensed under BSD:

Javafx-d3 is based on third party code and you have to consider the corresponding licenses as well:


[1]: gwt-d3: https://github.com/gwtd3/gwt-d3
[2]: d3.js: http://d3js.org
[3]: JavaFx WebView: https://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm
[4]: Using JavaScript from Java: http://docstore.mik.ua/orelly/web/jscript/ch19_06.html
[5]: d3.js gallery: https://github.com/mbostock/d3/wiki/Gallery