首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rapache brew正在生成暗图

Rapache brew正在生成暗图
EN

Stack Overflow用户
提问于 2012-03-09 04:47:31
回答 1查看 321关注 0票数 0

我终于弄明白了rapahce brew。它可以在没有的情况下工作,但当我加载http:localhost/test.brew文件时,我的浏览器显示一个黑色方块。当我查看位置中的文件时,它就在那里。

有没有人看过这个?

以下是test.brew文件的内容:

代码语言:javascript
复制
<%

library(reshape2)
library(ggplot2)
library(Cairo)

x <- data.frame(read.table("/R/output/output.txt", sep=",", header=T))
y <- melt(x, id=c("Hostname", "Date", "MetricType"))
y$value <-as.numeric(y$value)
yy <- dcast(y, Hostname + Date + variable ~ MetricType, fun.aggregate=mean)
yy$variable <- as.integer(gsub('Hour', '', yy$variable))
yy$variable <- paste(yy$variable, ":00:00", sep='')
yy$Date <- as.Date(yy$Date, format='%m/%d/%Y')
yy$Date <- paste(yy$Date, yy$variable)
db1 <- subset(yy, yy$Hostname=="server1")
db1<-data.frame(db1)
db1$Date <-as.POSIXct(db1$Date, "%Y-%m-%d %H:%M:%S", tz="EST")

filename <- paste(tempfile(tmpdir='/usr/local/apache2/htdocs'), '.png', sep='')
CairoPNG(filename)
qplot(Date, CPUAVG, data=db1, geom=c("line", "smooth"), method = "lm", ylab="AVG CPU", xlab="Date", main="Server1")
dev.off()


%>
<img src="<%=gsub('/usr/local/apache2/htdocs', '', filename)%>"/>                                   
</body>
</html>
EN

回答 1

Stack Overflow用户

发布于 2012-03-09 22:00:15

如果任何人有同样的问题,这里是答案:

代码语言:javascript
复制
print(qplot(Date, CPUAVG, data=db1, geom=c("line", "smooth"), method = "lm", ylab="AVG CPU", xlab="Date", main="Server1"))

qplot需要用打印框进行包装。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9624695

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档