All files / builds/1000i100/quiz-maker/generated/maintainability/assets/scripts plato-display.js

0% Statements 0/59
0% Branches 0/1
0% Functions 0/1
0% Lines 0/59

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                                                                                                                       
/*global $:false, _:false, Morris:false, __history:false */
/*jshint browser:true*/

$(function(){
  "use strict";

  function drawHistoricalChart (history) {
    var data = _.map(history, function (record) {

      var date = new Date(record.date);
      return {
        date : date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(),
        average_maintainability : parseFloat(record.average.maintainability),
        average_sloc : record.average.sloc
      };
    }).slice(-20);

    Morris.Area({
      element     : 'chart_historical_sloc',
      data        : data,
      xkey        : 'date',
      ykeys       : ['average_sloc'],
      parseTime   : false,
      lineColors  : ['#2A2A2A'],
      pointSize   : 0,
      lineWidth   : 0,
      grid        : false,
      axes        : false,
      hideHover   : 'always',
      fillOpacity : 1
    });

    Morris.Area({
      element     : 'chart_historical_maint',
      data        : data,
      xkey        : 'date',
      ykeys       : ['average_maintainability'],
      labels      : ['Maintainability'],
      ymax        : 100,
      parseTime   : false,
      lineColors  : ['#2A2A2A'],
      pointSize   : 0,
      lineWidth   : 0,
      grid        : false,
      axes        : false,
      hideHover   : 'always',
      fillOpacity : 1
    });
  }

  function drawCharts() {
    $('.js-chart').empty();
    drawHistoricalChart(__history);
  }

  drawCharts();

  $(window).on('resize', _.debounce(drawCharts,200));
});