How to integrate 3rd party Javascript library in SmartClient

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

How to integrate 3rd party Javascript library in SmartClient

Postby LXS » Fri Dec 14, 2018 6:21 pm

Hi Servoy community,

i'd like to use Google Charts API in the Servoy 7 SmartClient.

Here is a simple quick start how to use the Charts API:

https://developers.google.com/chart/int ... uick_start

Is it possible to use this in SmartClient?

How do i load the Javascript file?
Code: Select all
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>


I'd like to display the chart in a HTML_AREA or in scopes.svyJFXWebView.WebViewPanel - is this possible?

Thanks for your help!
Alex
Alexander Stefan
Dr. Maison & Partner GmbH
www.servoy-plugins.de
www.maison-partner.de
LXS
 
Posts: 151
Joined: Thu Mar 01, 2007 12:00 am

Re: How to integrate 3rd party Javascript library in SmartCl

Postby patrick » Fri Dec 14, 2018 6:51 pm

Maybe this can be helpful: https://github.com/Servoy/svyGCharts
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to integrate 3rd party Javascript library in SmartCl

Postby sean » Fri Dec 14, 2018 11:32 pm

In theory this is possible. We have customers that run NG Client applications inside Smart Client via JavaFX.
It allows them to take advantage of components like charts, etc. You would build an NG Client solution and then direct the WebPanel to that endpoint (using any deeplink invocations needed)

Challenge is that it is difficult to debug because you cannot "see" inside the embedded browser
Also Java is removing built-in support for JavaFX, so if running on Java 11, things will be more tricky
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: How to integrate 3rd party Javascript library in SmartCl

Postby LXS » Mon Dec 17, 2018 9:32 am

Thanks Patrick an Sean for your help!

Is it also possible to use Google Charts without the svyGCharts Module for the NG Client?

Can i load the resources from https://www.gstatic.com/charts/loader.js to use it directly in the Smart Client?

I saw in the old Google Charts "API" it was also possible to create an URL with parameters to create a chart - but this is deprecated.

Or do you know another Charts API to use in Smart Client?

Thanks!
Alex

P.S. @sean your webinars are awesome! ;-)
Alexander Stefan
Dr. Maison & Partner GmbH
www.servoy-plugins.de
www.maison-partner.de
LXS
 
Posts: 151
Joined: Thu Mar 01, 2007 12:00 am

Re: How to integrate 3rd party Javascript library in SmartCl

Postby sean » Mon Dec 17, 2018 5:43 pm

Hi Alex,

Thanks for your feedback on the webinars - We do them for YOU!

It should be possible to do this w/o NG Client and just using the JavaFX WebView.
I guess it really depends if you need a dynamic/stateful session for the chart stuff.
You can pass content directly to the webview via
Code: Select all
webView.loadContent

So perhaps you can just send it the content to load dynamically. I would try a simple example from Google and pass it to the webview.

Let us know how you do
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: How to integrate 3rd party Javascript library in SmartCl

Postby patrick » Mon Dec 17, 2018 5:57 pm

Ah, sorry. I linked to an NG client repo. I have made a module in the past that does that for smart and web client. I thought it was that one. Let me see if I can find it.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to integrate 3rd party Javascript library in SmartCl

Postby patrick » Mon Dec 17, 2018 6:07 pm

Found it... It requires a few modules (that are not included, because you may already have them): svyUtils, svyComponent, svyJFXWebView and svyUtils$webClient.

Provided as is. No guarantees, but for sure a nice starting point.
Attachments
svyGoogleCharts$example.servoy
(5.82 KiB) Downloaded 206 times
svyGoogleCharts.servoy
(9.66 KiB) Downloaded 207 times
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to integrate 3rd party Javascript library in SmartCl

Postby LXS » Tue Dec 18, 2018 2:45 pm

cool, thank you patrick and sean for your help! i'll have a look on it!
Alexander Stefan
Dr. Maison & Partner GmbH
www.servoy-plugins.de
www.maison-partner.de
LXS
 
Posts: 151
Joined: Thu Mar 01, 2007 12:00 am

Re: How to integrate 3rd party Javascript library in SmartCl

Postby LXS » Tue Dec 18, 2018 2:58 pm

hmm i tried to import the solution svyGoogleCharts.servoy into my Servoy 7.4 Developer.

It fails with the following message:

Code: Select all
Could not import solution: The solution was exported with a newer version of Servoy than you are currently running. Upgrade to at least Servoy 8.2.2 -build 3107 to import this solution.


Is it possible to use it in Servoy 7.4?

Thanks!
Alex
Alexander Stefan
Dr. Maison & Partner GmbH
www.servoy-plugins.de
www.maison-partner.de
LXS
 
Posts: 151
Joined: Thu Mar 01, 2007 12:00 am

Re: How to integrate 3rd party Javascript library in SmartCl

Postby LXS » Tue Dec 18, 2018 3:05 pm

i've tried to unzip the .servoy file and modify in the version_info.xml the <servoy_version> and <servoy_build>

But now i've a checksum error ;-)

Code: Select all
Could not import solution: Checksum failure
Alexander Stefan
Dr. Maison & Partner GmbH
www.servoy-plugins.de
www.maison-partner.de
LXS
 
Posts: 151
Joined: Thu Mar 01, 2007 12:00 am

Re: How to integrate 3rd party Javascript library in SmartCl

Postby juan.cristobo » Tue Dec 18, 2018 4:30 pm

LXS wrote:Is it also possible to use Google Charts without the svyGCharts Module for the NG Client?


I use Google Charts in Web Client (with WebClientUtils plugin), I don't know if it can be used in Smart Client
Juan
Madrid (Spain)

Servoy 7.4.x - MySQL / SQL Server 2008-2016
Windows 10 Pro
juan.cristobo
 
Posts: 186
Joined: Thu Apr 19, 2012 9:12 am

Re: How to integrate 3rd party Javascript library in SmartCl

Postby patrick » Tue Dec 18, 2018 4:35 pm

7.4 :shock:

Please try the ones attached here
Attachments
svyGoogleCharts.servoy
(9.62 KiB) Downloaded 203 times
svyGoogleCharts$example.servoy
(5.79 KiB) Downloaded 213 times
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to integrate 3rd party Javascript library in SmartCl

Postby LXS » Tue Dec 18, 2018 4:44 pm

cool, thank you Patrick!
Now i've imported the module without problems.

The solution says the module svyAccordionMenu is missing.
Where can i download this module? I can't find it on the github/Servoy account.

Alex
Alexander Stefan
Dr. Maison & Partner GmbH
www.servoy-plugins.de
www.maison-partner.de
LXS
 
Posts: 151
Joined: Thu Mar 01, 2007 12:00 am

Re: How to integrate 3rd party Javascript library in SmartCl

Postby patrick » Tue Dec 18, 2018 4:52 pm

Just remove it. I forgot to take it out.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 14 guests