我正在尝试在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功能创建的绘图?
答案 0 :(得分:0)
尝试rplot
:
var req = $("#output").rplot("plotGraph", {
filepath:"C:/Users/abc/Desktop/test.txt"
});
ocpu.rpc
只是为了回到json。