Synchronizing xrange of cgZPlot with another plot [message #89886] |
Wed, 17 December 2014 12:20  |
rlord
Messages: 2 Registered: December 2014
|
Junior Member |
|
|
Hi,
I am trying to plot a share price (for example) in one draw widget using cgZPlot, and have a volume plot (for example) in another draw widget below the cgZPlot figure using cgPlot.
However, as I zoom/pan the cgZPlot figure, I want the other plot's xrange to stay in sync.
Any ideas?
Richard
|
|
|
|
Re: Synchronizing xrange of cgZPlot with another plot [message #89889 is a reply to message #89887] |
Wed, 17 December 2014 12:56   |
rlord
Messages: 2 Registered: December 2014
|
Junior Member |
|
|
On Wednesday, December 17, 2014 10:32:00 PM UTC+2, David Fanning wrote:
> rlord@ska.ac.za writes:
>
>> I am trying to plot a share price (for example) in one draw widget using cgZPlot, and have a volume plot (for example) in another draw widget below the cgZPlot figure using cgPlot.
>>
>> However, as I zoom/pan the cgZPlot figure, I want the other plot's xrange to stay in sync.
>>
>> Any ideas?
>
> Write your own "sharezoom" object from a subclassed cgZPlot object. Have
> it "know" about the volume plot. Override the DrawPlot method of your
> new object to update both plots.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Hi David,
Thank you for the quick reply. I think I need to first learn a bit about writing object-oriented code in IDL to fully understand your answer. But at least you confirmed there is no easy way to do this.
I will probably start by making a copy of cgZPlot, and call it, say, ShareZoom, which will then accept two arrays for the two y-axes (the x-axis is the same for both plots). This, for me, seems to be the easiest way for ShareZoom to "know" about both plots. Updating the DrawPlot method should hopefully be fairly easy.
Best Regards,
Richard
PS: cgZPlot is really a fantastic tool!
|
|
|
Re: Synchronizing xrange of cgZPlot with another plot [message #89890 is a reply to message #89889] |
Wed, 17 December 2014 13:00  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
rlord@ska.ac.za writes:
> Thank you for the quick reply. I think I need to first learn a bit about writing object-oriented code in IDL to fully understand your answer. But at least you confirmed there is no easy way to do this.
>
> I will probably start by making a copy of cgZPlot, and call it, say, ShareZoom, which will then accept two arrays for the two y-axes (the x-axis is the same for both plots). This, for me, seems to be the easiest way for ShareZoom to "know" about both plots. Updating the DrawPlot method should hopefully be fairly easy.
I estimate this should take you about 10 minutes, max! Not including
learning about objects, of course. But, once you do, you will understand
why this is so incredible easy to do.
> PS: cgZPlot is really a fantastic tool!
Thank you. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|