无效的图形状态 opencpu

Invalid graphics state opencpu

我目前正在使用 opencpu 来托管我的 R 包。但它没有显示图表。我得到了 pdf、svg 和 pdf 链接,如果我点击其中任何一个,就会显示图表。但是,在控制台中我有这个错误 "invalid graphics state In 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>