Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Created April 30, 2013 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramnathv/5488102 to your computer and use it in GitHub Desktop.
Save ramnathv/5488102 to your computer and use it in GitHub Desktop.
Testing Higcharts
x=data.frame("S1"=c(9,8,9,1,3),"S2"=c(7,3,7,6,4))
rownames(x)=paste("factor",rownames(x))
a=rCharts:::Highcharts$new()
a$addParams(width = 550)
a$chart(type='line',polar=TRUE)
a$pane(size='80%')
a$title(text='Polarize-It',x=-80)
a$xAxis(categories=rownames(x),tickmarkPlacement='on',lineWidth=0)
a$yAxis(gridLineInterpolation='polygon',lineWidth=0,min=0)
a$data(x,pointPlacement='on')
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='chart16b572ca6f0' class='rChart nvd3Plot highcharts'></div>
<pre><code class='r'>x=data.frame(&quot;S1&quot;=c(9,8,9,1,3),&quot;S2&quot;=c(7,3,7,6,4))
rownames(x)=paste(&quot;factor&quot;,rownames(x))
a=rCharts:::Highcharts$new()
a$addParams(width = 550)
a$chart(type='line',polar=TRUE)
a$pane(size='80%')
a$title(text='Polarize-It',x=-80)
a$xAxis(categories=rownames(x),tickmarkPlacement='on',lineWidth=0)
a$yAxis(gridLineInterpolation='polygon',lineWidth=0,min=0)
a$data(x,pointPlacement='on')
a
</code></pre>
</div>
</div>
</div>
<script type='text/javascript'>
(function($){
$(function () {
var chart = new Highcharts.Chart({
"dom": "chart16b572ca6f0",
"width": 550,
"height": 400,
"credits": {
"href": null,
"text": null
},
"chart": {
"type": "line",
"polar": true,
"renderTo": "chart16b572ca6f0"
},
"pane": {
"size": "80%"
},
"title": {
"text": "Polarize-It",
"x": -80
},
"xAxis": [
{
"categories": [ "factor 1", "factor 2", "factor 3", "factor 4", "factor 5" ],
"tickmarkPlacement": "on",
"lineWidth": 0
}
],
"yAxis": [
{
"gridLineInterpolation": "polygon",
"lineWidth": 0,
"min": 0
}
],
"series": [
{
"name": "S1",
"data": [ 9, 8, 9, 1, 3 ],
"pointPlacement": "on"
},
{
"name": "S2",
"data": [ 7, 3, 7, 6, 4 ],
"pointPlacement": "on"
}
],
"id": "chart16b572ca6f0"
});
});
})(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