<commit_before>import Axis from 'models/axis';
import * as utils from 'base/utils';

/*
 * VIZABI Size Model
 */

var SizeModel = Axis.extend({

  /**
   * Default values for this model
   */
  getClassDefaults: function() { 
    var defaults = {
      use: null,
      which: null,
      domainMin: null,
      domainMax: null,
      zoomedMin: null,
      zoomedMax: null,
      extent: [0, 0.85],
      scaleType: null,
      allow: {
        scales: ["linear", "log", "genericLog", "pow"]
      }
    };
    return utils.deepExtend(this._super(), defaults);
  },

  _type: "size",

  buildScale: function(){
    //do whatever axis.buildScale does
    this._super();
    //but then also clamp a numeric scale
    if(this.scaleType !== 'ordinal') this.scale.clamp(true);
    
  },

  autoGenerateModel: function() {
    if (this.which == null) {
      var concept;
      if (this.autogenerate) {
        var concept = this.dataSource
          .getConceptByIndex(this.autogenerate.conceptIndex, this.autogenerate.conceptType)

        if (concept) {
          this.which = concept.concept;
          this.use = "indicator";
          this.scaleType = "linear";
        }

      } 
      if (!concept) {
        this.which = "_default";
        this.use = "constant";  
        this.scaleType = "ordinal";
      }
    }
  }

});

export default SizeModel;<commit_msg>Fix fail on refresh for size<commit_after>import Axis from 'models/axis';
import * as utils from 'base/utils';

/*
 * VIZABI Size Model
 */

var SizeModel = Axis.extend({

  /**
   * Default values for this model
   */
  getClassDefaults: function() { 
    var defaults = {
      use: null,
      which: null,
      domainMin: null,
      domainMax: null,
      zoomedMin: null,
      zoomedMax: null,
      extent: [0, 0.85],
      scaleType: null,
      allow: {
        scales: ["linear", "log", "genericLog", "pow"]
      }
    };
    return utils.deepExtend(this._super(), defaults);
  },

  _type: "size",

  buildScale: function(){
    //do whatever axis.buildScale does
    this._super();
    //but then also clamp a numeric scale
    if(this.scaleType !== 'ordinal') this.scale.clamp(true);
    
  },

  autoGenerateModel: function() {
    if (this.which == null) {
      var concept;
      if (this.autogenerate) {
        var concept = this.dataSource
          .getConceptByIndex(this.autogenerate.conceptIndex, this.autogenerate.conceptType)

        if (concept) {
          this.which = concept.concept;
          this.use = "indicator";
          this.scaleType = "linear";
        }

      } 
      if (!concept) {
        this.which = "_default";
        this.use = "constant";  
        this.scaleType = "ordinal";
      }
    }
    if (this.scaleType == null) {
        this.scaleType = this.dataSource
          .getConceptprops(this.which).scales[0]; 
    }
  }

});

export default SizeModel;
{'fraction_non_alphanumeric': 0.13388831078737426, 'fraction_numerical': 0.003121748178980229, 'mean_word_length': 2.1313789359391966, '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': '5787891', 'n_tokens_mistral': 944, 'n_tokens_neox': 904, 'n_words': 214}