-
-
Notifications
You must be signed in to change notification settings - Fork 225
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 chartSeries() function to be a wrapper for chart_Series() function #95
Open
erichung0404
wants to merge
12
commits into
joshuaulrich:master
Choose a base branch
from
erichung0404:refactor_chartSeries
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Refactor chartSeries() function to be a wrapper for chart_Series() function #95
erichung0404
wants to merge
12
commits into
joshuaulrich:master
from
erichung0404:refactor_chartSeries
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remain the code that handles argument differ from chart_Series in the original chartSeries function. Parameters created by chartTheme() are passed to the plot object and coordinate with parameters created by chart_theme(), theme$BBands, for example.
Add legend to show the last close price of series.
As the direction of minor ticks of the original chartSeries is downward, the second action of replot_xts-class object is modified to reach that.
To create the chart the same as quantmod::chartSeries, border of plotting area and inbox color are applied. Remove x-axis grid line.
In the original chartSeries, space of left and right sides is reserved. x limit is reset to reach that, which makes the chart more readable. Change inbox color from theme$fill to theme$area. Since the inbox area is behind of horizontal ticks and border should be on the top of the ticks, border is added after the ticks and the inbox area.
Add TA functionality to handle "addVo()" argument. If Volume is not included in x, "addVo()" will be removed from TA. Allow TA=NULL to work.
To coordinate with addPoints(), when x is specified by numeric vector and without subsetting the intersection of x and the index of series will be FALSE because xsubset is always "". It should be the index of the raw series, namely, 1:NROW(x), which is also the original setting in chartSeries.
When reChart is called to draw subset series, minor ticks on xycoords$x do not change with the subset sereis. Fix xycoords$x to be xycoords$x[1:NROW(xsubset)] in the x-axis expression.
c454d5e
to
7affc11
Compare
Since "Volume" is not included in xts series, show.vol will be FALSE and grep("addVo()", TA) returns 'integer(0)', TA specified in the argument will not be added to the plot object. 'match' is applied instead.
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.
a9ccca5
to
29edf4d
Compare
The last price displayed on chart will change if subset is specified in chartSeries. However when zoomChart is called view the subset series, the last price didn't change. The displayed price should be the price of the last day in the subset period.
c54564b
to
5216c11
Compare
Users can now enter TAs' color settings by calling chartTheme(addTA = list(...)) to create custom theme parameters. BBands settings in .chart.theme is refactored to coordinate with addBBands function.
5216c11
to
fe79a2f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
chartSeries() function is now a wrapper for chart_Series() function so S4 method and objects,
chob
andchobTA
, are deprecated. That means chartSeries.chob() function and chartTA() function are no longer available as well. Since chartSeries() has more detailed arguments than chart_Series(), mostly color settings, main changes are matching the parameters created by chartTheme() function with parameters of chart_theme() function that already exist in plot_object$Env$theme and passing those arguments to the plot object. Minor ticks setting of chartSeries() is different from its default setting in plot.xts() so the action is rewritten to make minor ticks downwards and space for both sides is reserved.