Question

Any suggestions on how to update a ggraphics widget on a specific gnotebook page.

I have multiple gnotebook pages (tabs) contaioning ggraphics using Quantmod's charSeries. I'm trying to update individual gnotebook pages. However, any change gets applied to the last page only and not to the page I want. Example of the relevant code below. I've tried Using svalue<- or focus<- to put the focus on the relevant page prior to updating but that doesn't work.

library("quantmod")
library ( gWidgets )
options ( guiToolkit="RGtk2" )
w <- gwindow("notebook example")
group <- ggroup(horizontal= FALSE, container = w)
notebook <- gnotebook(container=group)

symbol<-"EBT.AX"
getSymbols(symbol)

gg1<-ggraphics(cont=notebook, expand = TRUE, label="Trends")
   chartSeries(get(symbol),subset="last 2 months", name="Trends")
gg2<-ggraphics(cont=notebook, expand = TRUE, label="Momentum") 
   chartSeries(get(symbol),subset="last 2 months", name="Momentum")
gg3<-ggraphics(cont=notebook, expand = TRUE, label="Volatility") 
   chartSeries(get(symbol),subset="last 2 months",name="Volatile")

gbutton("update",container = group, handler = function(h,...) {
gg2 <- reChart(subset = "last 4 month", theme = "white")})
Was it helpful?

Solution

You can call visible(ggXXX) <- TRUE prior to plotting. This will make that ggraphics device the current one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top