object对象显示在html页面中

时间:2016-10-19 10:52:11

标签: javascript jquery angularjs r opencpu

我正在尝试在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功能创建的绘图?

1 个答案:

答案 0 :(得分:0)

尝试rplot

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

ocpu.rpc只是为了回到json。