text: import React, { useEffect } from "react";
  import PropTypes from "prop-types";
  import { Doughnut } from "react-chartjs-2";
  
  function DoughnutChart(props) {
    const {
      chart, redraw, redrawComplete, height
    } = props;
  
    useEffect(() => {
      if (redraw) {
        setTimeout(() => {
          redrawComplete();
        }, 1000);
      }
    }, [redraw]);
  
    return (
      <div>
        <Doughnut
          data={chart.chartData.data}
          options={chart.chartData.options}
          height={height}
          redraw={redraw}
        />
      </div>
    );
  }
  
  DoughnutChart.defaultProps = {
    redraw: false,
    redrawComplete: () => { },
    height: 300,
  };
  
  DoughnutChart.propTypes = {
    chart: PropTypes.object.isRequired,
    redraw: PropTypes.bool,
    redrawComplete: PropTypes.func,
    height: PropTypes.number,
  };
  
  export default DoughnutChart;
  