import React, { useState, memo } from 'react';
import styled from 'styled-components';
import { RadialChart, Hint } from 'react-vis';
import './CircleChart.css';
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;
}
}
`;
/**
* @param {Object} props
*/
export function CircleChart(props) {
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);