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

nPlot prints text instead of graph #734

Open
preston-reynolds opened this issue Jan 12, 2018 · 0 comments
Open

nPlot prints text instead of graph #734

preston-reynolds opened this issue Jan 12, 2018 · 0 comments

Comments

@preston-reynolds
Copy link

Hi Ramanth,

I've been banging my head against this for too long, and I think it's finally time to just ask for some help...

I've taken code you have show in other places (so as to remove myself as a variable), but when I knit the HTML page using RStudio, it gives me a chunk of text instead of a chart.

require(rCharts)
hair_eye_male <- subset(as.data.frame(HairEyeColor), Sex == "Male")
n1 <- nPlot(Freq ~ Hair, group = "Eye", data = hair_eye_male, type = "multiBarChart")
n1$print('chart2', include_assets = TRUE, cdn = TRUE)

Produces:

## <link rel='stylesheet' href=C:/Users/prerey/Documents/R/win-library/3.4/rCharts/libraries/nvd3/css/nv.d3.css>
## <link rel='stylesheet' href=C:/Users/prerey/Documents/R/win-library/3.4/rCharts/libraries/nvd3/css/rNVD3.css>
## <script type='text/javascript' src=C:/Users/prerey/Documents/R/win-library/3.4/rCharts/libraries/nvd3/js/jquery-1.8.2.min.js></script>
## <script type='text/javascript' src=C:/Users/prerey/Documents/R/win-library/3.4/rCharts/libraries/nvd3/js/d3.v3.min.js></script>
## <script type='text/javascript' src=C:/Users/prerey/Documents/R/win-library/3.4/rCharts/libraries/nvd3/js/nv.d3.min-new.js></script>
## <script type='text/javascript' src=C:/Users/prerey/Documents/R/win-library/3.4/rCharts/libraries/nvd3/js/fisheye.js></script> 
##  <style>
##   .rChart {
##     display: block;
##     margin-left: auto; 
##     margin-right: auto;
##     width: 800px;
##     height: 400px;
##   }  
##   </style>
## <div id = 'chart2' class = 'rChart nvd3'></div>
## <script type='text/javascript'>
##  $(document).ready(function(){
##       drawchart2()
##     });
##     function drawchart2(){  
##       var opts = {
##  "dom": "chart2",
## "width":    800,
## "height":    400,
## "x": "Hair",
## "y": "Freq",
## "group": "Eye",
## "type": "multiBarChart",
## "id": "chart2" 
## },
##         data = [
##  {
##  "Hair": "Black",
## "Eye": "Brown",
## "Sex": "Male",
## "Freq":             32 
## },
.......
##        nv.utils.windowResize(chart.update);
##        return chart;
##       });
##     };
## </script>

Any chance you have a suggestion as to what I might be doing wrong?
Thanks a bunch!!

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

1 participant