<commit_before>/**
 * Copyright 2014 Flipkart Internet Pvt. Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

function RadarTile() {
  this.newDiv = "";
  this.object = "";
}

function getRadarChartFormValues() {
  var nesting = $(".radar-nesting").val();

  if(nesting == "none") {
    return [[], false];
  }

  var status = true;

  if(!$("#radar-nesting").valid()) {
    status = false;
  }

  var nestingArray = [];
  nestingArray.push(currentFieldList[parseInt(nesting)].field);
  return [{
    "nesting": nestingArray,
  }, status];
}

function setRadarChartFormValues(object) {
  $(".radar-nesting").val(currentFieldList.findIndex(x => x.field == object.nesting[0]));
  $(".radar-nesting").selectpicker('refresh');
}

function clearRadarChartForm() {
  var parentElement = $("#"+currentChartType+"-chart-data");
}

RadarTile.prototype.getQuery = function(newDiv, object) {
  this.newDiv = newDiv;
  this.object = object;
  var data = {
    "opcode": "group",
    "table": object.table,
    "filters": object.filters,
    "nesting": object.nesting
  }
  $.ajax({
    method: "post",
    dataType: 'json',
    accepts: {
        json: 'application/json'
    },
    url: apiUrl+"/v1/analytics",
    contentType: "application/json",
    data: JSON.stringify(data),
    success: $.proxy(this.getData, this)
  });
}

RadarTile.prototype.getData = function(data) {
  if(data.result == undefined || data.result.length == 0)
    return;
  var chartData = [];
  var object = {}<commit_msg>added time filter<commit_after>/**
 * Copyright 2014 Flipkart Internet Pvt. Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

function RadarTile() {
  this.newDiv = "";
  this.object = "";
}

function getRadarChartFormValues() {
  var nesting = $(".radar-nesting").val();

  if(nesting == "none") {
    return [[], false];
  }

  var status = true;

  if(!$("#radar-nesting").valid()) {
    status = false;
  }

  var nestingArray = [];
  nestingArray.push(currentFieldList[parseInt(nesting)].field);
  return [{
    "nesting": nestingArray,
  }, status];
}

function setRadarChartFormValues(object) {
  $(".radar-nesting").val(currentFieldList.findIndex(x => x.field == object.nesting[0]));
  $(".radar-nesting").selectpicker('refresh');
}

function clearRadarChartForm() {
  var parentElement = $("#"+currentChartType+"-chart-data");
}

RadarTile.prototype.getQuery = function(newDiv, object) {
  this.newDiv = newDiv;
  this.object = object;
  var ts = new Date().getTime();
  object.filters.push( {field: "_timestamp", operator: "last", duration: "24hours", currentTime: ts})
  var data = {
    "opcode": "group",
    "table": object.table,
    "filters": object.filters,
    "nesting": object.nesting
  }
  $.ajax({
    method: "post",
    dataType: 'json',
    accepts: {
        json: 'application/json'
    },
    url: apiUrl+"/v1/analytics",
    contentType: "application/json",
    data: JSON.stringify(data),
    success: $.proxy(this.getData, this)
  });
}

RadarTile.prototype.getData = function(data) {
  if(data.result == undefined || data.result.length == 0)
    return;
  var chartData = [];
  var object = {}
{'fraction_non_alphanumeric': 0.15068823955566288, 'fraction_numerical': 0.005795701521371649, 'mean_word_length': 3.706818181818182, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '830119', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1285, 'n_words': 349}