Source: CircleChart/index.js

import React, { useState, memo } from 'react';
import styled from 'styled-components';
import { RadialChart, Hint } from 'react-vis';

import './index.css';

/**
 * @constant
 */
const CustomRadialChart = styled(RadialChart)`
  && {
    .rv-radial-chart__series--pie__slice {
      transition: all 0.4s ease-in-out;
    }

    .rv-radial-chart__series--pie__slice:hover {
      stroke: #000 !important;
      stroke-width: 2px !important;
    }

    .rv-hint__content {
      font-size: 1.5rem;
    }
  }
`;

/**
 * CircleChart component
 *
 * @param {Object} props
 */
function CircleChart(props) {
  /**
   * State - value updated by mouse over
   * @constant
   */
  const [value, changeValue] = useState(false);

  return (
    <CustomRadialChart
      onValueMouseOver={v => changeValue(v)}
      onSeriesMouseOut={() => changeValue(false)}
      {...props}
    >
      {value !== false && (
        <Hint
          value={value}
          format={v => [{ title: v.title, value: v.label }]}
        />
      )}
    </CustomRadialChart>
  );
}

export default memo(CircleChart);