<commit_before>/* global google Gabra $ */
// $(document).ready(function () {
  google.load('visualization', '1.0', {'packages': ['corechart']})
  google.setOnLoadCallback(function () {
    $.ajax({
      method: 'GET',
      url: Gabra.api_url + 'logs/chart',
      success: function (data) {
        var table = new google.visualization.DataTable()
        table.addColumn('date', 'Date')

        // Just totals
        table.addColumn('number', Gabra.i18n.updates)
        for (var day in data) {
          table.addRow([new Date(day), data[day]['total']])
        }

        var options = {
          legend: {
            position: 'none'
          },
          hAxis: {
            textPosition: 'none',
            gridlines: {
              count: 0
            }
          },
          vAxis: {
            textPosition: 'none',
            gridlines: {
              count: 4,
              color: '#eeeeee'
            }
          },
          height: 100,
          chartArea: {
            width: '100%',
            height: '90%'
          }
        }
        var chart = new google.visualization.AreaChart(document.getElementById('log-chart'))
        chart.draw(table, options)<commit_msg>Hide log chart when empty<commit_after>/* global google Gabra $ */
// $(document).ready(function () {
  google.load('visualization', '1.0', {'packages': ['corechart']})
  google.setOnLoadCallback(function () {
    $.ajax({
      method: 'GET',
      url: Gabra.api_url + 'logs/chart',
      success: function (data) {
        var table = new google.visualization.DataTable()
        table.addColumn('date', 'Date')

        // Just totals
        var empty = true
        table.addColumn('number', Gabra.i18n.updates)
        for (var day in data) {
          if (data[day]['total'] > 0) empty = false
          table.addRow([new Date(day), data[day]['total']])
        }
        if (empty) return

        var options = {
          legend: {
            position: 'none'
          },
          hAxis: {
            textPosition: 'none',
            gridlines: {
              count: 0
            }
          },
          vAxis: {
            textPosition: 'none',
            gridlines: {
              count: 4,
              color: '#eeeeee'
            }
          },
          height: 100,
          chartArea: {
            width: '100%',
            height: '90%'
          }
        }
        var chart = new google.visualization.AreaChart(document.getElementById('log-chart'))
        chart.draw(table, options)
{'fraction_non_alphanumeric': 0.13969133359715077, 'fraction_numerical': 0.01147605856747131, 'mean_word_length': 1.5154228855721392, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5688716', 'n_tokens_mistral': 739, 'n_tokens_neox': 706, 'n_words': 152}