---Oleg Kobchenko wrote:
> Of course, isigraph redraw must occur
> (1) on a separate event
> wd 'msgs' and related link
> (2) unless (2) forced.
> wd 'setinvalid id'
>
> http://www.jsoftware.com/help/user/wd_commands.htm
> http://www.jsoftware.com/help/user/message_pump.htm
>
> On plot there is also
> pd 'show ...'
>
> http://www.jsoftware.com/jwiki/Plot/Commands
>
>
Prompted by Bill's email I had been looking at using the syntax pd 'isi
[w h]' to set the size directly using the plot. You've also mentioned
this but I can't get it to work. e.g.
pd 'isi 800 600'
The form appears OK but doesn't honour the specified width or height. It
just seems to use whatever width and height was last used for the form.
I haven't been using (pd 'show [w h]' doesn't work either. Can others
confirm this?
I tried putting wd 'msgs' between the resize and capture parts of
captureIsi, with no luck. I suspect this is to do with the separate
event condition Oleg mentions above, but I'm not really sure how to do
that.
In the end I've achieved the result I was after using the wd 'setinvalid
id' and another pd 'isi' as shown below. I'm not sure this is the best
way of doing it though!
However, I've just realised that all of this isn't going to help me much
because I want to be able to capture the plot using jconsole and pd
'isi' won't work in jconsole. It seems that I will have to write the
plot to file using the pd 'save' command and read that file back in
before sending to the web browser. This comes back to my earlier
suggestion that it would be nice to have the option of returning the
image data directly from plot.
NB.======capture.ijs =======
require 'plot'
myplot=: 3 :0
pd 'type bar'
pd 'axes 1 0'
pd 'xlabel ',":2001+i.6
pd 'title Bar Chart'
pd 0.6 0.8 1* _0.5+?.3#,:3 3 4 7 7 4
pd 'isi'
)
NB.*captureIsi v capture the contents of an isigraph form
NB. returns #bytes written to file or actual img file content
NB. y is character list (either filename to write to or format to
return)
NB. x is optional width and height in pixels. Defaults to 800 600.
NB. e.g. captureIsi jpath '~temp/myfile.gif'
NB. e.g. 1024 768 captureIsi 'png'
captureIsi=: 3 :0
800 600 captureIsi y
:
if. -.*#y do. y=.jpath '~temp/tstcapture.png' end.
require 'media/platimg'
coinsert 'jgl2'
glwh=: 3 : 'wd''pmovex '',(+0 0,[EMAIL PROTECTED]@#)&.".wd''qformx'''
glwh x
wd 'setinvalid ',PId_jzplot_
pd 'isi'
NB. wd 'msgs'
glqall=: (|. $ [:glqpixels 0 0&,)@glqwh
if. (<toupper y) e. ;:'BMP GIF JPEG PNG TIFF EXIF ICO WMF EMF' do.
y putimg~ glqall'' NB. or this to not write file
else.
y writeimg~ glqall'' NB. write to file
end.
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm