FusionChart Events

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
devinst
Profound User
Posts: 80
Joined: Mon Apr 20, 2009 11:26 am
First Name: Devin
Last Name: St. Germain
Company Name: Dupre Logistics, LLC
Phone: 337.314.2259
Address 1: 201 Energy Pkwy. Ste. 500
City: Lafayette
State / Province: Louisiana
Zip / Postal Code: 70508
Country: United States
Contact:

FusionChart Events

Post by devinst »

I have a chart on a screen and would like to create event listeners to monitor for clicks on certain labels and data. I see which events I need to listen for according to the Fusion API documents but I am not sure where on the display to put the java script code to listen for the event.
Would anyone have an example to look at or some direction?
Thanks.!!
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: FusionChart Events

Post by Scott Klement »

I assume these are just JavaScript functions, right?

As with many things in programming, there's more than one way to do it....

1) Put the functions in a JavaScript file under /www/INSTANCE/htdocs/profoundui/userdata/custom/js. These are automatically loaded into the Visual Designer and Rich Display sessions (sessions started with /profoundui/start or the Atrium Rich Display launcher). For Genie, you'd add a <script> tag into the start.html pointing to the new JS file to make it load. This is the simplest and easiest to support -- but doesn't work for mobile.

2) Or, you can put a JavaScript file somewhere else (but accessible t0 the HTTP server) and use the "external javascript" record format property to load it.

3) Or, you could do the same as #2, but use the pui.loadJS API to load it.

4) Or, you could define the function as a global variable in your display's onload event. I would only do that if it is a fairly simple script. It has the advantage that all of the code is stored inside the display file, no need to have a separate JS file that's moved between test/prod/qa environments along with the display file. But, it can be a pain to maintain/debug.

There are probably other alternatives... but that's what comes to mind.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests