import { Chart, ChartArea, ChartAxis, ChartGroup, ChartThemeColor, ChartVoronoiContainer } from '@patternfly/react-charts/victory'; import { Switch } from '@patternfly/react-core'; import { useState } from 'react'; interface PetData { name?: string; x?: string; y?: number; } export const SkeletonsAreaChart: React.FunctionComponent = () => { const [isChecked, setIsChecked] = useState(true); const handleChange = (_event: React.FormEvent, checked: boolean) => { setIsChecked(checked); }; const legendData: PetData[] = [{ name: 'Cats' }, { name: 'Dogs' }, { name: 'Birds' }]; const data1: PetData[] = [ { name: 'Cats', x: '2015', y: 3 }, { name: 'Cats', x: '2016', y: 4 }, { name: 'Cats', x: '2017', y: 8 }, { name: 'Cats', x: '2018', y: 6 } ]; const data2: PetData[] = [ { name: 'Dogs', x: '2015', y: 2 }, { name: 'Dogs', x: '2016', y: 3 }, { name: 'Dogs', x: '2017', y: 4 }, { name: 'Dogs', x: '2018', y: 5 }, { name: 'Dogs', x: '2019', y: 6 } ]; const data3: PetData[] = [ { name: 'Birds', x: '2015', y: 1 }, { name: 'Birds', x: '2016', y: 2 }, { name: 'Birds', x: '2017', y: 3 }, { name: 'Birds', x: '2018', y: 2 }, { name: 'Birds', x: '2019', y: 4 } ]; return ( <>
`${datum.name}: ${datum.y}`} constrainToVisibleArea /> } legendData={legendData} legendOrientation="vertical" legendPosition="right" height={200} maxDomain={{ y: 9 }} name="chart1" padding={{ bottom: 50, left: 50, right: 200, // Adjusted to accommodate legend top: 50 }} themeColor={isChecked ? ChartThemeColor.skeleton : ChartThemeColor.blue} width={800} >
); };