<commit_before>module ChartingHelper
  def chart_remote(a_controller, options)
    case Charting.backend
    when :jqplot
      jqplot_remote(url_for(:controller => a_controller,
                            :action     => options[:action] || 'render_chart',
                            :width      => options[:width],
                            :height     => options[:height],
                            :rand       => rand(999_999_999)).to_s,
                    options.slice(:id, :bgcolor, :width, :height))
    when :c3
      c3chart_remote(url_for(:controller => a_controller,
                             :action     => options[:action] || 'render_chart'),
                     options.slice(:id, :zoomed))
    end
  end

  def chart_no_url(options)
    case Charting.backend
    when :jqplot then jqplot_sample(options.slice(:id, :bgcolor, :width, :height))
    when :c3     then content_tag(:div, '', :id => options[:id])
    end
  end

  # if it can then fix app/views/dashboard/_widget_chart.html.erb
  def chart_local(data, options)
    case Charting.backend
    when :jqplot then jqplot(data, options.slice(:id, :bgcolor, :width, :height))
    when :c3     then c3chart_local(data, options.slice(:id))
    end
  end

  def zoom_icon(zoom_url)
    zoom_url =~ /clear$/ ? '24/chart_unzoom.png' : '16/chart_zoom.png'
  end
end<commit_msg>Fix Incorect zoom out icon on C&U graphs https://bugzilla.redhat.com/show_bug.cgi?id=1402107<commit_after>module ChartingHelper
  def chart_remote(a_controller, options)
    case Charting.backend
    when :jqplot
      jqplot_remote(url_for(:controller => a_controller,
                            :action     => options[:action] || 'render_chart',
                            :width      => options[:width],
                            :height     => options[:height],
                            :rand       => rand(999_999_999)).to_s,
                    options.slice(:id, :bgcolor, :width, :height))
    when :c3
      c3chart_remote(url_for(:controller => a_controller,
                             :action     => options[:action] || 'render_chart'),
                     options.slice(:id, :zoomed))
    end
  end

  def chart_no_url(options)
    case Charting.backend
    when :jqplot then jqplot_sample(options.slice(:id, :bgcolor, :width, :height))
    when :c3     then content_tag(:div, '', :id => options[:id])
    end
  end

  # if it can then fix app/views/dashboard/_widget_chart.html.erb
  def chart_local(data, options)
    case Charting.backend
    when :jqplot then jqplot(data, options.slice(:id, :bgcolor, :width, :height))
    when :c3     then c3chart_local(data, options.slice(:id))
    end
  end

  def zoom_icon(zoom_url)
    # could be just url or something like "javascript:miqAsyncAjax('/host/perf_chart_chooser/10000000000017?chart_idx=0')"
    zoom_url =~ /clear('\))?$/ ? '24/chart_unzoom.png' : '16/chart_zoom.png'
  end
end
{'fraction_non_alphanumeric': 0.12207702888583219, 'fraction_numerical': 0.019944979367262722, 'mean_word_length': 2.3360091743119265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '3491992', 'n_tokens_mistral': 946, 'n_tokens_neox': 894, 'n_words': 191}