AnsweredAssumed Answered

How to Get Chart outside of FMP and into Graphic File?

Question asked by JPScott on Nov 10, 2015
Latest reply on Nov 14, 2015 by JPScott



I use FMP v14 to create static webpages for a basketball statistics website.   Note that I started doing this in the late 90's and developed the scripts etc. before FMP really had any built-in web functions. Basically what I do is run a script which exports a set of records (the text is generally formatted inside a HTML table) and then the script will append a header and a footer (to put it into HTML-readable format) and then this text file is exported, and renamed according to whatever the relevant record is at the time.  While it's pretty basic in terms of generating HTML files, it's worked well for me over the years and  I've pretty much stayed with it that way ever since (the only major change was to use Troi File plug-in instead of Applescript to rename exported text files into specific .html filenames.)


Recently I have become interested in including some charts on the webpages, which leads me to my question.  I can create the chart in FMP but was looking for the best way to transfer that chart outside of FMP and ideally into a graphic file which I can name and refer to within the various webpages.


So for example I might have a webpage listing statistics for a particular season:


Statistics for 2014-15


To that I would like the webpage to also reference and display a chart which I have created in FMP, such as the following:




The brute force method to do this would be just to take a screen capture of the chart, save it as a graphic file and then set up the page to refer to the graphic file.


However I'd like to be able to script this if possible because I can see that with some of the charts I'm considering,  the data will be changing periodically.


So again, is there a way within a script to capture the contents of the chart and export it as a graphic file on my computer?  Within the script I can use the Troi plugin to rename the file to a specific filename if necessary and I can have FMP include a link in the webpage to refer to this graphic file in the webpage, but not sure the best way to get the chart out of FMP in the first place.


From what I could see, GetLayoutObjectAttribute is a start to at least point to the chart in question, but it's not clear to me what to do at that point. Can I use that in conjunction with Troi plugin in some way?


Any suggestions?  One caveat is that if possible I'd like to continue to just use straight scripts to export information to static webpages & files. I'm not looking at making the database itself web-accessible.


Thanks in advance.