【问题标题】:how can i embed rcharts(nplot) into shiny with html file?如何将 rcharts(nplot) 嵌入到闪亮的 html 文件中?
【发布时间】:2015-12-13 14:38:03
【问题描述】:

我想将一个 nplot 嵌入到闪亮的 server.R 中

shinyServer(function(input, output) {

  output$testChart <- renderChart2({
n1<-nPlot(Freq ~ Var1, data=speedTable, type="discreteBarChart", color="blue")
n1$xAxis(axisLabel = "Heading")
n1$yAxis(axisLabel = "label", width = 40)
n1$set(title = "Title")
n1$addParams(dom = 'testChart') 
return(n1)

})
})

我的 index.html 是这样的:

<html>

<head>
  <script src="shared/jquery.js" type="text/javascript"></script>
  <script src="shared/shiny.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="shared/shiny.css"/> 
</head>

<body>
  <br />
  <br />
  <hr />
<div class="rChart nvd3" id="testChart"></div>
</body>

</html>

但在页面中没有显示任何内容? 非常感谢您的帮助

【问题讨论】:

标签: html shiny rcharts


【解决方案1】:

您好,您必须下载 D3NVD3 并将它们包含在您的 HTML 中:

<script src="d3.min.js"></script>
<link href="nv.d3.min.css" rel="stylesheet">
<script src="nv.d3.min.js"></script>

对于图表做类似的事情:

<div id="testChart" class="shiny-html-output rChart nvd3"></div>
<style>.nvd3-svg { margin: 0px; padding: 0px; height: 100%; width: 100%; }</style> 

【讨论】:

    猜你喜欢
    • 2013-07-12
    • 1970-01-01
    • 2017-12-22
    • 2020-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多