<commit_before>import Component from '@glimmer/component';
import { isEmpty, isPresent } from '@ember/utils';
import { guidFor } from '@ember/object/internals';
import { action } from '@ember/object';
import { task, timeout } from 'ember-concurrency';

import c3 from 'c3';

// make d3 available for direct use
import d3 from 'd3'; // eslint-disable-line no-unused-vars

/** Class ember-c3 */
export default class C3Component extends Component {
  chartId = `c3-${guidFor(this)}`;

  /**
   * chart configuration objed
   * @member {Object}
   */
  config = {};

  /**
   * Delay time to refresh c3 chart
   * @member {number}
   */
  _transition = 350;

  /**
   * Dynamic title for chart
   * @member {String}
   */
  dtitle = null;

  /**
   * Create a c3 chart
   * @param {proxy} Component arguments - this.args proxy
   */
  constructor() {
    super(...arguments);

    // bind c3 chart to component's element
    this.config.bindto = this.chartId;

    // if data is not provided use dummy
    // data to prevent rendering errors
    const dummyData = {
      xs: null,
      columns: [],
      empty: { label: { text: 'No Data' } }
    };

    // Do we have a data object?
    let dataObject = this.data;

    if (!dataObject) {
      this.config.data = dummyData;
    }

    // Does data object have a data source?
    if (dataObject) {
      const isSourcePresent =
        isPresent(this.data.url) ||
        isPresent(this.data.json) ||
        isPresent(this.data.rows) ||
        isPresent(this.data.columns);

      // If no source add empty source
      // else use passed data argument
      if (!isSourcePresent) {
        dataObject.columns = [];
        dataObject.empty == { label: { text: 'No Data' } };
        this.config.data = dataObject;
      } else this.config.data = this.data;
    }

    this.config.axis = this.args.axis;
    this.config.color = this.args.color;

    // chart type arguments
    this.config.color = this.args.color;
    this.config.line = this.args.line;
    this.config.bar = this.args.bar;
    this.config.pie = this.args.pie;
    this.config.donut = this.args.donut;
    this.config.guage = this.args.gauge;

    // chart parameter arguments
    this.config.grid = this.args.grid;
    this.config.legend = this.args.legend;
    this.config.tooltip = this.args.tooltip;
    this.config.subchart = this.args.subchart;
    this.config.zoom = this.args.zoom;
    this.config.point = this.args.point;
    this.config.regions = this.args.regions;
    this.config.area = this.args.area;
    this.config.size = this.args.size;<commit_msg>fix: Fix assignment of empty data labels<commit_after>import Component from '@glimmer/component';
import { isEmpty, isPresent } from '@ember/utils';
import { guidFor } from '@ember/object/internals';
import { action } from '@ember/object';
import { task, timeout } from 'ember-concurrency';

import c3 from 'c3';

// make d3 available for direct use
import d3 from 'd3'; // eslint-disable-line no-unused-vars

/** Class ember-c3 */
export default class C3Component extends Component {
  chartId = `c3-${guidFor(this)}`;

  /**
   * chart configuration objed
   * @member {Object}
   */
  config = {};

  /**
   * Delay time to refresh c3 chart
   * @member {number}
   */
  _transition = 350;

  /**
   * Dynamic title for chart
   * @member {String}
   */
  dtitle = null;

  /**
   * Create a c3 chart
   * @param {proxy} Component arguments - this.args proxy
   */
  constructor() {
    super(...arguments);

    // bind c3 chart to component's element
    this.config.bindto = this.chartId;

    // if data is not provided use dummy
    // data to prevent rendering errors
    const dummyData = {
      xs: null,
      columns: [],
      empty: { label: { text: 'No Data' } }
    };

    // Do we have a data object?
    let dataObject = this.data;

    if (!dataObject) {
      this.config.data = dummyData;
    }

    // Does data object have a data source?
    if (dataObject) {
      const isSourcePresent =
        isPresent(this.data.url) ||
        isPresent(this.data.json) ||
        isPresent(this.data.rows) ||
        isPresent(this.data.columns);

      // If no source add empty source
      // else use passed data argument
      if (!isSourcePresent) {
        dataObject.columns = [];
        dataObject.empty = { label: { text: 'No Data' } };
        this.config.data = dataObject;
      } else this.config.data = this.data;
    }

    this.config.axis = this.args.axis;
    this.config.color = this.args.color;

    // chart type arguments
    this.config.color = this.args.color;
    this.config.line = this.args.line;
    this.config.bar = this.args.bar;
    this.config.pie = this.args.pie;
    this.config.donut = this.args.donut;
    this.config.guage = this.args.gauge;

    // chart parameter arguments
    this.config.grid = this.args.grid;
    this.config.legend = this.args.legend;
    this.config.tooltip = this.args.tooltip;
    this.config.subchart = this.args.subchart;
    this.config.zoom = this.args.zoom;
    this.config.point = this.args.point;
    this.config.regions = this.args.regions;
    this.config.area = this.args.area;
    this.config.size = this.args.size;
{'fraction_non_alphanumeric': 0.1332819722650231, 'fraction_numerical': 0.00539291217257319, 'mean_word_length': 2.4596935376415723, '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': '490615', 'n_tokens_mistral': 1672, 'n_tokens_neox': 1626, 'n_words': 417}