<commit_before>class app.ChartHelpers
  @graph_colors = [
    '#1c1e45'
    '#004678'
    '#3783b9'
    '#0aa6c2'
    '#09b8a3'
  ]

  @chart_colors = [
    '#09b8a3'
    '#0aa6c2'
    '#3783b9'
    '#004678'
    '#1c1e45'
  ]

  @graph_colors_highlight = '#09b8a3'
  @graph_line_color = ['#3783b9']

  # GRAPH COLOUR SELECT
  @graph_colour_multiple: (total) =>
    multiple = Math.floor(@graph_colors.length / total)

  @graph_colour_loop: (index) =>
    total = @graph_colors.length
    color = index % total

  @bar_color_loop: (index) =>
    total = @graph_colors.length - 1
    color = total - Math.abs((index % (total * 2)) - total)

  @resizeCharts: =>
    clearTimeout(@resizeTimer) if @resizeTimer?
    @resizeTimer = setTimeout ( ->
      for chart in Highcharts.charts
        if chart?
          chart_el = $(chart.container)
          chart_container = chart_el.closest(".js-highcharts").parent()
          chart_el.hide()
          chart.setSize(chart_container.width(), chart.containerHeight, false)
          chart_el.show()
    ), 500

  # resize charts on window resized
  $(window).resize =>
    @resizeCharts()
<commit_msg>Only resize the chart if it can determine the new container dimensions<commit_after>class app.ChartHelpers
  @graph_colors = [
    '#1c1e45'
    '#004678'
    '#3783b9'
    '#0aa6c2'
    '#09b8a3'
  ]

  @chart_colors = [
    '#09b8a3'
    '#0aa6c2'
    '#3783b9'
    '#004678'
    '#1c1e45'
  ]

  @graph_colors_highlight = '#09b8a3'
  @graph_line_color = ['#3783b9']

  # GRAPH COLOUR SELECT
  @graph_colour_multiple: (total) =>
    multiple = Math.floor(@graph_colors.length / total)

  @graph_colour_loop: (index) =>
    total = @graph_colors.length
    color = index % total

  @bar_color_loop: (index) =>
    total = @graph_colors.length - 1
    color = total - Math.abs((index % (total * 2)) - total)

  @resizeCharts: =>
    clearTimeout(@resizeTimer) if @resizeTimer?
    @resizeTimer = setTimeout ( ->
      for chart in Highcharts.charts
        if chart?
          chart_el = $(chart.container)
          chart_container = chart_el.closest(".js-highcharts").parent()
          if chart_container.width() && chart.containerHeight
            chart_el.hide()
            chart.setSize(chart_container.width(), chart.containerHeight, false)
            chart_el.show()
    ), 500

  # resize charts on window resized
  $(window).resize =>
    @resizeCharts()

{'fraction_non_alphanumeric': 0.13521360431356283, 'fraction_numerical': 0.04811281625881377, 'mean_word_length': 2.780564263322884, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3107052', 'n_tokens_mistral': 909, 'n_tokens_neox': 849, 'n_words': 160}