Sha256: 8e057be90d38e8cfd1e1eea4cb11d67e661d0199ebf9515c67848f2d3da66292

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

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

    d3.json($('#chartAnchor').data('reports-path'), function(error, json){
      $('#loading-spinner').remove();

      var renderer = new Kiddo.Renderer('#chartAnchor');

      if (error) {
        ajaxErrorAlert(error);
        return renderer.noData();
      }

      var data = json[0];

      if (data === undefined ||
          data.data === undefined ||
          data.data.length == 0) {
        return renderer.noData();
      }

      var render = function(type){
        switch(type){
          case 'COUNTERS':
            renderer.pieChart(data);
            break;
          case 'TIMELINE':
            renderer.lineChart(data);
            // Date controls only make sense for timelines
            $('#date-controls').show();
            break;
          case 'TABLE':
            renderer.table(data);
            break;
          default:
            console.log('No such type implemented: ' + type);
            renderer.noData();
        }
      };

      try{
        render(data.type);
      } catch (ex){
        console.log(ex);
        renderer.noData();
      }
    });
  });
})(d3, jQuery, window, document);

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kanaui-4.0.3 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js
kanaui-4.0.2 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js
kanaui-4.0.1 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js
kanaui-2.2.1 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js
kanaui-4.0.0 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js
kanaui-2.1.3 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js
kanaui-2.1.2 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js
kanaui-2.1.1 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js
kanaui-2.1.0 app/assets/javascripts/kanaui/kiddo/kiddo_initialize.js