<commit_before>HTMLWidgets.widget({
  name: "dimple",
  type: "output",
  
  initialize: function(el, width, height){
    return {};
  },
  
  resize: function(el, width, height, instance) {

  },  
  
  renderValue: function(el, x, instance){
    // add title if provided
    if (x.options.title){
      if (x.options.title.html){
        // if html provided then use innerHTML
        // this is not robust and will need more checking on js or R side
        el.innerHTML = x.options.title.html;
      }
      else if(x.options.title.text) {
        // if just text then make it an h3
        titlenode = document.createElement("h3")
        titlenode.style["margin-top"] = 0;
        titlenode.style["margin-bottom"] = 0;
        titlenode.innerText = x.options.title.text;
        el.appendChild(titlenode);
      }
    }
    
    // make data in record or array of objects format
    //    using the HTMLWidgets helper function
    x.data = HTMLWidgets.dataframeToD3(x.data);

    el.widgetDimple = drawChart(x.options, x.data);
    
    function drawChart(opts, data){ 
      var subCharts = [];
      
      var c = null;
      var assignedColors = {};
      
      //handle RJSONIO box/unbox troubles<commit_msg>add ability to handle post draw tasks<commit_after>HTMLWidgets.widget({
  name: "dimple",
  type: "output",
  
  initialize: function(el, width, height){
    return {};
  },
  
  resize: function(el, width, height, instance) {

  },  
  
  renderValue: function(el, x, instance){
    // add title if provided
    if (x.options.title){
      if (x.options.title.html){
        // if html provided then use innerHTML
        // this is not robust and will need more checking on js or R side
        el.innerHTML = x.options.title.html;
      }
      else if(x.options.title.text) {
        // if just text then make it an h3
        titlenode = document.createElement("h3")
        titlenode.style["margin-top"] = 0;
        titlenode.style["margin-bottom"] = 0;
        titlenode.innerText = x.options.title.text;
        el.appendChild(titlenode);
      }
    }
    
    // make data in record or array of objects format
    //    using the HTMLWidgets helper function
    x.data = HTMLWidgets.dataframeToD3(x.data);

    el.widgetDimple = drawChart(x.options, x.data);
    
    if(typeof x.options.tasks !== "undefined"){
      if(!x.options.tasks.length){ 
        x.options.tasks = [x.options.tasks]
      }
      
      x.options.tasks.map(function(task){
        if(typeof task == "function"){
          task.call(el)
        }
      })
    }
    
    function drawChart(opts, data){ 
      var subCharts = [];
      
      var c = null;
      var assignedColors = {};
      
      //handle RJSONIO box/unbox troubles
{'fraction_non_alphanumeric': 0.12035010940919037, 'fraction_numerical': 0.0036469730123997084, 'mean_word_length': 2.1205915813424348, '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': '4642373', 'n_tokens_mistral': 861, 'n_tokens_neox': 847, 'n_words': 218}