Skip to content

Instantly share code, notes, and snippets.

@reinholdsson
Created June 22, 2013 13:43
Show Gist options
  • Save reinholdsson/5840901 to your computer and use it in GitHub Desktop.
Save reinholdsson/5840901 to your computer and use it in GitHub Desktop.
a <- rCharts:::Highcharts$new()
a$chart(type = "spline")
a$series(list(
list(data = c(1, 3, 2, 4, 5, 4, 6, 2, 3, 5, NA), dashStyle = "longdash"),
list(data = c(NA, 4, 1, 3, 4, 2, 9, 1, 2, 3, 4), dashStyle = "shortdot")
))
a$legend(symbolWidth = 80)
a
<!doctype HTML>
<html>
<head>
<link rel='stylesheet' href="http://netdna.bootstrapcdn.com/bootswatch/2.3.1/cosmo/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css" >
<link rel='stylesheet' href="http://twitter.github.io/bootstrap/assets/js/google-code-prettify/prettify.css">
<script src='http://code.jquery.com/jquery-1.9.1.min.js' type='text/javascript'></script>
<script src='http://code.highcharts.com/highcharts.js' type='text/javascript'></script>
<script src='http://code.highcharts.com/highcharts-more.js' type='text/javascript'></script>
<style>
.rChart {
display: block
margin: auto auto;
width: 800px;
height: 400px;
}
body {
margin-top: 60px;
}
</style>
</head>
<body>
<div class='container'>
<div class='row'>
<div class='span9'>
<div id='chart66531e04bbc5' class='rChart nvd3Plot highcharts'></div>
<br/>
<pre><code class='r'>a &lt;- rCharts:::Highcharts$new()
a$chart(type = &quot;spline&quot;)
a$series(list(
list(data = c(1, 3, 2, 4, 5, 4, 6, 2, 3, 5, NA), dashStyle = &quot;longdash&quot;),
list(data = c(NA, 4, 1, 3, 4, 2, 9, 1, 2, 3, 4), dashStyle = &quot;shortdot&quot;)
))
a$legend(symbolWidth = 80)
a
</code></pre>
</div>
</div>
</div>
<script type='text/javascript'>
(function($){
$(function () {
var chart = new Highcharts.Chart({
"dom": "chart66531e04bbc5",
"width": 600,
"height": 400,
"credits": {
"href": null,
"text": null
},
"title": {
"text": null
},
"yAxis": {
"title": {
"text": null
}
},
"chart": {
"type": "spline",
"renderTo": "chart66531e04bbc5"
},
"series": [
{
"data": [ 1, 3, 2, 4, 5, 4, 6, 2, 3, 5, null ],
"dashStyle": "longdash"
},
{
"data": [ null, 4, 1, 3, 4, 2, 9, 1, 2, 3, 4 ],
"dashStyle": "shortdot"
}
],
"legend": {
"symbolWidth": 80
},
"id": "chart66531e04bbc5"
});
});
})(jQuery);
</script>
</body>
<!-- Google Prettify -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/188.0.0/prettify.js"></script>
<script
src='https://google-code-prettify.googlecode.com/svn-history/r232/trunk/src/lang-r.js'>
</script>
<script>
var pres = document.getElementsByTagName("pre");
for (var i=0; i < pres.length; ++i) {
pres[i].className = "prettyprint linenums";
}
prettyPrint();
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment