Monday, December 10, 2012

d3 Showreel Combined with R and Shiny

Since the d3 portion of the example provide in my last post d3 and r interacting through shiny was so weak, I thought it would be interesting to combine the much more compelling Showreel Example with the same stock data.  However, this time the data will come from R getSymbols.  Also, most of the plots would be better using cumulative return data, so we will use R to convert the price data into a cumulative return series.

Almost all credit for the code contained in this example goes to Mike Bostock, and although much of the code is now gone, the structure and idea belong to Trestle Technology's Jeff Allen.

See it live in the browser at http://glimmer.rstudio.com/timelyportfolio/shiny-d3-showreel/, and all code is hosted on Github, so please play, experiment, and let me know what great things you do with this.

2 comments:

  1. Pretty durn amazing! Really well done. Do you have a suggested tutorial for beginning D3? Also, have to ask-what is name of the music in the soundtrack? Matches the pace of the animation perfectly. Thanks for sharing this application.

    ReplyDelete
  2. Glad you enjoyed. Unfortunately, I have not found a comprehensive one-stop shop for d3 learning, but here are a couple of sources that helped me get started:

    think this is the best http://christopheviau.com/d3_tutorial/
    3 part series http://ufert.se/user-acquisition/mobile-game-monetization/building-a-lightweight-flexible-d3-js-dashboard-part-1-of-2/
    http://vimeo.com/search?q=enjalot+dot+enter
    http://swizec.com/blog/quick-scatterplot-tutorial-for-d3-js/swizec/5337
    http://tympanus.net/codrops/2012/08/29/multiple-area-charts-with-d3-js/

    For a full book, there is http://my.safaribooksonline.com/book/programming/javascript/9781449328788. This was helpful, but I really wish the author provided more examples.


    The music is A Dirty Trick by Franco Micalizzi. It was a suggestion from youtube that I thought fit very nicely in music and title. Glad you like it.

    ReplyDelete