Skip to content

Instantly share code, notes, and snippets.

@reinholdsson
Created June 26, 2013 20:28
Show Gist options
  • Save reinholdsson/5871324 to your computer and use it in GitHub Desktop.
Save reinholdsson/5871324 to your computer and use it in GitHub Desktop.
a <- rCharts:::Highcharts$new()
a$yAxis(title=list(text='Series 1', style = list(color = "blue")))
a$yAxis(title=list(text='Series 2', style = list(color = "red")), opposite = T, replace = F)
a$series(data = sample(1:100, 12), type = "column", yAxis = 0, color = "blue")
a$series(data = sample(1:100, 12), type = "line", yAxis = 1, color = "red")
a$tooltip(shared=T)
a
<!doctype HTML>
<meta charset = 'utf-8'>
<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='chart10d570672646' class='rChart nvd3Plot highcharts'></div>
<br/>
<pre><code class='r'>a &lt;- rCharts:::Highcharts$new()
a$yAxis(title=list(text='Series 1', style = list(color = &quot;blue&quot;)))
a$yAxis(title=list(text='Series 2', style = list(color = &quot;red&quot;)), opposite = T, replace = F)
a$series(data = sample(1:100, 12), type = &quot;column&quot;, yAxis = 0, color = &quot;blue&quot;)
a$series(data = sample(1:100, 12), type = &quot;line&quot;, yAxis = 1, color = &quot;red&quot;)
a$tooltip(shared=T)
a
</code></pre>
</div>
</div>
</div>
<script type='text/javascript'>
(function($){
$(function () {
var chart = new Highcharts.Chart({
"dom": "chart10d570672646",
"width": 800,
"height": 400,
"credits": {
"href": null,
"text": null
},
"title": {
"text": null
},
"yAxis": [
{
"title": {
"text": "Series 1",
"style": {
"color": "blue"
}
}
},
{
"title": {
"text": "Series 2",
"style": {
"color": "red"
}
},
"opposite": true
}
],
"series": [
{
"data": [ 90, 89, 41, 95, 21, 66, 7, 93, 27, 81, 18, 65 ],
"type": "column",
"yAxis": 0,
"color": "blue"
},
{
"data": [ 51, 3, 1, 74, 88, 56, 48, 69, 54, 57, 15, 85 ],
"type": "line",
"yAxis": 1,
"color": "red"
}
],
"tooltip": {
"shared": true
},
"id": "chart10d570672646",
"chart": {
"renderTo": "chart10d570672646"
}
});
});
})(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