block by ramnathv 13b3c696fb21d10e38e3

Pyramid Charts with rCharts

Full Screen

index.html

<!doctype HTML>
<meta charset = 'utf-8'>
<html>
  <head>
    
    <script src='//code.jquery.com/jquery-1.9.1.min.js' type='text/javascript'></script>
    <script src='//code.highcharts.com/highcharts.js' type='text/javascript'></script>
    <script src='//code.highcharts.com/highcharts-more.js' type='text/javascript'></script>
    <script src='//code.highcharts.com/modules/exporting.js' type='text/javascript'></script>
    <script src='//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>

code.R

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