<commit_before>angular.module('disneylandCharts', [
  'ui.router',
  'nvd3'
])

.controller('dummy', function($scope, $http) {

  $scope.xFunction = function(){
    return function(d){
      return d[0];
    };
  };

  $scope.yFunction = function(){
    return function(d){
      return d[1];
    };
  };

  $scope.sparklineOptions = {
    chart: {
        type: 'sparklinePlus',
        height: 120,
        width: 500,
        x: function(d, i){
          return d.x;
        },
        y: function(d) {
          return d.y;
        },
        xTickFormat: function(d) {
            return d3.time.format('%I: %M %p')(d);
        },
        yTickFormat: function(d) {
            return d3.format()(d);
        },
        color: function() {
          return '#afafaf';
        },
        noData: 'No Data'
    }
  };


  $scope.chartOptions = {
    chart: {
      type: 'lineChart',
      height: 450,
      margin : {
          top: 20,
          right: 20,
          bottom: 40,
          left: 55
      },
      x: function(d){
        return d.x;
      },
      y: function(d){
        return d.y;
      },
      useInteractiveGuideline: true,
      dispatch: {
          stateChange: function(e){ console.log("stateChange"); },
          changeState: function(e){ console.log("changeState"); },
          tooltipShow: function(e){ console.log("tooltipShow"); },
          tooltipHide: function(e){ console.log("tooltipHide"); }
      },
      xAxis: {
          axisLabel: 'Time of Day',
          tickFormat: function(d) { return d3.time.format('%I:%M %p')(new Date(d)); }
      },
      yAxis: {
          axisLabel: 'Wait Times (Minutes)',
          tickFormat: function(d){
              return d3.format()(d);
          },
          axisLabelDistance: -10
      },
      stroke: true
    }
  };

  $http.get('/api/v1/rides').then(function(response) {
    $scope.rides = _.map(response.data, function(ride) {
      ride.data = _.map(ride.waitTime, function(waitTime) {
        return {
          x: new Date(waitTime.date),
          y: waitTime.minutes
        };
      });
      return ride;
    });
  });

  $http.get('/api/v1/rides/353355').then(function(response) {
    $scope.chartData = _.map(response.data, function(day) {
      return {
        key: moment().dayOfYear(day._id).format('ddd'),
        values: _.map(day.waitTimes, function(waitTime) {
          return {
            x: moment(waitTime.date).dayOfYear(1).toDate(),
            y: waitTime.minutes ? waitTime.minutes : null
          }
        })
      };
    });
  });
});<commit_msg>filter per ride chart to show only data from the same day of week<commit_after>angular.module('disneylandCharts', [
  'ui.router',
  'nvd3'
])

.controller('dummy', function($scope, $http) {

  $scope.xFunction = function(){
    return function(d){
      return d[0];
    };
  };

  $scope.yFunction = function(){
    return function(d){
      return d[1];
    };
  };

  $scope.sparklineOptions = {
    chart: {
        type: 'sparklinePlus',
        height: 120,
        width: 500,
        x: function(d, i){
          return d.x;
        },
        y: function(d) {
          return d.y;
        },
        xTickFormat: function(d) {
            return d3.time.format('%I: %M %p')(d);
        },
        yTickFormat: function(d) {
            return d3.format()(d);
        },
        color: function() {
          return '#afafaf';
        },
        noData: 'No Data'
    }
  };


  $scope.chartOptions = {
    chart: {
      type: 'lineChart',
      height: 450,
      margin : {
          top: 20,
          right: 20,
          bottom: 40,
          left: 55
      },
      x: function(d){
        return d.x;
      },
      y: function(d){
        return d.y;
      },
      useInteractiveGuideline: true,
      dispatch: {
          stateChange: function(e){ console.log("stateChange"); },
          changeState: function(e){ console.log("changeState"); },
          tooltipShow: function(e){ console.log("tooltipShow"); },
          tooltipHide: function(e){ console.log("tooltipHide"); }
      },
      xAxis: {
          axisLabel: 'Time of Day',
          tickFormat: function(d) { return d3.time.format('%I:%M %p')(new Date(d)); }
      },
      yAxis: {
          axisLabel: 'Wait Times (Minutes)',
          tickFormat: function(d){
              return d3.format()(d);
          },
          axisLabelDistance: -10
      },
      stroke: true
    }
  };

  $http.get('/api/v1/rides').then(function(response) {
    $scope.rides = _.map(response.data, function(ride) {
      ride.data = _.map(ride.waitTime, function(waitTime) {
        return {
          x: new Date(waitTime.date),
          y: waitTime.minutes
        };
      });
      return ride;
    });
  });

  $http.get('/api/v1/rides/353355').then(function(response) {
    //filter function should be done on the api side
    $scope.chartData = _.chain(response.data).reject(function(day) {
        if(moment().day() === moment().dayOfYear(day._id).day()) {
          return false;
        }
        return true;
    }).map(function(day) {
      return {
        key: moment().dayOfYear(day._id).format('ddd, MMM D'),
        values: _.map(day.waitTimes, function(waitTime) {
          return {
            x: moment(waitTime.date).dayOfYear(1).toDate(),
            y: waitTime.minutes ? waitTime.minutes : null
          }
        })
      };
    }).value();
  });
});
{'fraction_non_alphanumeric': 0.16088560885608857, 'fraction_numerical': 0.012915129151291513, 'mean_word_length': 1.7828542094455853, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '63150', 'n_tokens_mistral': 1781, 'n_tokens_neox': 1716, 'n_words': 323}