make a jpg file

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

make a jpg file

Post by adventuresofgreg » Fri Apr 08, 2011 5:01 pm

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: make a jpg file

Post by Klaus » Sat Apr 09, 2011 12:24 pm

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

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: make a jpg file

Post by BvG » Sat Apr 09, 2011 4:09 pm

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
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: make a jpg file

Post by adventuresofgreg » Sat Apr 09, 2011 4:25 pm

ah - perfect. That works great! thanks

HughSenior
Posts: 3
Joined: Thu Jun 09, 2011 3:00 pm

Re: make a jpg file

Post by HughSenior » Thu Jun 09, 2011 3:36 pm

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.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: make a jpg file

Post by BvG » Thu Jun 09, 2011 11:50 pm

For completeness, that'd be an additional expense.

ChartsEngine has it's own sub forum here:

ChartsEngine forum
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply