<commit_before><% content_for(:page_title) {t '.page_title'} %>
<% content_for(:title) {t '.page_heading'} %>
<% content_for(:admin_menu) {navbar_link_to(t('buttons.add'), new_language_path, {class: :edit, title: t('buttons.add')})} %>

<canvas id="myCanvas" width="600" height="650">
  <div class="row">
    <%= render @languages %>
  </div>
</canvas>

<script>
  window.onload = function ()
  {
    var data = [<% @languages.sort{|a,b| b.plaques.size <=> a.plaques.size}.each do |language| %><%= language.plaques.size %>,<% end %>];
    var hbar = new RGraph.HBar('myCanvas', data);
    hbar.Set('chart.labels', [<% @languages.sort{|a,b| b.plaques.size <=> a.plaques.size}.each do |language| %>'<%= language %>',<% end %>]);
    hbar.Set('chart.colors', ['blue','red','green','orange']);
    hbar.Set('chart.strokestyle', 'rgba(0,0,0,0)');
    hbar.Set('chart.labels.above', true);
    hbar.Set('chart.vmargin', 15);
    hbar.Set('chart.background.grid', false);
    hbar.Set('chart.colors.sequential', true);
    hbar.Set('chart.xlabels', false);
    hbar.Set('chart.gutter.left', 100);
    hbar.Set('chart.gutter.right', 50);
    hbar.Set('chart.gutter.top', 25);
    hbar.Set('chart.noxaxis', true);
    hbar.Set('chart.noxtickmarks', true);
    hbar.Set('chart.noytickmarks', true);
    RGraph.isOld() ? hbar.Draw() : RGraph.Effects.HBar.Grow(hbar);
  }
</script><commit_msg>fix languages graph<commit_after><% content_for(:page_title) {t '.page_title'} %>
<% content_for(:title) {t '.page_heading'} %>
<% content_for(:admin_menu) {navbar_link_to(t('buttons.add'), new_language_path, {class: :edit, title: t('buttons.add')})} %>

<div class="row">
  <div id="top10-chart" class="col-8" style="height: 400px;">
    <%= render @languages %>
  </div>
</div>

<script>
  var data = [<% @languages.sort{|a,b| b.plaques.size <=> a.plaques.size}.each do |language| %><%= language.plaques.size %>,<% end %>];
  hbar = new RGraph.SVG.HBar({
    id: 'top10-chart',
    data: data,
    options: {
      yaxisLabels: [<% @languages.each do |o| %>'<%= o.name %>',<% end %>],
      colors: ['blue','red','green','orange','blue','red','green','orange','blue'],
      strokestyle: 'rgba(0,0,0,0)',
      labelsAbove: true,
      vmargin: 15,
      backgroundGrid: false,
      colorsSequential: true,
      xlabels: false,
      gutterLeft: 350,
      gutterRight: 50,
      gutterTop: 25,
      noxaxis: true,
      noxtickmarks: true,
      noytickmarks: true,
    }
  }).grow();
</script>
{'fraction_non_alphanumeric': 0.22732769044740025, 'fraction_numerical': 0.016122531237404272, 'mean_word_length': 4.096509240246407, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 38, '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': '1537464', 'n_tokens_mistral': 996, 'n_tokens_neox': 910, 'n_words': 157}