import React from 'react';
import { Box } from '@mui/material';
import { PolarArea } from 'react-chartjs-2';
import { registerChartJS, commonChartOptions } from './chartutils';

registerChartJS();

const PolarChartComponent = () => {
  const data = {
    labels: ['Download Sales', 'In-Store Sales', 'Mail Sales', 'Telesales', 'Corporate Sales'],
    datasets: [
      {
        data: [300, 500, 100, 40, 120],
        backgroundColor: [
          'rgba(255, 99, 132, 0.6)',
          'rgba(54, 162, 235, 0.6)',
          'rgba(255, 206, 86, 0.6)',
          'rgba(75, 192, 192, 0.6)',
          'rgba(153, 102, 255, 0.6)',
        ],
        borderWidth: 1,
      },
    ],
  };

  const options = {
    ...commonChartOptions,
    plugins: {
      title: {
        display: true,
        text: 'Polar Area Chart',
      },
    },
  };

  return (
    <Box sx={{ height: 400 }}>
      <PolarArea data={data} options={options} />
    </Box>
  );
};

export default PolarChartComponent;