Page 1 of 1

make a jpg file

Posted: Fri Apr 08, 2011 5:01 pm
by adventuresofgreg
Hello: I am using ChartsEngine to make plots and I would like to write a script to export the chart as a .jpg file. Can you help with that script?

Thanks,
Greg K

Re: make a jpg file

Posted: Sat Apr 09, 2011 12:24 pm
by Klaus
Hi Greg,

I never worked with ChartsEngine, but can't you just take or export a "snapshot" from the "Chart"?

I am sure the resulting "chart" is a group, right?
So you could use "the rect of grp XYZ" as the reference for the screenshot.


Best

Klaus

Re: make a jpg file

Posted: Sat Apr 09, 2011 4:09 pm
by BvG
Yes, chartsEngine just is a group on your stack. So you'd do something like this:

Code: Select all

on mouseUp
  ask file "Where to save" with type "JPEG File|jpg|JPEG"
  if it <> "" then
    export snapshot from group "myChart" to it
  end if
end mouseUp

Re: make a jpg file

Posted: Sat Apr 09, 2011 4:25 pm
by adventuresofgreg
ah - perfect. That works great! thanks

Re: make a jpg file

Posted: Thu Jun 09, 2011 3:36 pm
by HughSenior
For completeness, ChartMaker supports export to pdf, image file, the clipboard, and as a LiveCode object. If the 'interactive' option is selected, all this is available by a right-click popup menu in the chart itself; otherwise a scripted solution is also available using built-in syntax options.

Re: make a jpg file

Posted: Thu Jun 09, 2011 11:50 pm
by BvG
For completeness, that'd be an additional expense.

ChartsEngine has it's own sub forum here:

ChartsEngine forum