Charts within Servoy

Hi all,

I’d like to use charts within Servoy.
I know about Google Charts (with Velocity) and other standard charts but they are neither really
nice nor functional.

I’d like to use stunning charts written entirely in javascript (there are thousands of them).

So my question is:
Does exist a way or a swing component to embed charts written in javascript?
I suppose that it’s necessary to import also others libraries (often included within a web-broswer).

Servoy normally use Rhino to embed javascript in Java (Does the version 8 use Nashorn?)
but I don’t really know how (expecially how to use it at will).

Any suggestion?

Regards

In ng client ( Servoy 8 ) - that runs inside the browser - you can wrap those stunning chart libraries into servoy web components.
Then you can use them in your form just like any other component. I did see some used already - also played with a chart library once.

Don’t know if someone has already a complete library wrapped like that (for ng client) - but you can still do it yourself for the components you need.

I know there are plugins for web-client (webclientutils) as well to work at a lower level with the browser, also you could wrap them as wicket beans, but I prefer ng for this sort of thing.
If you really want smart-client I know there are ways to integrate browsers into it - and you could still show the chart inside the browser: JFXPanel or the browser plugin.

Maybe someone who really did something like that can contribute.

Could you try to use java fx

https://github.com/Servoy/svyJFXWebView/wiki

Which type of Servoy client are you targeting ? Smart Client, Web Client or NGClient ?
The approach for implementing what you are asking would change depending on what you are looking for.
The java fx proposed by Manuel for instance should be used for Smart Client only. would allow you to use Javascript libs into a Java Fx Web View (you can say is the equivalent of using an HTML Area in Web Client to render charts based in third party libraries).
Do you know already which chart library you would like to use ?

I’ve implemented Google Charts in Web Client:

viewtopic.php?f=15&t=19995#p107716

Andrei, Manuel, Paronne and Juan:
Thank you all for your replies.
I’ll respond per person.

Andrei:
I’m already able to use charts within the browser (webclient). I’m trying to maintain the full portability of the solution (so both smart and webclient).
This is because I was asking for a swing component.
You talk about

“the browser plugin”

. Where I can found it?

Manuel:
Thank you Manuel. I’ve already used JFX in the past but I’d forgotten it. Thank you for remind it to me. I’ll try this solution.

Paronne:
As wrote for Andrei, I’m looking for a smarclient component (swing) to do the job. I don’t know yet about the full dependencies necessary to run those charts.
While I was looking for a swing component on the web, I’ve found this: https://www.teamdev.com/jxbrowser. Needs for licence, but I want share it with you all.

Juan:
Thanks for your reference. I was looking for something different (I would solve the problem to use a JavaScript-based Chart within the smartclient).

Thank you all again. I’ll try on to solve the problem with JFX.

Regards

Hi Marco,

if you are looking for a solution which can work for both Smart Client and Web Client you need a code base that can handle the svyJFXWebView for the web client and an HTML Area in the Web Client.
There is a servoy open sourced module, ‘svyComponent’ available in GitHub, which would allow you to wrap yout charts in a module that can be used both in Smart Client and Web Client from a single code base. I should warn you that implementing such solution with svyComponent is complex and time consuming, is not recommanded to be used without proper support. Also this module is deprecated for the NGClient, it can be considered as a primitive solution to implementat reusable Web Components.

Regards,
Paolo

Hi Paolo,

thank you for your reply.

I’ve tried to use svyJFXWebView but it crash with any URL.

My test environment:
windows 10, Java 1.8.60, servoy 7.4.6

Step:

1 - I’ve downloaded the latest version
2 - I’ve downloaded the svyJFXWebView_test
3 - I’ve removed from the “test” solution a dependency from the “unitTest” solution
4 - I’ve launched the test solution.
5 - I’ve submitted an URL and pushed Return.

Here a sample to reproduce the problem:
[attachment=0]test_JFX.servoy[/attachment]

Regards

test_JFX.servoy (86.6 KB)

Hi Marco,

do you get any error in console ? your test solution runs fine for me. The problem may be related to the Java version you are using.
If you want to try it with a different java version you can force Servoy developer to use a specific java version by defining the java path in the servoy.ini file:

-vm
C:/Program Files/Java/jdk1.7.0_45/jre/bin
–launcher.XXMaxPermSize

Hi Paolo,

I don’t get any error within console but I found a trace of an error here:
[attachment=0]hs_err_pid11868.txt[/attachment]

The original file name had extension “.log” (renamed because servoy forum rules).

Hope this help.

I’ll try also to install the version of java you have indicated.

Regards

hs_err_pid11868.txt (42.8 KB)

Dear Paolo,

I’ve tried also with Java 7.79 but it crash.

Here the report
[attachment=0]hs_err_pid13388.txt[/attachment]

Looking on the web (for “Failed to write core dump. Minidumps are not enabled by default on client versions of Windows”, the message within the log)
I’ve found that it could be a problem that target pc with dedicated graphic card.

I try tomorrow on a computer with only a bounded graphic card.

Could be that the problems?
If yes: could it be managed?

Regards

hs_err_pid13388.txt (41.9 KB)

For anyone who had the same problem (svyJFXWebView_test crash while using), I’ve solved with a new Servoy installation.
Probably update after update something was not working properly.

Regards