From a9ccca57c0581ce968da3527edeb74e49cd274a0 Mon Sep 17 00:00:00 2001 From: Eric Hung Date: Tue, 9 Aug 2016 18:42:52 +0800 Subject: [PATCH] Pass layout settings to the plot object In the original chartSeries that used S4 method, chart.layout is called to setup layout and margins. Since now chartSeries is a wrapper for chart_Series, it should be layout-free and only margins are applied. --- R/chartSeries.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/R/chartSeries.R b/R/chartSeries.R index e55060e7..fe3a3f21 100644 --- a/R/chartSeries.R +++ b/R/chartSeries.R @@ -594,6 +594,15 @@ function(x, } } } + # Pass chart.layout settings + if(!inherits(layout, "chart.layout")) { + cl <- chart.layout(length(cs$Env$ylim)-1) + } else + cl <- layout + # since xts::plot.xts is applied, chartSeries should now be layout free + # layout(cl$mat, cl$width, cl$height, respect=FALSE) + cs$Env$mar <- cl$par.list[[3]]$mar + assign(".xts_chob", cs, xts:::.plotxtsEnv) if(plot) # draw the chart cs