forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChartUtilStatic.tsx
More file actions
34 lines (31 loc) · 992 Bytes
/
ChartUtilStatic.tsx
File metadata and controls
34 lines (31 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';
interface UsageData {
x: string;
y: number;
}
export const ChartUtilStatic: React.FunctionComponent = () => {
const dataThreshold: UsageData[] = [
{ x: 'Warning at 60%', y: 60 },
{ x: 'Danger at 90%', y: 90 }
];
const dataUtil: UsageData = { x: 'Storage capacity', y: 45 };
return (
<div style={{ height: '230px', width: '230px' }}>
<ChartDonutThreshold
ariaDesc="Storage capacity"
ariaTitle="Donut utilization chart with static threshold example"
constrainToVisibleArea
data={dataThreshold}
labels={({ datum }) => (datum.x ? datum.x : null)}
name="chart10"
>
<ChartDonutUtilization
data={dataUtil}
labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}
subTitle="of 100 GBps"
title="45%"
/>
</ChartDonutThreshold>
</div>
);
};