Skip to content

Commit 90a419c

Browse files
committed
Refactor add_TA to use y_grid_lines instead of custom function
The original custom grid_lines function is very similar to y_grid_lines in replot_xts object but the latter restricts the output values to the upper limit and lower limit. About two intervals will be dropped so the labels of prior chart will not be blocked.
1 parent 4c1a341 commit 90a419c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

R/chart_Series.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,10 +522,8 @@ add_TA <- function(x, order=NULL, on=NA, legend="auto",
522522

523523
plot_object$add_frame(ylim=range(na.omit(xdata)),asp=1) # need to have a value set for ylim
524524
plot_object$next_frame()
525-
# add grid lines, using custom function for MACD gridlines
526-
lenv$grid_lines <- function(xdata,xsubset) {
527-
pretty(xdata[xsubset])
528-
}
525+
# add grid lines, using y_grid_lines function from replot_xts object
526+
lenv$grid_lines <- plot_object$Env$y_grid_lines
529527
exp <- c(expression(segments(1,grid_lines(xdata,xsubset),NROW(xdata[xsubset]),grid_lines(xdata,xsubset),
530528
col=theme$grid)), exp, # NOTE 'exp' was defined earlier to be plot_macd
531529
# add axis labels/boxes

0 commit comments

Comments
 (0)