<commit_before>import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { isNone } from '@ember/utils';
import { computed } from '@ember/object';
import chroma from 'chroma';

export default Controller.extend({
  intl: service(),
  approvalDeltas: computed('model.@each', function () {
    return this.get('model').map((record) => {
      return record.get('approvalDelta');
    });
  }),
  missingDataLabel: computed('intl.locale', function() {
    return this.get('intl').t('visualize.time.bubble-chart-legend.missing-data');
  }),

  createTooltip(record){
    const options = {
      style: 'percent',
      minimumFractionDigits: 2,
      maximumFractionDigits: 2,
    }
    let approvals = [];
    record.get('approval').forEach((a,i) => {
      approvals[i] = a ? this.get('intl').formatNumber(a, options) : '?';
    });
    return this.get('intl').t('visualize.time.tooltip', {
      title: record.get('title'),
      approvalBefore: approvals[0],
      approvalAfter: approvals[1],
      impressionsBefore: record.get('impressions')[0],
      impressionsAfter: record.get('impressions')[1]
    });
  },

  colorScale: computed('model', function() {
    return chroma
      .scale(["deeppink", "lightblue", "limegreen"])
      .domain(chroma.limits(this.get('approvalDeltas'), 'q', 2));
  }),
  nullColor: chroma('tan'),
  chartData: computed('model', 'intl.locale', function() {
    let colorFunction = (value) => {
      if (isNone(value)){<commit_msg>extracted array create function to a property<commit_after>import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { isNone } from '@ember/utils';
import { computed } from '@ember/object';
import chroma from 'chroma';

export default Controller.extend({
  intl: service(),
  approvalDeltas: computed('model.@each', function () {
    return this.get('model').map((record) => {
      return record.get('approvalDelta');
    });
  }),
  approvalDeltasLimits: computed('approvalDeltas', function () {
   return chroma.limits(this.get('approvalDeltas'), 'q', 4);
  }),
  missingDataLabel: computed('intl.locale', function() {
    return this.get('intl').t('visualize.time.bubble-chart-legend.missing-data');
  }),

  createTooltip(record){
    const options = {
      style: 'percent',
      minimumFractionDigits: 2,
      maximumFractionDigits: 2,
    }
    let approvals = [];
    record.get('approval').forEach((a,i) => {
      approvals[i] = a ? this.get('intl').formatNumber(a, options) : '?';
    });
    return this.get('intl').t('visualize.time.tooltip', {
      title: record.get('title'),
      approvalBefore: approvals[0],
      approvalAfter: approvals[1],
      impressionsBefore: record.get('impressions')[0],
      impressionsAfter: record.get('impressions')[1]
    });
  },

  colorScale: computed('model', function() {
    return chroma
      .scale(["deeppink", "lightblue", "limegreen"])
      .domain(this.get('approvalDeltasLimits'));
  }),
  nullColor: chroma('tan'),
  chartData: computed('model', 'intl.locale', function() {
    let colorFunction = (value) => {
      if (isNone(value)){
{'fraction_non_alphanumeric': 0.1779955738223206, 'fraction_numerical': 0.004426177679418274, 'mean_word_length': 3.951486697965571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '971387', 'n_tokens_mistral': 1011, 'n_tokens_neox': 1002, 'n_words': 188}