Google Chart and dtl?

Moderator: crythias

Locked
soos
Znuny newbie
Posts: 38
Joined: 12 Mar 2014, 11:53
Znuny Version: 3.3.1
Real Name: O

Google Chart and dtl?

Post by soos »

Hi,

I am writing a customer service portal, and for one of the modules I'd like to use the google chart API, the code to pull the data and present it is already finished, but I am having trouble with how to get it to work in the DTL? I suppose I have to put it in the dtl::js_on_document_complete right?

Has anyone tried something like this?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Google Chart and dtl?

Post by crythias »

I wrote this in 2012, but don't know how it currently applies.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
soos
Znuny newbie
Posts: 38
Joined: 12 Mar 2014, 11:53
Znuny Version: 3.3.1
Real Name: O

Re: Google Chart and dtl?

Post by soos »

Ah yes, I was confused as to the variable scope in javascript and the relation to the script tags, in the end I just made a dtl block where I basically did

Code: Select all

<script type="text/javascript">
var graphData = $Data{"graphData"};
</script>
Passing the finished JSON object in as graphData, and I just loaded the Google Chart JS in the top of the dtl file.

Works fine!
Locked