I was discussing with another J user a possible approach to this. What
you can do is subclass the plot class (jwplot I believe) which would
give you access to the variables within plot such as xmin,xmax etc.
Then, for example, add a method called zoom that takes a zoom factor
and adjusts xmin,ymin accordingly. This method can be called from the
trackbar event handler along with 'show' to dynamically update the
plot. If I am mistaken and trackbar does not emit events as it is
being slid then the alternative is to handle the mouse move events
which is what I use in my application described by Devon on the NYJUG
page.

There are a couple of ways to implement zoom. What I did was use an
absolute zoom factor that is updated when the mouse is moved while the
button is down. Then before redrawing apply the zoom factor to the
original range. The plot class sets the range the first time it is
drawn. So right after it's drawn for the first time I store xmin and
xmax as the default zoom or zoom factor 1. In this implementation
then, my zoom method simply sets the absolute zoom factor.

As I mentioned to NYJUG my code will be of no help because I don't use
subclasses, explicit definitions or named nouns and is too tightly
integrated with proprietary code. But I am willing to help out and
contribute to anyone interested.

On 9/25/08, Sherlock, Ric <[EMAIL PROTECTED]> wrote:
> ---Oleg Kobchenko wrote:
>> A good example of not only interactive but informative
>> and intuitive Plot is Wave Viewer
>>
>>    http://www.jsoftware.com/jwiki/Addons/media/wav#viewer
>>
>> which is a special case of time series.
>>
>> One concept it uses is Lens, which shows the whole data
>> and the Detail subset selection. Both views allow panning
>> with the mouse, so the other concept is Direct Manipulation
>> (like iPhone), as opposed to side controls. There is a
>> side control for zooming though, which is implemented as
>> familiar slider (like iPhoto). Imitation is the sincerest
>> form of flattery, but using these things together for Plots
>> is quite innovative.
>
> I'm working on an application at the moment (a tool for students to
> investigate the parameters determining response to selection) that could
> benefit from interactive plot, the Wave Viewer is a very nice example of
> what is possible.
>
> I'll need to spend some time understanding some of the concepts of direct
> manipulation, but plan to start with using side controls first.  On that
> note I was wondering whether it is possible for the slider control to
> interact "live" with the plot so that the plot updates as the slider is
> moved backwards and forwards, not just when it is set to a new position?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>

-- 
Sent from my mobile device
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to