Debian Codegraph @

node/@patternfly/react-core/src/demos/examples/Card/CardUtilizationDemo4.tsx

raw
1 import { Card, CardTitle, CardBody, CardFooter, Title, Gallery, GalleryItem } from '@patternfly/react-core';
2 import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';
3
4 export const CardUtilizationDemo4: React.FunctionComponent = () => (
5 <Gallery hasGutter minWidths={{ default: '360px' }}>
6 <GalleryItem>
7 <Card id="utilization-card-4-card" component="div">
8 <CardTitle>
9 <Title headingLevel="h4" size="lg">
10 CPU Usage
11 </Title>
12 </CardTitle>
13 <CardBody>
14 <ChartDonutThreshold
15 ariaDesc="Mock storage capacity"
16 ariaTitle="Mock donut utilization chart"
17 constrainToVisibleArea={true}
18 data={[
19 { x: 'Warning at 60%', y: 60 },
20 { x: 'Danger at 90%', y: 90 }
21 ]}
22 height={200}
23 labels={({ datum }) => (datum.x ? datum.x : null)}
24 padding={{
25 bottom: 0,
26 left: 10,
27 right: 150,
28 top: 0
29 }}
30 width={350}
31 >
32 <ChartDonutUtilization
33 data={{ x: 'Storage capacity', y: 80 }}
34 labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}
35 legendData={[{ name: `Capacity: 80%` }, { name: 'Warning at 60%' }, { name: 'Danger at 90%' }]}
36 legendOrientation="vertical"
37 title="80%"
38 subTitle="of 100 GBps"
39 thresholds={[{ value: 60 }, { value: 90 }]}
40 />
41 </ChartDonutThreshold>{' '}
42 </CardBody>
43 <CardFooter>
44 <a href="#">See details</a>
45 </CardFooter>
46 </Card>
47 </GalleryItem>
48 </Gallery>
49 );