Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Last active August 29, 2015 14:04
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/13b3c696fb21d10e38e3 to your computer and use it in GitHub Desktop.
Save ramnathv/13b3c696fb21d10e38e3 to your computer and use it in GitHub Desktop.
Pyramid Charts with rCharts
library(rCharts)
h1 <- Highcharts$new()
h1$chart(type = "pyramid")
h1$series(name='Unique users', data=list(
list('Website visits', 15654),
list('Downloads', 4064),
list('Requested price list', 1987),
list('Invoice sent', 976),
list('Finalized', 84)
))
h1$addAssets(jshead = "http://code.highcharts.com/modules/funnel.js")
h1
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<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>
<script src='http://code.highcharts.com/modules/exporting.js' type='text/javascript'></script>
<script src='http://code.highcharts.com/modules/funnel.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
margin-left: auto;
margin-right: auto;
width: 800px;
height: 400px;
}
</style>
</head>
<body >
<div id = 'chartb7e2e2328ca' class = 'rChart highcharts'></div>
<script type='text/javascript'>
(function($){
$(function () {
var chart = new Highcharts.Chart({
"dom": "chartb7e2e2328ca",
"width": 800,
"height": 400,
"credits": {
"href": null,
"text": null
},
"exporting": {
"enabled": false
},
"title": {
"text": null
},
"yAxis": {
"title": {
"text": null
}
},
"chart": {
"type": "pyramid",
"renderTo": "chartb7e2e2328ca"
},
"series": [
{
"name": "Unique users",
"data": [
[
"Website visits",
15654
],
[
"Downloads",
4064
],
[
"Requested price list",
1987
],
[
"Invoice sent",
976
],
[
"Finalized",
84
]
]
}
],
"id": "chartb7e2e2328ca"
});
});
})(jQuery);
</script>
<script></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment