;(function(d3, $, window, document, undefined){
  $(document).ready(function(){
    if($('#chartAnchor').length == 0) { return; }

    d3.json($('#chartAnchor').data('reports-path'), function(error, json){
      if(error){ throw error };

      var data = json[0];

      $('#loading-spinner').remove();

      var render = function(type){
        if(data.data.length == 0) { return renderer.noData(); }
        switch(type){
          case 'COUNTERS':
            var renderer = new Kiddo.Renderer('#chartAnchor');
            renderer.pieChart(data)
            break;
          case 'TIMELINE':
            var renderer = new Kiddo.Renderer('#chartAnchor');
            renderer.lineChart(data);
            break;
          case 'TABLE':
            new ReportsDataTables(null).buildTable(data['data'][0], $('#chartAnchor'));
            break;
          default:
            console.log('No such type implemented: ' + type);
            var renderer = new Kiddo.Renderer('#chartAnchor');
            renderer.noData();
        }
      };

      try{
        render(json[0].type);
      }catch(ex){
        console.log(ex);
        renderer.noData();
      }

    });
  });
})(d3, jQuery, window, document);

@@ -301,43 +301,76 @@
 ();%0A
-%0A
       
-var render 
+if (data === undefined %7C%7C%0A          data.data ==
 = 
-f
 un
-ction(type)%7B
+defined %7C%7C
 %0A   
@@ -374,19 +374,18 @@
         
-if(
+  
 data.dat
@@ -404,36 +404,145 @@
 0) %7B
- return renderer.noData(); %7D
+%0A        var renderer = new Kiddo.Renderer('#chartAnchor');%0A        return renderer.noData();%0A      %7D%0A%0A      var render = function(type)%7B
 %0A   

fix rendering when no data is returned