import {useEffect, useRef, FC} from 'react' import ApexCharts, {ApexOptions} from 'apexcharts' import {KTIcon} from '../../../helpers' import {getCSSVariableValue} from '../../../assets/ts/_utils' import {Dropdown1} from '../../content/dropdown/Dropdown1' import {useThemeMode} from '../../layout/theme-mode/ThemeModeProvider' type Props = { className: string chartHeight: string chartColor: string } const MixedWidget6: FC = ({className, chartHeight, chartColor}) => { const chartRef = useRef(null) const {mode} = useThemeMode() const refreshChart = () => { if (!chartRef.current) { return } const chart = new ApexCharts(chartRef.current, chartOptions(chartHeight, chartColor)) if (chart) { chart.render() } return chart } useEffect(() => { const chart = refreshChart() return () => { if (chart) { chart.destroy() } } // eslint-disable-next-line react-hooks/exhaustive-deps }, [chartRef, mode]) return (
{/* begin::Beader */}

Sales Overview Recent sales statistics

{/* begin::Menu */} {/* end::Menu */}
{/* end::Header */} {/* begin::Body */}
{/* begin::Stats */}
{/* begin::Row */}
{/* begin::Col */}
{/* begin::Label */}
Average Sale
{/* end::Label */} {/* begin::Stat */}
$650
{/* end::Stat */}
{/* end::Col */} {/* begin::Col */}
{/* begin::Label */}
Commission
{/* end::Label */} {/* begin::Stat */}
$233,600
{/* end::Stat */}
{/* end::Col */}
{/* end::Row */} {/* begin::Row */}
{/* begin::Col */}
{/* begin::Label */}
Annual Taxes 2019
{/* end::Label */} {/* begin::Stat */}
$29,004
{/* end::Stat */}
{/* end::Col */} {/* begin::Col */}
{/* begin::Label */}
Annual Income
{/* end::Label */} {/* begin::Stat */}
$1,480,00
{/* end::Stat */}
{/* end::Col */}
{/* end::Row */}
{/* end::Stats */} {/* begin::Chart */}
{/* end::Chart */}
{/* end::Body */}
) } const chartOptions = (chartHeight: string, chartColor: string): ApexOptions => { const labelColor = getCSSVariableValue('--bs-gray-800') const strokeColor = getCSSVariableValue('--bs-gray-300') const baseColor = getCSSVariableValue('--bs-' + chartColor) const lightColor = getCSSVariableValue('--bs-' + chartColor + '-light') return { series: [ { name: 'Net Profit', data: [30, 25, 45, 30, 55, 55], }, ], chart: { fontFamily: 'inherit', type: 'area', height: chartHeight, toolbar: { show: false, }, zoom: { enabled: false, }, sparkline: { enabled: true, }, }, plotOptions: {}, legend: { show: false, }, dataLabels: { enabled: false, }, fill: { type: 'solid', opacity: 1, }, stroke: { curve: 'smooth', show: true, width: 3, colors: [baseColor], }, xaxis: { categories: ['Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'], axisBorder: { show: false, }, axisTicks: { show: false, }, labels: { show: false, style: { colors: labelColor, fontSize: '12px', }, }, crosshairs: { show: false, position: 'front', stroke: { color: strokeColor, width: 1, dashArray: 3, }, }, tooltip: { enabled: false, }, }, yaxis: { min: 0, max: 60, labels: { show: false, style: { colors: labelColor, fontSize: '12px', }, }, }, states: { normal: { filter: { type: 'none', value: 0, }, }, hover: { filter: { type: 'none', value: 0, }, }, active: { allowMultipleDataPointsSelection: false, filter: { type: 'none', value: 0, }, }, }, tooltip: { style: { fontSize: '12px', }, y: { formatter: function (val) { return '$' + val + ' thousands' }, }, }, colors: [lightColor], markers: { colors: [lightColor], strokeColors: [baseColor], strokeWidth: 3, }, } } export {MixedWidget6}