We are using D3, a JavaScript library, as a visualization tool (http://d3js.org/). We have D3 graphs generated from a Servoy smart client app being displayed in a web browser (Firefox, Chrome). But this now puts us in an environment outside of Servoy. We’ve figured out how to write from the browser to a db and are hacking together a process to connect back into Servoy, but the fix is transitional, just to keep us moving forward. We want to operate within Servoy but do not understand how to get a browser rendering D3 javascript working in a Servoy smart client app. Is there a way to display a D3 graph in a Servoy Smart Client app?
Have you tried the svyJFXWebView component/module hosted on GitHub? https://github.com/Servoy/svyJFXWebView
Don’t know if it is completely compatible with D3, but that would be my first starting point.
Paul
Paul - thank you for the pointer. We have the D3 graphs now working in the Servoy Smart client, which is great. Unfortunately there are some differences in behavior between the D3 in Firefox vs D3 in JFXWebView that affect usability. Specifically, zoom and pan. One click of the mouse wheel results in large change in zooming the graph, enough so that the graph appears to disappear from the panel. Second, there is a significant lag time when you try to pan a large graph in JFXWebView that is not in the Firefox rendered version. Moving around a graph becomes very awkward.
Any one have advice on how to configure the pan and zoom functions in JFXWebView?
Another issue is debugging the D3 code running in the JFX panel. We have been using the debugger in Chrome. Any suggestions on a debugger when in Servoy?
Since the JavaFX WebView is based on Webkit, I wouldn’t compare results against FireFox, but against Safari or Chrome.
AFAIK there’s no debugger available for JavaScript code running inside a JavaFX WebView, so also not in Servoy.
As for the difference in behavior: I doubt there’s anything you can configure in the JavaFX WebView. If you think it is a bug in the WebView, it’s best to file cases with Oracle’s JavaFX project
Our issue is the lag in pan that occurs when viewing a larger D3 graph in the JavaFx window in Servoy. This lag does not occur in Chrome or in Firefox. The lag makes the interaction with larger graphs unacceptable. We are trying to figure out if the lag is introduced in the Servoy emulation. We have run D3 charts from different developers in the JavaFX panel and the results are the same so we don’t think the issue is introduced by theD3 code. Any idea how we might determine if the lag is introduced by Servoy?
servoy doesn’t really add anything on top of that we just display the bean and give it its contents
So the lag you see is i guess really inside the javafx pane itself (maybe the js implementation)
did you try on the latest java 8?
If you want to test pure plain javafx, you could build a very small java application (i think there are quite a lot of examples) that just shows the content/url
As an update, while we have D3 graphs working in JavaFX in a Servoy Smart client, we are seeing different behavior on different machines. With no debugger, finding the issue has been difficult. We have narrowed the difference to the Java version that is installed, 32 bit vs 64 bit Java. We are still working to determine the specific cause.
As background for anyone who may read this in the future, we have two Windows PCs running Servoy v7.4.4. One is running Java 32 bit, the other is running Java 64 bit. We have a javascript app that changes the content in a D3 graph. The app runs well in both Chrome or Firefox, no issues. We want to add functionality to capture user actions in the D3 graph write them to a datatable. Currently other interface functionality is developed in Servoy and we are testing javafx as a way to render the D3 graphs in a Servoy environment. The graph code running in the PC with Java 64 bit changes content as it does running in Chrome. On the Java 32 bit PC, the code does not change the graph as it does in the Chrome, Firefox, or Servoy Java 64 bit enviroments. Why? We are still trying to figure out the issue but we can tell you that behavior is different on machines running different java versions and code that works in Chrome does not just work in JavaFX, and that we have not found a debugger for JavaFX running in Servoy so resolving the issues is not simple or straightforward.
A related question, what is the best way to get D3 graphs working in a Servoy web client? JavaFx is not supported. We could use some direction on best approach or if a D3 Servoy web client combination is even possible. Thanks.
You basically have to provide another implementation, one that works in the WebClient and communicates back and forth between the browser and the server-side running Web Client logic.
The svyComponent module hosted on Servoy’s GitHub account provides a ‘framework’ for doing just tha and comes with at least the Google Maps sample implementation. Documentation is sparse, to say the least though.
Or you roll your own, by embedding the D3 graph in a non-editable HTMLArea and use the svyWebClientUtils module (or the old WebClientUtils plugin) to communicate back and forth.
As for the difference between the 32 and 64 bit Java version: odd and indeed very hard to debug without a debugger. Nothing shows up in the console log?