5

我正在处理googleVis图表,并希望使用包将 gvis 对象(存储为 HTML 的图像)嵌入为内联mailR

我有以下代码可以从我的服务器发送邮件 -

library(mailR)
send.mail(from = "admin_xxx@apsmail.xx.xxx.xx",
          to = c("first.second@jba.com"),
          subject = paste("Batch Job Stats on",now),
          body = paste("Dear Sir/Madam,<br><br>

                       Please find below the image",".<br><br>",
                       "<img src=\"D:/xx/Batch_Processing/Batch_Processing_Run/Rplot1.png\">",".<br><br>"
          ),
          html = TRUE,inline = TRUE,         
          smtp = list(host.name = "xxxx01.xxx.xxx.xx"),
          authenticate = FALSE,
          send = TRUE)

上面的代码运行良好 - 我正在嵌入一个图像(存在于我服务器的 D 驱动器中)

现在我googleVis用来创建图表并将它们存储在html文件中。(存在于我服务器的 D 盘中)

Gauge <-  gvisGauge(CityPopularity,
options=list(min=0, max=800, greenFrom=500,
greenTo=800, yellowFrom=300, yellowTo=500,
redFrom=0, redTo=300, width=400, height=300))
plot(Gauge)

print(Gauge, tag="chart", file="test1.html")

所以现在我的问题是我无法嵌入我的.html文件(使用上面的代码创建 - test1.html)来发送带有googleVis嵌入在邮件描述正文中的图表图像的电子邮件。(我无法将 gvis 对象 -Chart 保存为 .png )。我已经看到了解决方案 - 与 SO 中的类似,但这对我没有帮助。

4

1 回答 1

-1

如果您将“tmp.html”作为记录打开(即位置显示为documents://*/tmp.html),则可能会发生安全警告。您需要的是通过 http:// 访问 html。

因此,如果您可以更改任何可以访问标签的网站页面(例如,博客),您可以通过基本上复制和粘贴 tmp.html 的内容来使用它,类似于以下内容:

http://takahashik.blogspot.com/2011/01/googlevis-example.html

这是著名的“iris”形式的案例:

http://takahashik.blogspot.com/2011/01/googlevis-case信息 iris_10.html

另外,如果您有 Web 服务器,则可以通过在服务器上传输 tmp.html 来使用它。

于 2015-05-25T00:57:03.770 回答