Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor reChart function to make plot_object settings changeable #112

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

erichung0404
Copy link

reChart function is the base function called by zoomChart() and zooom().
Since plot_object$subset didn't seem to work for plot.xts based object, special handling is provided to fix unequal length issue and make x-axis and y-axis value changeable. The issue occurs in xts:::chart.lines() function which calls lines() to draw original price series for x by plot_object$Env$xycoords$x and the subset series for y. So it throws error: "'x' and 'y' lengths differ." See issue joshuaulrich/xts#146 for more detailed information.

plot_object$subset doesn't work for plot.xts based object. The issue occurs
in xts:::chart.lines where it calls "lines" to create original series for x
by plot_object$Env$xycoords$x and the subset series for y. So it returns an
error: "'x' and 'y' lengths differ." See issue joshuaulrich#146.
To allow "subset" to work, new chart.lines function is given to handle
'x' and 'y' length differ error occurred in lines(xx$Env$xycoords$x, ...).
Different from zoom_Chart() for chart_Series, range.bars.type is specified
only if type is given when reChart is called. If length of the series is
greater than 300 range.bars.type will be  "matchsticks" but, when
zoomChart is called, even if the length of the subset series is lower than
300 range.bars.type doesn't change because users cannot specify type
in zoomChart. Type of the bars should be able to change with the length of
the subset series.
A warning occurred when we specify "last n months" to x[subset].
It throws warnings: NAs introduced by coercion. Since we consider
the length of subset series to determine the range.bars type,
handling for subset should be done before type. By doing so, subset
is well-handled to numeric vector.

Change bbands to BBands to coordinate with addBBands() function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants