<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
  XAxis,
  YAxis,
  Tooltip,
  Bar,
  BarChart,
  CartesianGrid,
  Label,
  Cell,
  ResponsiveContainer,
} from 'recharts';
import { hsvToRgb } from '../../../utility';
import { StyledTooltip } from './Styled';

const HistogramTooltipContent = ({ payload, xAxisLabel = '', strings }) => {
  const data = payload && payload[0] && payload[0].payload;
  return (
    <StyledTooltip>
      <div>{`${data && data.x} ${xAxisLabel}`}</div>
      <div>{`${data && data.games} ${strings.th_matches}`}</div>
      <div>{`${data && (data.win / data.games * 100).toFixed(2)} ${strings.th_win}`}</div>
    </StyledTooltip>);<commit_msg>Hide win percentage in histogram label when no games are played<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
  XAxis,
  YAxis,
  Tooltip,
  Bar,
  BarChart,
  CartesianGrid,
  Label,
  Cell,
  ResponsiveContainer,
} from 'recharts';
import { hsvToRgb } from '../../../utility';
import { StyledTooltip } from './Styled';

const HistogramTooltipContent = ({ payload, xAxisLabel = '', strings }) => {
  const data = payload && payload[0] && payload[0].payload;
  return (
    <StyledTooltip>
      <div>{`${data && data.x} ${xAxisLabel}`}</div>
      <div>{`${data && data.games} ${strings.th_matches}`}</div>
      {data && data.games > 0 && <div>{`${(data.win / data.games * 100).toFixed(2)} ${strings.th_win}`}</div>}
    </StyledTooltip>);
{'fraction_non_alphanumeric': 0.1913265306122449, 'fraction_numerical': 0.008290816326530613, 'mean_word_length': 3.8425925925925926, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 22, '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': '673115', 'n_tokens_mistral': 548, 'n_tokens_neox': 542, 'n_words': 123}