html 页面中显示的 object 对象

object Object displayed in html page

我正在尝试显示由 opencpu 服务器中的 R 函数绘制的图形。 但是,它只在 html 页面中显示 [object Object]。以下是我的 AngularJS 控制器中的代码。

var req = ocpu.rpc("plotGraph", {
                filepath:"C:/Users/abc/Desktop/test.txt"
            }, function(output){
              $("#output").text(output);
            }); 

以下是plotGraph包中的R函数。

plotGraph <- function(filepath) {
  test.ecg <- read.table(filepath, quote="\"", comment.char="")
  ecg=ts(test.ecg)
  plot(ecg)

}

如何显示 R 函数创建的绘图?

试试 rplot:

var req = $("#output").rplot("plotGraph", {
    filepath:"C:/Users/abc/Desktop/test.txt"
});

ocpu.rpc是为了取回json而已。