<commit_before>
var wid, hei;
var transitionDuration = 800;
var started = false;
var data = [];
var memberships = [];
var scales = {};
var totals = {};
var maxYear, minYear = 0;
var vis;
var padding = { top: 40, right: 30, bottom: 30, left: 240 }
var barHeight = 10; 
var defaultPopPercent = .08;
var boxHeight = 35;
var totalmemberships = 0 ;
var waitStart = false;
var controls = {
  display: "aligned",
  height: "fixed"
}





function setVisSize() {

  wid = $(window).width() - 2;
  hei = ($(window).height()/1.5) - 100;

  $(".vis").attr("width", wid).attr("height", hei);
  $(".vis .background").attr("width", wid).attr("height", hei);
    
}

$(window).resize(reloadTimeline);

function reloadTimeline(callback){
  started = true;
  setBasicsParams();
  setVisSize();
  // process data for scales, etc.
  processData();
  drawstarting();
  addInteractionEvents();


  var defaultFilterCallback = function() {
      setControl($("#controls #layoutControls #layout-timeline"), "display", "timeline", false);
      setControl($("#controls #heightControls #height-area"), "height", "contiguous", true);
      setControl($("#controls #groupControls #group-name"), "group", "name", true);
  };  
  if (!callback){
    callback = defaultFilterCallback;
  }
    

  setTimeout(callback, 500);
  

}


function setBasicsParams(){
  
  //remove old svg
  //TODO: is it another way of doing this?
  d3.select("div.vis svg").remove();

  vis = d3.select("div.vis")
    .append("svg:svg")
    .attr("class", "vis");
  
  totals.area = d3.sum(data, function(d) { return d3.sum(d.memberships, function(p){ return p.Land_area_million_km2; }) });
  totals.population = d3.sum(data, function(d) { return d3.sum(d.memberships, function(p){ return p.Estimated_Population; }) });
  
  totals.popPercent = d3.sum(data, function(d) { 
    if (isNaN(d.Percent_World_Population)) return defaultPopPercent;
    else return d.Percent_World_Population; 
    });
  //Append Fonts! 
  vis
    .append('def')
    .append('style')
    .attr("type", "text/css")
    .text('@import url(http://fonts.googleapis.com/css?family=RobotoDraft:400,500,700,400italic);')

    
    
}




/************************************************************
 * Process the data once it's imported
 ***********************************************************/

function processData() {

    
    maxYear = d3.max(data, function(d) {  return d3.max(d.memberships, function(inner) {  return inner.end    }) });
    minYear = d3.min(data, function(d) {  return d3.min(d.memberships, function(inner) {  return inner.start; }) });
    scales.years = d3.scale.linear()
      .domain([ minYear,maxYear])
      .range([ padding.left, wid - padding.right ]);
    


    totalmemberships = d3.sum(data, function(d){return d.memberships.length});



    if (controls.height == "memberships")
    {
        hei = (totalmemberships* boxHeight) + 100;
    }
    else{
        
        hei = (data.length * boxHeight)+100;
    }


    barHeight = (hei - padding.top - padding.bottom) / data.length;

    scales.indexes = d3.scale.linear()
      .domain([ 0,  totalmemberships- 1 ])
      .range([ padding.top, hei - padding.bottom - barHeight ]);


    scales.colorsScale = d3.scale.category20c();

<commit_msg>colores en tipos no es randome<commit_after>
var wid, hei;
var transitionDuration = 800;
var started = false;
var data = [];
var memberships = [];
var scales = {};
var totals = {};
var maxYear, minYear = 0;
var vis;
var padding = { top: 40, right: 30, bottom: 30, left: 240 }
var barHeight = 10; 
var defaultPopPercent = .08;
var boxHeight = 35;
var totalmemberships = 0 ;
var waitStart = false;
var controls = {
  display: "aligned",
  height: "fixed"
}





function setVisSize() {

  wid = $(window).width() - 2;
  hei = ($(window).height()/1.5) - 100;

  $(".vis").attr("width", wid).attr("height", hei);
  $(".vis .background").attr("width", wid).attr("height", hei);
    
}

$(window).resize(reloadTimeline);

function reloadTimeline(callback){
  started = true;
  setBasicsParams();
  setVisSize();
  // process data for scales, etc.
  processData();
  drawstarting();
  addInteractionEvents();


  var defaultFilterCallback = function() {
      setControl($("#controls #layoutControls #layout-timeline"), "display", "timeline", false);
      setControl($("#controls #heightControls #height-area"), "height", "contiguous", true);
      setControl($("#controls #groupControls #group-name"), "group", "name", true);
  };  
  if (!callback){
    callback = defaultFilterCallback;
  }
    

  setTimeout(callback, 500);
  

}


function setBasicsParams(){
  
  //remove old svg
  //TODO: is it another way of doing this?
  d3.select("div.vis svg").remove();

  vis = d3.select("div.vis")
    .append("svg:svg")
    .attr("class", "vis");
  
  totals.area = d3.sum(data, function(d) { return d3.sum(d.memberships, function(p){ return p.Land_area_million_km2; }) });
  totals.population = d3.sum(data, function(d) { return d3.sum(d.memberships, function(p){ return p.Estimated_Population; }) });
  
  totals.popPercent = d3.sum(data, function(d) { 
    if (isNaN(d.Percent_World_Population)) return defaultPopPercent;
    else return d.Percent_World_Population; 
    });
  //Append Fonts! 
  vis
    .append('def')
    .append('style')
    .attr("type", "text/css")
    .text('@import url(http://fonts.googleapis.com/css?family=RobotoDraft:400,500,700,400italic);')

    
    
}




/************************************************************
 * Process the data once it's imported
 ***********************************************************/

function processData() {

    
    maxYear = d3.max(data, function(d) {  return d3.max(d.memberships, function(inner) {  return inner.end    }) });
    minYear = d3.min(data, function(d) {  return d3.min(d.memberships, function(inner) {  return inner.start; }) });
    scales.years = d3.scale.linear()
      .domain([ minYear,maxYear])
      .range([ padding.left, wid - padding.right ]);
    


    totalmemberships = d3.sum(data, function(d){return d.memberships.length});



    if (controls.height == "memberships")
    {
        hei = (totalmemberships* boxHeight) + 100;
    }
    else{
        
        hei = (data.length * boxHeight)+100;
    }


    barHeight = (hei - padding.top - padding.bottom) / data.length;

    scales.indexes = d3.scale.linear()
      .domain([ 0,  totalmemberships- 1 ])
      .range([ padding.top, hei - padding.bottom - barHeight ]);


    scales.colorsScale = d3.scale.category20();


{'fraction_non_alphanumeric': 0.19773145309625997, 'fraction_numerical': 0.020539546290619253, 'mean_word_length': 3.518698060941828, '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': '5877513', 'n_tokens_mistral': 2296, 'n_tokens_neox': 2096, 'n_words': 469}