如何在网页中包含Rchart图像?

时间:2014-11-20 10:03:15

标签: html r highcharts rcharts

这是指我的普遍问题。

Error while plotting data in rchart using HighChart

输入数据

data.csv

A   B   C
2   3   0
4   5   0
4   -3   1
-8   5   1
2   -3   2
-2   -5   2
12   3   3
-4   5   3

Rchart代码:

require(devtools)
install_github(’rCharts’ ,’ramnathv’)
sampledata<-read.csv("data.csv",header=TRUE,sep="\t")
h1 <- hPlot(x = sampledata[1,], y = sampledata[2,], data = sampledata, type = "scatter", group=sampledata[3,])
h1 <- hPlot(x = 'A', y = 'B', data = sampledata, type = "scatter", group='C') 

Chart can be save to html format using following command 
h1$save('mychart.html', cdn  = TRUE)

http://s000.tinyupload.com/index.php?file_id=05456920443055569002

现在我可以使用HighChart生成Rchart,但现在我需要在下面显示的HTML页面的一个部分(在Section Code中)显示该图像。我该如何实现它?

<!DOCTYPE html>
<html>

<head>
<style>
header {
    background-color:black;
    color:white;
    text-align:center;
    padding:5px;     
}
nav {
    line-height:30px;
    background-color:#eeeeee;
    height:300px;
    width:100px;
    float:left;
    padding:5px;          
}
section {
    width:350px;
    float:left;
    padding:10px;        
}
footer {
    background-color:black;
    color:white;
    clear:both;
    text-align:center;
    padding:5px;         
}
</style>
</head>

<body>

<header>
<h1>City Gallery</h1>
</header>

<nav>
London<br>
Paris<br>
Tokyo<br>
</nav>

<section>
<h1>Image</h1>
**Need  to include dynamic image here**
</section>

<footer>
Copyright © W3Schools.com
</footer>

</body>

0 个答案:

没有答案