datastorm-open / rAmCharts

API for Amcharts
48 stars 16 forks source link

Change Object Parameters #52

Closed debsush closed 8 years ago

debsush commented 8 years ago

Hi,

If I have a stockpanel defined in one part of the Rscript within server.R outside of renderAmCharts. Now can I change or add a new property to that stockpanel later within the renderAmCharts function. Example below:

outside renderAmCharts define a stockpanel

stockpanels_Ls <<-  lapply(1:1, function(i)
        stockPanel(id=paste('fp',i,sep=""),
                   Title=i,
                   precision=2, 
                   drawingIconsEnabled=TRUE,
                   eraseAll=FALSE,
                   showCategoryAxis= TRUE,
                   autoDisplay=FALSE,
                   recalculateToPercents="never",                   
                   stockGraphs=stockgraphs_Ls
                   borderColor = "#ffffff",
                   columnWidth=.8,
                   thousandsSeparator=",",
                   borderAlpha = 1)%>>%
          setTrendLines(c(TrendlinersA,TrendlinersB))%>>%
          addValueAxis(valueAxis_obj1)%>>%
          addValueAxis(valueAxis_obj2)%>>%
          addListener('changed', 'function(event) {
                      var d = event.target.data[event.index].category; 
                      var ds = d.getFullYear() + "-" + d.getMonth() + "-" + d.getDate();
                      document.getElementById("date").innerHTML = ds;
                      }')%>>%           
          setGuides(c(guides_objP,guides_obj,guides_pivot))%>>%
          setStockLegend(periodValueTextComparing = '[[percents.value.close]]%',
                         periodValueTextRegular = '[[value.close]]')
          )  

Now later within the server.R script I would like to change the height of that stockpanel

output$plot1<- renderAmCharts {(

stockpanels_Ls.percentHeight = 30

chart<-pipeR:pipeline(
amStockChart(.......))

)}

I was not able to figure out the syntax. Thank you SD

Djaiff commented 8 years ago

Hi,

I don't understand why you instantiate you stockPanel in a list, could you explain ? In case you really need this syntax, you should use something like that: stockpanels_Ls[[1]] <- setProperties(stockpanels_Ls[[1]], percentHeight = 30)

Let me know if it's helped

Best, Jeff