<commit_before>/*jslint browser: true, indent: 2 */
/*global google*/

(function() {
  'use strict';

  var defaultOptions = {
    xAxis: {},
    yAxis: {
      title: {
        text: null
      }
    },
    title: {
      text: null
    },
    credits: {
      enabled: false
    },
    legend: {
      borderWidth: 0
    }
  };

  // http://stackoverflow.com/questions/728360/most-elegant-way-to-clone-a-javascript-object
  var clone = function(obj) {
    // Handle the 3 simple types, and null or undefined
    if (null == obj || "object" != typeof obj) return obj;

    // Handle Date
    if (obj instanceof Date) {
        var copy = new Date();
        copy.setTime(obj.getTime());
        return copy;
    }

    // Handle Array
    if (obj instanceof Array) {
        var copy = [];
        for (var i = 0, len = obj.length; i < len; i++) {
            copy[i] = clone(obj[i]);
        }
        return copy;
    }

    // Handle Object
    if (obj instanceof Object) {
        var copy = {};
        for (var attr in obj) {
            if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
        }
        return copy;
    }

    throw new Error("Unable to copy obj! Its type isn't supported.");
  }

  var jsOptions = function(opts) {
    var options = clone(defaultOptions);
    if ("min" in opts) {
      options.yAxis.min = opts.min;
    }
    if ("max" in opts) {
      options.yAxis.max = opts.max;
    }
    return options;
  }

  var Chartkick = {
    LineChart: function(elementId, series, opts) {
      var options = jsOptions(opts), data, i, j;
      options.xAxis.type = "datetime";
      options.chart = {type: "spline"};

      for (i = 0; i < series.length; i += 1) {
        data = series[i].data;
        for (j = 0; j < data.length; j += 1) {
          data[j][0] = data[j][0] * 1000;
        }
      }
      options.series = series;

      if (series.length == 1) {
        options.legend = {enabled: false};
      }
      $(document.getElementById(elementId)).highcharts(options);
    },
    PieChart: function(elementId, series, opts) {
      var options = jsOptions(opts);
      options.series = [{
        type: "pie",
        name: "Value",
        data: series
      }];
      $(document.getElementById(elementId)).highcharts(options);
    },
    ColumnChart: function(elementId, series, opts) {
      var options = jsOptions(opts), data, i, j;
      options.chart = {type: "column"};

      var i, j, s, d, rows = [];<commit_msg>Better styles<commit_after>/*jslint browser: true, indent: 2 */
/*global google*/

(function() {
  'use strict';

  var defaultOptions = {
    xAxis: {
      labels: {
        style: {
          fontSize: "12px"
        }
      }
    },
    yAxis: {
      title: {
        text: null
      },
      labels: {
        style: {
          fontSize: "12px"
        }
      }
    },
    title: {
      text: null
    },
    credits: {
      enabled: false
    },
    legend: {
      borderWidth: 0
    },
    tooltip: {
      style: {
        fontSize: "12px"
      }
    }
  };

  // http://stackoverflow.com/questions/728360/most-elegant-way-to-clone-a-javascript-object
  var clone = function(obj) {
    // Handle the 3 simple types, and null or undefined
    if (null == obj || "object" != typeof obj) return obj;

    // Handle Date
    if (obj instanceof Date) {
        var copy = new Date();
        copy.setTime(obj.getTime());
        return copy;
    }

    // Handle Array
    if (obj instanceof Array) {
        var copy = [];
        for (var i = 0, len = obj.length; i < len; i++) {
            copy[i] = clone(obj[i]);
        }
        return copy;
    }

    // Handle Object
    if (obj instanceof Object) {
        var copy = {};
        for (var attr in obj) {
            if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
        }
        return copy;
    }

    throw new Error("Unable to copy obj! Its type isn't supported.");
  }

  var jsOptions = function(opts) {
    var options = clone(defaultOptions);
    if ("min" in opts) {
      options.yAxis.min = opts.min;
    }
    if ("max" in opts) {
      options.yAxis.max = opts.max;
    }
    return options;
  }

  var Chartkick = {
    LineChart: function(elementId, series, opts) {
      var options = jsOptions(opts), data, i, j;
      options.xAxis.type = "datetime";
      options.chart = {type: "spline"};

      for (i = 0; i < series.length; i += 1) {
        data = series[i].data;
        for (j = 0; j < data.length; j += 1) {
          data[j][0] = data[j][0] * 1000;
        }
        series[i].marker = {symbol: "circle"};
      }
      options.series = series;

      if (series.length == 1) {
        options.legend = {enabled: false};
      }
      $(document.getElementById(elementId)).highcharts(options);
    },
    PieChart: function(elementId, series, opts) {
      var options = jsOptions(opts);
      options.series = [{
        type: "pie",
        name: "Value",
        data: series
      }];
      $(document.getElementById(elementId)).highcharts(options);
    },
    ColumnChart: function(elementId, series, opts) {
      var options = jsOptions(opts), data, i, j;
      options.chart = {type: "column"};

      var i, j, s, d, rows = [];
{'fraction_non_alphanumeric': 0.1475598086124402, 'fraction_numerical': 0.009186602870813397, 'mean_word_length': 1.8714285714285714, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6193455', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1651, 'n_words': 434}