**Timely Portfolio**, and kindly contributed to R-bloggers)

I am still definitely in the proof of concept stage, but as I progress I get more excited about the prospects of combining d3.js with R and Axys through Bryan Lewis’ really nice R websockets package (even nicer now that he has added the daemonize function). In this iteration, I will add a cumulative growth line chart, some animation and transitions, and then javascript will ask R to calculate drawdowns. Instead of R returning a chart like last time, R will send the results of the drawdown calculations through JSON through the websocket. We will then use d3.js to draw a line chart of drawdowns. This becomes really powerful when we consider the existing and thanks to Google Summer of Code soon to be added risk/return calculations offered by the R PerformanceAnalytics package.

As one last bonus at the end of the video you will see that we can get this interactive reporting experience and websocket communication all on our Iphone and Ipad.

As a quick review of what is happening

- Axys runs a report called perhstsp.rep.
- Axys calls the cdataset.xlsm testd3axys macro and sends performance information.
- Excel cdataset.xlsm testd3axys macro does some very basic formatting, converts the data to JSON, creates a webpage, and opens the webpage in the default browser.
- Browser opens the webpage and d3.js generates a bar graph of performance and then a cumulative growth line chart.
- Browser provides a button to open a websocket with R and send the performance information originally calculated in Axys.
- R receives the performance data through the websocket, calculates drawdown, and then sends the drawdown calculations as JSON back to the browser.
- Browser receives the drawdown calculations and d3.js plots them as a line chart.

The next set of iterations will focus on cleaning up the d3.js charts and adding interactivity.

So far I have received no comments. Please let me know what you think about this.

The list of acknowlegements is starting to get long. I really appreciate all the fine work done by Mike Bostock on d3.js https://github.com/mbostock/d3/wiki, the dedicated authors of the R package PerformanceAnalytics http://cran.r-project.org/web/packages/PerformanceAnalytics/index.html, Bryan the author of http://illposed.net/websockets.html and the example, the author of RJSONIO http://cran.r-project.org/web/packages/RJSONIO/index.html, and Bruce McPherson at http://excelramblings.blogspot.com/ for the inspirational idea.

To work through on your own, you will need the Excel file cdataset.xlsm, the Axys report perhstsp.rep, and the R code from GIST.

**leave a comment**for the author, please follow the link and comment on their blog:

**Timely Portfolio**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...