forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatternsDonutUtilizationChart.tsx
More file actions
40 lines (37 loc) · 1.13 KB
/
Copy pathPatternsDonutUtilizationChart.tsx
File metadata and controls
40 lines (37 loc) · 1.13 KB
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
35
36
37
38
39
40
import { ChartDonutUtilization, ChartThemeColor } from '@patternfly/react-charts/victory';
interface Data {
x?: string;
y?: number;
name?: string;
}
export const PatternsDonutUtilizationChart: React.FunctionComponent = () => {
const data: Data = { x: 'Storage capacity', y: 45 };
const legendData: Data[] = [{ name: `Storage capacity: 45%` }, { name: 'Unused' }];
return (
<div style={{ height: '275px', width: '300px' }}>
<ChartDonutUtilization
ariaDesc="Storage capacity"
ariaTitle="Donut utilization chart example"
constrainToVisibleArea
data={data}
hasPatterns
height={275}
labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}
legendData={legendData}
legendPosition="bottom"
name="chart5"
padding={{
bottom: 65, // Adjusted to accommodate legend
left: 20,
right: 20,
top: 20
}}
subTitle="of 100 GBps"
title="45%"
themeColor={ChartThemeColor.green}
thresholds={[{ value: 60 }, { value: 90 }]}
width={300}
/>
</div>
);
};