<commit_before>module PureDash
  module ChartHelper
    def pure_dash_chart_pie(data, opts={})
      @contents = []
      init(data, opts)
      colors_default(data, "pie")
      canvas = new_canvas(opts)
      add_notes_for_pie(data) if opts[:show_note]
      @contents.push(javascript_tag("
        setTimeout(function(){
          var ctx = $('##{canvas[:id]}');
          new Chart(ctx[0].getContext('2d')).Pie(#{data.to_json});
        }, 2000);"))
          
      contents_show(opts)
    end
    
    def pure_dash_chart_doughnut(data, opts={})
      @contents = []
      init(data, opts)
      colors_default(data, "pie")
      canvas = new_canvas(opts)
      add_notes_for_pie(data) if opts[:show_note]
      @contents.push(javascript_tag("
        setTimeout(function(){
          var ctx = $('##{canvas[:id]}');
          new Chart(ctx[0].getContext('2d')).Doughnut(#{data.to_json});
        }, 2000);"))<commit_msg>add option delay for chart rendering<commit_after>module PureDash
  module ChartHelper
    def pure_dash_chart_pie(data, opts={})
      @contents = []
      init(data, opts)
      colors_default(data, "pie")
      canvas = new_canvas(opts)
      add_notes_for_pie(data) if opts[:show_note]
      @contents.push(javascript_tag("
        setTimeout(function(){
          var ctx = $('##{canvas[:id]}');
          new Chart(ctx[0].getContext('2d')).Pie(#{data.to_json});
        }, #{opts[:delay] || 2000});"))
          
      contents_show(opts)
    end
    
    def pure_dash_chart_doughnut(data, opts={})
      @contents = []
      init(data, opts)
      colors_default(data, "pie")
      canvas = new_canvas(opts)
      add_notes_for_pie(data) if opts[:show_note]
      @contents.push(javascript_tag("
        setTimeout(function(){
          var ctx = $('##{canvas[:id]}');
          new Chart(ctx[0].getContext('2d')).Doughnut(#{data.to_json});
        }, #{opts[:delay] || 2000});"))
{'fraction_non_alphanumeric': 0.16605744125326372, 'fraction_numerical': 0.012532637075718016, 'mean_word_length': 2.832, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5920559', 'n_tokens_mistral': 630, 'n_tokens_neox': 619, 'n_words': 102}