This repository was archived by the owner on Jan 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApiSizeVsUsefulnessStatistics.tsx
60 lines (57 loc) · 1.92 KB
/
ApiSizeVsUsefulnessStatistics.tsx
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from 'react';
import { Box, Flex } from '@chakra-ui/react';
import { useAppSelector } from '../../app/hooks';
import { selectRawPythonPackage } from '../packageData/apiSlice';
import { selectUsages } from '../usages/usageSlice';
import { CustomLineChart } from './ChartWrappers';
export const ApiSizeVsUsefulnessStatistics = function () {
const rawPythonPackage = useAppSelector(selectRawPythonPackage);
const usages = useAppSelector(selectUsages);
const thresholds = [...Array(26).keys()];
thresholds.shift();
const classLineChart = (
<CustomLineChart
usages={usages}
pythonPackage={rawPythonPackage}
labels={thresholds}
getValue={usages.getNumberOfUsedPublicClasses}
title={'Classes'}
xAxisLabel={'Minimum usefulness'}
/>
);
const functionLineChart = (
<CustomLineChart
usages={usages}
pythonPackage={rawPythonPackage}
labels={thresholds}
getValue={usages.getNumberOfUsedPublicFunctions}
title={'Functions'}
xAxisLabel={'Minimum usefulness'}
/>
);
const parameterLineChart = (
<CustomLineChart
usages={usages}
pythonPackage={rawPythonPackage}
labels={thresholds}
getValue={usages.getNumberOfUsefulPublicParameters}
title={'Parameters'}
xAxisLabel={'Minimum usefulness'}
/>
);
return (
<Box width="100%">
<Flex wrap="wrap">
<Box minWidth="350px" flex="1 1 33%">
{classLineChart}
</Box>
<Box minWidth="350px" flex="1 1 33%">
{functionLineChart}
</Box>
<Box minWidth="350px" flex="1 1 33%">
{parameterLineChart}
</Box>
</Flex>
</Box>
);
};