<commit_before>var RadarChart = {
  defaultConfig: {
    containerClass: 'radar-chart',
    w: 600,
    h: 600,
    factor: 0.95,
    factorLegend: 1,
    levels: 3,
    levelTick: false,
    TickLength: 10,
    maxValue: 0,
    minValue: 0,
    radians: 2 * Math.PI,
    color: d3.scale.category10(),
    axisLine: true,
    axisText: true,
    circles: true,
    radius: 10,
    backgroundTooltipColor: "#555",
    backgroundTooltipOpacity: "0.7",
    tooltipColor: "white",
    axisJoin: function(d, i) {
      return d.className || i;
    },
    tooltipFormatValue: function(d) {
      return d;
    },
    tooltipFormatClass: function(d) {
      return d;
    },
    transitionDuration: 300
  },
  chart: function() {
    // default config
    var cfg = Object.create(RadarChart.defaultConfig);
    function setTooltip(tooltip, msg){
      if(msg == false || msg == undefined){
        tooltip.classed("visible", 0);
        tooltip.select("rect").classed("visible", 0);
      }else{
        tooltip.classed("visible", 1);

        var container = tooltip.node().parentNode;
        var coords = d3.mouse(container);

        tooltip.select("text").classed('visible', 1).style("fill", cfg.tooltipColor);
        var padding=5;
        var bbox = tooltip.select("text").text(msg).node().getBBox();

        tooltip.select("rect")
        .classed('visible', 1).attr("x", 0)
        .attr("x", bbox.x - padding)
        .attr("y", bbox.y - padding)
        .attr("width", bbox.width + (padding*2))
        .attr("height", bbox.height + (padding*2))
        .attr("rx","5").attr("ry","5")
        .style("fill", cfg.backgroundTooltipColor).style("opacity", cfg.backgroundTooltipOpacity);
        tooltip.attr("transform", "translate(" + (coords[0]+10) + "," + (coords[1]-10) + ")")
      }
    }
    function dragAlt(d){
      console.log(d3.event);
      console.log("[ " + d3.event.dx + "," + d3.event.dy + "]");
      d3.select(this)
        .attr('cx', d[0].x = d[0].x + d3.event.dx)
        .attr('cy', d[0].y = d[0].y + d3.event.dy);
    }
    var drag = d3.behavior
                 .drag()
                 .origin(function(d) { return d; })
                 .on("drag", dragAlt);
    function dragNode(elem){
      var target =  d3.select(elem);
      var tar_obj = target[0][0][0];
      var old_pos = {x: tar_obj.x, y: tar_obj.y};
      var new_pos = {x: 0, y: 0};
      var new_val = 0;

      console.log("old: " + JSON.stringify(tar_obj));
      if(old_pos.x === 0) {
        new_pos.x =  old_pos.x - d3.event.y;
        new_val = (new_pos.y / old_pos.y ) * tar_obj.value;
      } else {

        var slope = old_pos.y / old_pos.x;
        new_pos.x = d3.event.x + old_pos.x - 300;
        new_pos.y = new_pos.x * slope;
        var ratio = new_pos.x / old_pos.x;
        new_val = ratio * tar_obj.value;
      }

      tar_obj.x = new_pos.x + 300;
      tar_obj.y = 300 - new_pos.y;
      tar_obj.value = new_val;

      target.x = tar_obj.x;
      target.y = tar_obj.y;
      target.value = tar_obj.value;

      //d3.select(elem[0]).attr("x", tar_obj.x).attr("y", tar_obj.y);

    }
    function radar(selection) {
      selection.each(function(data) {
        var container = d3.select(this);
        var tooltip = container.selectAll('g.tooltip').data([data[0]]);

        var tt = tooltip.enter()
          .append('g')
          .classed('tooltip', true)

        tt.append('rect').classed("tooltip", true);
        tt.append('text').classed("tooltip", true);

        // allow simple notation
        data = data.map(function(datum) {
          if(datum instanceof Array) {
            datum = {axes: datum};<commit_msg>removed console logs<commit_after>var RadarChart = {
  defaultConfig: {
    containerClass: 'radar-chart',
    w: 600,
    h: 600,
    factor: 0.95,
    factorLegend: 1,
    levels: 3,
    levelTick: false,
    TickLength: 10,
    maxValue: 0,
    minValue: 0,
    radians: 2 * Math.PI,
    color: d3.scale.category10(),
    axisLine: true,
    axisText: true,
    circles: true,
    radius: 10,
    backgroundTooltipColor: "#555",
    backgroundTooltipOpacity: "0.7",
    tooltipColor: "white",
    axisJoin: function(d, i) {
      return d.className || i;
    },
    tooltipFormatValue: function(d) {
      return d;
    },
    tooltipFormatClass: function(d) {
      return d;
    },
    transitionDuration: 300
  },
  chart: function() {
    // default config
    var cfg = Object.create(RadarChart.defaultConfig);
    function setTooltip(tooltip, msg){
      if(msg == false || msg == undefined){
        tooltip.classed("visible", 0);
        tooltip.select("rect").classed("visible", 0);
      }else{
        tooltip.classed("visible", 1);

        var container = tooltip.node().parentNode;
        var coords = d3.mouse(container);

        tooltip.select("text").classed('visible', 1).style("fill", cfg.tooltipColor);
        var padding=5;
        var bbox = tooltip.select("text").text(msg).node().getBBox();

        tooltip.select("rect")
        .classed('visible', 1).attr("x", 0)
        .attr("x", bbox.x - padding)
        .attr("y", bbox.y - padding)
        .attr("width", bbox.width + (padding*2))
        .attr("height", bbox.height + (padding*2))
        .attr("rx","5").attr("ry","5")
        .style("fill", cfg.backgroundTooltipColor).style("opacity", cfg.backgroundTooltipOpacity);
        tooltip.attr("transform", "translate(" + (coords[0]+10) + "," + (coords[1]-10) + ")")
      }
    }
    function dragAlt(d){
      d3.select(this)
        .attr('cx', d[0].x = d[0].x + d3.event.dx)
        .attr('cy', d[0].y = d[0].y + d3.event.dy);
    }
    var drag = d3.behavior
                 .drag()
                 .origin(function(d) { return d; })
                 .on("drag", dragAlt);
    function dragNode(elem){
      var target =  d3.select(elem);
      var tar_obj = target[0][0][0];
      var old_pos = {x: tar_obj.x, y: tar_obj.y};
      var new_pos = {x: 0, y: 0};
      var new_val = 0;

      if(old_pos.x === 0) {
        new_pos.x =  old_pos.x - d3.event.y;
        new_val = (new_pos.y / old_pos.y ) * tar_obj.value;
      } else {

        var slope = old_pos.y / old_pos.x;
        new_pos.x = d3.event.x + old_pos.x - 300;
        new_pos.y = new_pos.x * slope;
        var ratio = new_pos.x / old_pos.x;
        new_val = ratio * tar_obj.value;
      }

      tar_obj.x = new_pos.x + 300;
      tar_obj.y = 300 - new_pos.y;
      tar_obj.value = new_val;

      target.x = tar_obj.x;
      target.y = tar_obj.y;
      target.value = tar_obj.value;
    }
    function radar(selection) {
      selection.each(function(data) {
        var container = d3.select(this);
        var tooltip = container.selectAll('g.tooltip').data([data[0]]);

        var tt = tooltip.enter()
          .append('g')
          .classed('tooltip', true)

        tt.append('rect').classed("tooltip", true);
        tt.append('text').classed("tooltip", true);

        // allow simple notation
        data = data.map(function(datum) {
          if(datum instanceof Array) {
            datum = {axes: datum};
{'fraction_non_alphanumeric': 0.1680565371024735, 'fraction_numerical': 0.022190812720848056, 'mean_word_length': 2.168831168831169, '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': '2135078', 'n_tokens_mistral': 2553, 'n_tokens_neox': 2432, 'n_words': 474}