<commit_before>import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { format } from 'd3-format';

import './widget-pie-chart-legend-styles.scss';

class WidgetPieChartLegend extends PureComponent {
  render() {
    const { data, config, className } = this.props;

    return (
      <ul className={`c-pie-chart-legend ${className}`}>
        {data.map(
          (item, index) =>
            (item.value ? (
              <li key={index.toString()}>
                <div className="legend-title">
                  <span style={{ backgroundColor: item.color }}>{}</span>
                  {item.name}
                </div>
                <div className="legend-value" style={{ color: item.color }}>
                  {format(config.format)(item[config.key])}
                  {config.unit}
                </div>
              </li>
            ) : null)
        )}
      </ul>
    );
  }
}

WidgetPieChartLegend.propTypes = {
  data: PropTypes.array,
  config: PropTypes.object,
  className: PropTypes.string
};

WidgetPieChartLegend.defaultProps = {
  config: {
    unit: '',
    key: 'value',
    format: '.3s'
  }
};

export default WidgetPieChartLegend;<commit_msg>added missing unit to donut charts<commit_after>import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { format } from 'd3-format';

import './widget-pie-chart-legend-styles.scss';

class WidgetPieChartLegend extends PureComponent {
  render() {
    const { data, config, className } = this.props;

    return (
      <ul className={`c-pie-chart-legend ${className}`}>
        {data.map(
          (item, index) =>
            (item.value ? (
              <li key={index.toString()}>
                <div className="legend-title">
                  <span style={{ backgroundColor: item.color }}>{}</span>
                  {item.name}
                </div>
                <div className="legend-value" style={{ color: item.color }}>
                  {format(config.format)(item[config.key])}
                  {config.unit}
                </div>
              </li>
            ) : null)
        )}
      </ul>
    );
  }
}

WidgetPieChartLegend.propTypes = {
  data: PropTypes.array,
  config: PropTypes.object,
  className: PropTypes.string
};

WidgetPieChartLegend.defaultProps = {
  config: {
    unit: 'ha',
    key: 'value',
    format: '.3s'
  }
};

export default WidgetPieChartLegend;
{'fraction_non_alphanumeric': 0.14584186808684965, 'fraction_numerical': 0.0016386726751331422, 'mean_word_length': 1.9926470588235294, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '2410937', 'n_tokens_mistral': 745, 'n_tokens_neox': 729, 'n_words': 149}