我目前使用opencpu来托管我的R包。但它没有显示图形。我得到了pdf、svg和pdf链接,如果单击其中任何一个,就会显示图形。然而,在控制台,我有这个错误"无效的图形状态在call:replayPlot(x)"。
下面是我的R函数。
plotGraph <- function(filename) {
filepath<-system.file("extdata", filename, package="demp")
sample<-read.csv(filepath,header=FALSE)
ecg=sample[2]
graph<-plot.ts(ecg)
}
下面是我的angularjs代码。
$scope.getData= function(filename){
filename=$scope.selectedFile+".csv";
var req=$("#output").rplot("plotGraph", {
filename:filename
});
}
和网页中的div:
<div id="output"></div>
我已经设法通过指定div的高度和宽度来解决这个问题,像这样
<div id="output" style="height: 900px; width:900px"></div>