Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Erick book example on Google Charts / loading a JS external script multiple times.
Thu, Aug 11 2016 4:46 AMPermanent Link

alexza

Hi all,

I'm using the example on integrating Google Charts in Erick's EWB book.

In it a TBasicPanel is put on a form and a Script1 component loads the Google JS code.

I input the url of the google charts loader (https://www.gstatic.com/charts/loader.js) in Script1.URL and everything works perfectly.

In real life, however, I'm expecting that the form on which the TBasicPanel hosting the chart can be created, freed and recreated more than once.

I imagined that on freeing the form the code that the Script1 component brought into memory was removed too, but that seems not the case (also tried setting the Script1 URL property to '').

If I recreate the form I get an error message saying 'Google Charts loader.js can only be loaded once'.

So Googling I found that the only solution seems to be to preload the G library and live with it, but how does this coexist with the callback mechanism which actually draws the graph ?

Anuone (Erick ?) has already sorted this kind of problems ?

Thanks in advance

Alex
Thu, Aug 11 2016 4:01 PMPermanent Link

erickengelke

Avatar

alexza wrote:
>I input the url of the google charts loader (https://www.gstatic.com/charts/loader.js) in Script1.URL and everything >works perfectly.

I' m on vacation this week, sorry.

Erick
Thu, Aug 11 2016 4:24 PMPermanent Link

erickengelke

Avatar

erickengelke wrote:

alexza wrote:
>I input the url of the google charts loader (https://www.gstatic.com/charts/loader.js) in Script1.URL and everything >works perfectly.

Change the values to random(1,5) then call drawchart repeatedly and it will replace the old one with new values.



Erick
Image