Skip to content

How to scroll in time in a quantmod chart?

5 messages · Michael Zak, Jeff Ryan, Wayne.W.Jones at shell.com

#
Hello

I use charts from the quantmod package and I'm excited! But now I'm  
asking myself, if there is a way to scroll in time if I want to  
display a lot of data (I have data for the last 10 years). Is there a  
option I can do that with quantmod itself or shall I give it try with  
the windows() function from the tkrplot package or is there an other  
solution for that?

Thank you, Michael Zak
#
Hi Michael,

You can't scroll per se, at least not by clicking.

You can however display only subsets of your data, without affecting
any TA additions you have on the charts.

?zoomChart and the 'subset' argument to chartSeries should do it.

library(quantmod)
getSymbols("QQQQ", from='1999-03-10')
periodicity(QQQQ)

chartSeries(QQQQ)  # the whole series
chartSeries(QQQQ, subset='last 6 months')
chartSeries(QQQQ, subset='2007')
chartSeries(QQQQ, subset='2000-01/2000-07-20')

zoomChart()  # full chart again

zoomChart('2006')

You can also change some chart parameters on the fly too:

reChart(type='bars')

You can interactively select time to view with zooom().  Double click
on the chart to go to the full data view.

The 3rd 'o' in 'zooom' is for good luck...and to avoid namespace clashes :)

HTH
Jeff
On Thu, Oct 16, 2008 at 11:39 AM, Michael Zak <michael at zak.li> wrote:

  
    
#
There is an example or two here:

http://www.quantmod.com/examples/charting/

Jeff
On Thu, Oct 16, 2008 at 11:48 AM, Jeff Ryan <jeff.a.ryan at gmail.com> wrote:

  
    
#
So far, this helps very nicely. I'll try it.

Cheerio, Michael
On 16.10.2008, at 18:50, Jeff Ryan wrote:

            
#
Hi there, 

Another suggestion is the animations package from CRAN. 
This is great for producing a series of plots that you can very easily scroll back and forth through. 
See for example: 

http://animation.yihui.name/da:ts:hans_rosling_s_talk


Another method would be to use the rpanel package to very easily generate tkrplots!

library(rpanel)
help(rp.tkrplot)
help(rp.doublebutton)




-----Original Message-----
From: r-sig-finance-bounces at stat.math.ethz.ch
[mailto:r-sig-finance-bounces at stat.math.ethz.ch]On Behalf Of Michael Zak
Sent: 16 October 2008 17:53
To: Jeff Ryan
Cc: R-SIG-Finance at stat.math.ethz.ch
Subject: Re: [R-SIG-Finance] How to scroll in time in a quantmod chart?


So far, this helps very nicely. I'll try it.

Cheerio, Michael
On 16.10.2008, at 18:50, Jeff Ryan wrote:

            
_______________________________________________
R-SIG-Finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.