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 clsx from 'clsx' import {useThemeMode} from '../../layout/theme-mode/ThemeModeProvider' type Props = { className: string chartColor: string chartHeight: string } const MixedWidget3: FC = ({className, chartColor, chartHeight}) => { const chartRef = useRef(null) const {mode} = useThemeMode() const refreshChart = () => { if (!chartRef.current) { return } const chart = new ApexCharts(chartRef.current, chartOptions(chartHeight)) 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::Header */}

Sales Progress

{/* begin::Menu */} {/* end::Menu */}
{/* end::Header */} {/* begin::Body */}
{/* begin::Chart */}
{/* end::Chart */} {/* begin::Stats */}
{/* begin::Row */}
{/* begin::Col */}
Avarage Sale
$650
{/* end::Col */} {/* begin::Col */}
Comissions
$29,500
{/* end::Col */}
{/* end::Row */} {/* begin::Row */}
{/* begin::Col */}
Revenue
$55,000
{/* end::Col */} {/* begin::Col */}
Expenses
$1,130,600
{/* end::Col */}
{/* end::Row */}
{/* end::Stats */}
{/* end::Body */}
) } const chartOptions = (chartHeight: string): ApexOptions => { const labelColor = getCSSVariableValue('--bs-gray-500') const borderColor = getCSSVariableValue('--bs-gray-200') return { series: [ { name: 'Net Profit', data: [35, 65, 75, 55, 45, 60, 55], }, { name: 'Revenue', data: [40, 70, 80, 60, 50, 65, 60], }, ], chart: { fontFamily: 'inherit', type: 'bar', height: chartHeight, toolbar: { show: false, }, sparkline: { enabled: true, }, }, plotOptions: { bar: { horizontal: false, columnWidth: '30%', borderRadius: 5, }, }, legend: { show: false, }, dataLabels: { enabled: false, }, stroke: { show: true, width: 1, colors: ['transparent'], }, xaxis: { categories: ['Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'], axisBorder: { show: false, }, axisTicks: { show: false, }, labels: { style: { colors: labelColor, fontSize: '12px', }, }, }, yaxis: { min: 0, max: 100, labels: { style: { colors: labelColor, fontSize: '12px', }, }, }, fill: { type: ['solid', 'solid'], opacity: [0.25, 1], }, 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' }, }, marker: { show: false, }, }, colors: ['#ffffff', '#ffffff'], grid: { borderColor: borderColor, strokeDashArray: 4, yaxis: { lines: { show: true, }, }, padding: { left: 20, right: 20, }, }, } } export {MixedWidget3}