- 
                Notifications
    You must be signed in to change notification settings 
- Fork 636
Add candlestick support #2053
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
          
     Open
      
      
            moutikabdessabour
  wants to merge
  7
  commits into
  plotly:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
moutikabdessabour:add_candlestick_support
  
      
      
   
  
    
  
  
  
 
  
      
    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
                    Add candlestick support #2053
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            7 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      9fb273d
              
                Closes #2016. Added support for `geom_candlestick`.
              
              
                moutikabdessabour 35b95a8
              
                Added test to showcase the functionality.
              
              
                moutikabdessabour e18b3fc
              
                Added test to showcase the functionality.
              
              
                moutikabdessabour 46203d5
              
                Added test to showcase the functionality.
              
              
                moutikabdessabour 68466fc
              
                Modified the step test as the new feauture kinda broke the tests
              
              
                moutikabdessabour 47cc776
              
                Update NEWS.md
              
              
                moutikabdessabour 505b882
              
                Update tests
              
              
                moutikabdessabour File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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
    
  
  
    
              
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
  
    
      This file contains hidden or 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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| if(require(tidyquant)){ | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use  | ||
| df <- data.frame(symbol = c("AMZN", "AMZN", "AMZN", "AMZN", "AMZN", | ||
| "AMZN", "AMZN", "AMZN", "AMZN", "AMZN", "AMZN", "AMZN", "AMZN", | ||
| "AMZN", "AMZN", "AMZN", "AMZN", "AMZN", "AMZN"), date = structure(c(17140, | ||
| 17141, 17142, 17143, 17144, 17147, 17148, 17149, 17150, 17151, | ||
| 17154, 17155, 17156, 17157, 17158, 17162, 17163, 17164, 17165 | ||
| ), class = "Date"), open = c(745, 763.98999, 764.549988, 771.869995, | ||
| 770, 766.400024, 764.960022, 778.25, 766.280029, 765, 758.890015, | ||
| 768.650024, 770, 768.119995, 764.549988, 763.400024, 776.25, | ||
| 772.400024, 766.469971), high = c(761.48999, 768.23999, 770.419983, | ||
| 773.789978, 770.25, 766.890015, 782.460022, 780.859985, 769.099976, | ||
| 765.130005, 770.5, 774.390015, 771.219971, 771.210022, 766.5, | ||
| 774.650024, 780, 773.400024, 767.400024), low = c(742, 757.25, | ||
| 755.820007, 765.190002, 765.340027, 757.200012, 762, 762.809998, | ||
| 760.309998, 754, 756.159973, 767.710022, 765.700012, 763.02002, | ||
| 757.98999, 761.200012, 770.5, 760.849976, 748.280029), close = c(759.359985, | ||
| 764.719971, 770.419983, 767.330017, 768.659973, 760.119995, 774.340027, | ||
| 768.820007, 761, 757.77002, 766, 771.219971, 770.599976, 766.340027, | ||
| 760.590027, 771.400024, 772.130005, 765.150024, 749.869995), | ||
| volume = c(4314700, 3794700, 3684900, 3189600, 2470900, 2963900, | ||
| 5285300, 5454800, 3801900, 4848200, 3113200, 2703600, 2044600, | ||
| 2543600, 1981600, 2638700, 3301000, 3158300, 4139400), adjusted = c(759.359985, | ||
| 764.719971, 770.419983, 767.330017, 768.659973, 760.119995, | ||
| 774.340027, 768.820007, 761, 757.77002, 766, 771.219971, | ||
| 770.599976, 766.340027, 760.590027, 771.400024, 772.130005, | ||
| 765.150024, 749.869995), stringsAsFactors = F) | ||
|  | ||
| test_that("candlestick gets rendered correctly", { | ||
| p <- ggplot(df, aes(x = date, y = close)) + | ||
| geom_candlestick(aes(open = open, close = close, high = high, low = low)) + | ||
| labs(title = "AMZN: New Candlestick Geom!", | ||
| x = "", y = "Closing Price") + | ||
| coord_x_date(ylim = c(700, 870)) | ||
| expect_doppelganger(ggplotly(p), "geom-candle") | ||
| }) | ||
| } | ||
  
    
      This file contains hidden or 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
    
  
  
    
              
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably do more to come up with better
hovertext(the tooltip info is basically useless at this point).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look into this