<commit_before>var NetworkFees = function (options) {
  var self        = this;
  var apiHandler  = new ApiHandler(options.url);
  var request, basisRequest;

  if (options.id) self.div = d3.select('#'+options.id).attr('class','chartWrap');
  else            self.div = d3.select('body').append('div').attr('class','chartWrap');

  var list = self.div.append('div').attr('class','interval selectList');
  self.div.append('div').attr('class','lineChart').attr('id', options.id+'Chart');

  list.append('label').html('Interval:');
  var interval = list.selectAll('span')
  .data(['ledger','hour','day'])
  .enter().append('span')
    .classed('selected', function(d) { return d === 'hour'})
    .text(function(d) { return d })
    .on('click', function(d){
      d3.event.preventDefault();
      var that = this;
      interval.classed('selected', function() { return this === that; });
      selectInterval(d);
    });


//create new line chart
  var chart = new LineChart({
    id: options.id+'Chart',
    leftTitle: 'Total Fees (XRP)',
    rightTitle: 'Average Fee (XRP)',
    resize: true,
    minDomain: 0,
    tooltip: function (d, interval) {

      var html = '<div>'+ parseDate(d.x, interval) +'</div>';

      if (interval === 'ledger') {
        html += '<div><span>Ledger:</span>' + d.data.ledger_index + '</div>';
      }

      html +=  '<div><span>Average Fee:</span>' + d.y + ' <small>XRP</small></div>' +
        '<div><span>Total Fees:</span>' + d.y2 + ' <small>XRP</small></div>';
      return html;
    }});


  function selectInterval(d) {
    var start = moment.utc();
    var multiplier = d === 'ledger' ? 3.5 : 1;
    var interval = d === 'ledger' ? 'second' : d;

    start.subtract(multiplier * 900, interval);
    var url = options.url +
        '/network/fees?limit=1000&interval=' + d +
        '&start=' + start.format('YYYY-MM-DDTHH:mm:ss');
    chart.loading = true;
    chart.fadeOut();

    d3.json(url, function(err, resp) {
      var rows = resp.rows.filter(function(d) {
        return !!d.avg;
      });

      var lineData = rows.map(function(d) {
        return {
          x: moment.utc(d.date),
          y: d.avg,
          y2: d.total,
          data: d
        }
      });

      chart.loading = false;
      chart.redraw(d, lineData);
    });
  }

  function parseDate (date, interval) {
    if (interval === 'day') return date.format('MMMM D');
    else if (interval === 'hour') return date.format('MMMM D [&middot] hh:mm A');
    else return date.format('MMMM D [&middot] hh:mm:ss A');
  }

  self.div.select('.interval .selected')[0][0].click();
}<commit_msg>use local time<commit_after>var NetworkFees = function (options) {
  var self        = this;
  var apiHandler  = new ApiHandler(options.url);
  var request, basisRequest;

  if (options.id) self.div = d3.select('#'+options.id).attr('class','chartWrap');
  else            self.div = d3.select('body').append('div').attr('class','chartWrap');

  var list = self.div.append('div').attr('class','interval selectList');
  self.div.append('div').attr('class','lineChart').attr('id', options.id+'Chart');

  list.append('label').html('Interval:');
  var interval = list.selectAll('span')
  .data(['ledger','hour','day'])
  .enter().append('span')
    .classed('selected', function(d) { return d === 'hour'})
    .text(function(d) { return d })
    .on('click', function(d){
      d3.event.preventDefault();
      var that = this;
      interval.classed('selected', function() { return this === that; });
      selectInterval(d);
    });


//create new line chart
  var chart = new LineChart({
    id: options.id+'Chart',
    leftTitle: 'Total Fees (XRP)',
    rightTitle: 'Average Fee (XRP)',
    resize: true,
    minDomain: 0,
    tooltip: function (d, interval) {

      var html = '<div>'+ parseDate(d.x, interval) +'</div>';

      if (interval === 'ledger') {
        html += '<div><span>Ledger:</span>' + d.data.ledger_index + '</div>';
      }

      html +=  '<div><span>Average Fee:</span>' + d.y + ' <small>XRP</small></div>' +
        '<div><span>Total Fees:</span>' + d.y2 + ' <small>XRP</small></div>';
      return html;
    }});


  function selectInterval(d) {
    var start = moment.utc();
    var multiplier = d === 'ledger' ? 3.5 : 1;
    var interval = d === 'ledger' ? 'second' : d;

    start.subtract(multiplier * 900, interval);
    var url = options.url +
        '/network/fees?limit=1000&interval=' + d +
        '&start=' + start.format('YYYY-MM-DDTHH:mm:ss');
    chart.loading = true;
    chart.fadeOut();

    d3.json(url, function(err, resp) {
      var rows = resp.rows.filter(function(d) {
        return !!d.avg;
      });

      var lineData = rows.map(function(d) {
        return {
          x: moment(d.date),
          y: d.avg,
          y2: d.total,
          data: d
        }
      });

      chart.loading = false;
      chart.redraw(d, lineData);
    });
  }

  function parseDate (date, interval) {
    if (interval === 'day') return date.format('MMMM D');
    else if (interval === 'hour') return date.format('MMMM D [&middot] hh:mm A');
    else return date.format('MMMM D [&middot] hh:mm:ss A');
  }

  self.div.select('.interval .selected')[0][0].click();
}
{'fraction_non_alphanumeric': 0.2002303705125744, 'fraction_numerical': 0.007295066231522365, 'mean_word_length': 2.8308823529411766, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '6412607', 'n_tokens_mistral': 1794, 'n_tokens_neox': 1752, 'n_words': 374}