<commit_before>/*
* desc : make table sortable
*/
function sortDwnTable() {
  if(window.jQuery && $("#resDwnSum").length > 0) {
    $("#resDwnSum").tablesorter();
  }
}

/*
* desc : plot trend chart
*/
var downloadTrendChartData = [];
var downloadTrendChartLayout= {
        title: "",
        margin: { l: 100, r: 20, b: 30, t: 20, pad: 4 },
        showlegend: false,
        xaxis: { showgrid: false, zeroline: false, autotick: false },
        yaxis: { showline: false }
};
function plotTrendChart() {
  if(window.jQuery && $("#downloadTrendChart").length > 0) {
    Plotly.d3.json('download_date/peroid', function(rawData){
      downloadTrendChartData = [{
        type: 'bar',
        x: [rawData["data"]["0-30"], rawData["data"]["31-90"], rawData["data"]["90-"]],
        y: ['< 31 days', '31-90 days', '> 90 days'],
        orientation: 'h',
        marker: {
          color: 'rgba(55,128,191,1)',
          width: 1
        }
      }];
      Plotly.newPlot('downloadTrendChart', downloadTrendChartData, downloadTrendChartLayout);
    });
  }
}

/*
* desc : auto resize charts (RWD)
*/
function rendering() {
  if(window.jQuery && $("#downloadTrendChartContainer").length > 0 && $("#downloadTrendChart").length > 0) {
    Plotly.d3.select('#downloadTrendChart svg').html('');
    // set layout options
    downloadTrendChartLayout["height"] = parseInt(Plotly.d3.select("#downloadTrendChartContainer").style("height"), 10);
    downloadTrendChartLayout["width"] = parseInt(Plotly.d3.select("#downloadTrendChartContainer").style("width"), 10);
    downloadTrendChartLayout["autosize"] = false;

    // try to plot a new one image
    Plotly.newPlot('downloadTrendChart', downloadTrendChartData, downloadTrendChartLayout);
  }
}

/*
* desc : jquery
*/
$(document).ready(function() {
  sortDwnTable();
  plotTrendChart();
  
  // listen to the resize event
  Plotly.d3.select(window).on('resize', rendering);
});







<commit_msg>debug multiple resize event in general.js<commit_after>/*
* desc : make table sortable
*/
function sortDwnTable() {
  if(window.jQuery && $("#resDwnSum").length > 0) {
    $("#resDwnSum").tablesorter();
  }
}

/*
* desc : plot trend chart
*/
var downloadTrendChartData = [];
var downloadTrendChartLayout= {
        title: "",
        margin: { l: 100, r: 20, b: 30, t: 20, pad: 4 },
        showlegend: false,
        xaxis: { showgrid: false, zeroline: false, autotick: false },
        yaxis: { showline: false }
};
function plotDwnTrendChart() {
  if(window.jQuery && $("#downloadTrendChart").length > 0) {
    Plotly.d3.json('download_date/peroid', function(rawData){
      downloadTrendChartData = [{
        type: 'bar',
        x: [rawData["data"]["0-30"], rawData["data"]["31-90"], rawData["data"]["90-"]],
        y: ['< 31 days', '31-90 days', '> 90 days'],
        orientation: 'h',
        marker: {
          color: 'rgba(55,128,191,1)',
          width: 1
        }
      }];
      Plotly.newPlot('downloadTrendChart', downloadTrendChartData, downloadTrendChartLayout);
    });
  }
}

/*
* desc : auto resize charts (RWD)
*/
function renderingDwnChart() {
  if(window.jQuery && $("#downloadTrendChartContainer").length > 0 && $("#downloadTrendChart").length > 0) {
    Plotly.d3.select('#downloadTrendChart svg').html('');
    // set layout options
    downloadTrendChartLayout["height"] = parseInt(Plotly.d3.select("#downloadTrendChartContainer").style("height"), 10);
    downloadTrendChartLayout["width"] = parseInt(Plotly.d3.select("#downloadTrendChartContainer").style("width"), 10);
    downloadTrendChartLayout["autosize"] = false;

    // try to plot a new one image
    Plotly.newPlot('downloadTrendChart', downloadTrendChartData, downloadTrendChartLayout);
  }
}

/*
* desc : jquery
*/
$(document).ready(function() {
  sortDwnTable();
  plotDwnTrendChart();
  
  // listen to the resize event
  Plotly.d3.select(window).on('resize.dwnChart', renderingDwnChart);
});








{'fraction_non_alphanumeric': 0.1758576874205845, 'fraction_numerical': 0.025412960609911054, 'mean_word_length': 3.566125290023202, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4735006', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1274, 'n_words': 247}