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

include an rCharts into a html repport #104

Open
danreb25 opened this issue Mar 21, 2014 · 4 comments
Open

include an rCharts into a html repport #104

danreb25 opened this issue Mar 21, 2014 · 4 comments

Comments

@danreb25
Copy link

any idea how to do this?
I was hoping it would be ok with

<%=
library(rCharts)
n1 <- nPlot(mpg ~ wt, data = mtcars, type = 'scatterChart')
n1$show('inline', include_assets = TRUE, cdn = TRUE)
%>

but no success, just blank with no error or messages

Thanks for any comments,

Cheers

@danreb25
Copy link
Author

oops! I probably have an install problem,

I'll reinstall the latest rCharts packages and try again ... after the we.
I'll keep you informed

Cheers

@danreb25
Copy link
Author

Well,

after some installations tricks (cf. ramnathv/rCharts#373 for details) , I came up with the following solution

...
<%
#----------------------------------------------------
# template function definition section
#----------------------------------------------------
save_stdout <- function(x){
  paste(capture.output(x), collapse = '\n')
}
%>
...

<%=
require(rCharts);
a <- hPlot(Pulse ~ Height, data = MASS::survey, type = "bubble", title = "Zoom demo", subtitle = "bubble chart", size = "Age", group = "Exer");
save_stdout(a$show('inline', include_assets = TRUE, standalone = TRUE));
%>

@daroczig
Copy link
Member

Great to know that this works, rCharts is indeed a great tool. Maybe we can include the save_stdout in the package, if you wish.

@danreb25
Copy link
Author

yes, but we probably have to think about something more generic and be able to print html if we wish the plot to be dynamic ( only in an html reppport I guess, but the next questions will then be how to deal with dependencies -*.css, *.js - and local vs. web-server deployment) and a picture if we are ok to lose the dynamic part (e.g. pdf, doc, ....).
Maybe the default policy can just be if html then dynamic ( iframes are probably better to store charts with many data, and to prevent libraries conflict. For Iframe cf showMethod='iframe' in the gfa.rcharts.save.wrapper explained in #105) else then pictures
For the picture part, the only solution I found is explained in #105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants