@@ -12,7 +12,7 @@ import {
12
12
import { Bar , Line } from 'react-chartjs-2' ;
13
13
import { PythonPackage } from '../model/PythonPackage' ;
14
14
import { UsageCountStore } from '../../usages/model/UsageCountStore' ;
15
- import { Box , Flex , Button , Heading , VStack , Wrap , WrapItem } from '@chakra-ui/react' ;
15
+ import { Box , Button , Flex , Heading , SimpleGrid , VStack } from '@chakra-ui/react' ;
16
16
import { selectAnnotationStore } from '../../annotations/annotationSlice' ;
17
17
import { useAppDispatch , useAppSelector } from '../../../app/hooks' ;
18
18
import { selectFilterString , setFilterString } from '../../ui/uiSlice' ;
@@ -64,21 +64,24 @@ export const StatisticsView: React.FC = function () {
64
64
rawPythonPackage ,
65
65
thresholds ,
66
66
usages . getNumberOfUsedPublicClasses ,
67
- 'Classes per Threshold' ,
67
+ 'Classes' ,
68
+ 'Minimum usefulness' ,
68
69
) ;
69
70
const functionLineChart = createLineChart (
70
71
usages ,
71
72
rawPythonPackage ,
72
73
thresholds ,
73
74
usages . getNumberOfUsedPublicFunctions ,
74
- 'Functions per Threshold' ,
75
+ 'Functions' ,
76
+ 'Minimum usefulness' ,
75
77
) ;
76
78
const parameterLineChart = createLineChart (
77
79
usages ,
78
80
rawPythonPackage ,
79
81
thresholds ,
80
82
usages . getNumberOfUsefulPublicParameters ,
81
- 'Parameters per Threshold' ,
83
+ 'Parameters' ,
84
+ 'Minimum usefulness' ,
82
85
) ;
83
86
84
87
const filterAction = ( annotation : string ) => {
@@ -100,9 +103,34 @@ export const StatisticsView: React.FC = function () {
100
103
} ;
101
104
102
105
return (
103
- < VStack spacing = "4" >
104
- < Heading as = "h2" size = "md" >
105
- Statistics
106
+ < VStack spacing = { 4 } >
107
+ < Heading as = "h3" size = "md" >
108
+ Annotations
109
+ </ Heading >
110
+ < SimpleGrid columns = { 2 } spacing = { 2 } >
111
+ < Button onClick = { ( ) => filterAction ( 'attribute' ) } children = { 'Attributes: ' + attributesSize } > </ Button >
112
+ < Button onClick = { ( ) => filterAction ( 'boundary' ) } children = { 'Boundaries: ' + boundariesSize } > </ Button >
113
+ < Button
114
+ onClick = { ( ) => filterAction ( 'calledAfter' ) }
115
+ children = { 'CalledAfter: ' + calledAftersSize }
116
+ > </ Button >
117
+ < Button onClick = { ( ) => filterAction ( 'constant' ) } children = { 'Constants: ' + constantsSize } > </ Button >
118
+ < Button
119
+ onClick = { ( ) => filterAction ( 'description' ) }
120
+ children = { 'Descriptions: ' + descriptionSize }
121
+ > </ Button >
122
+ < Button onClick = { ( ) => filterAction ( 'enum' ) } children = { 'Enums: ' + enumsSize } > </ Button >
123
+ < Button onClick = { ( ) => filterAction ( 'group' ) } children = { 'Groups: ' + groupsSize } > </ Button >
124
+ < Button onClick = { ( ) => filterAction ( 'move' ) } children = { 'Move: ' + movesSize } > </ Button >
125
+ < Button onClick = { ( ) => filterAction ( 'optional' ) } children = { 'Optionals: ' + optionalsSize } > </ Button >
126
+ < Button onClick = { ( ) => filterAction ( 'pure' ) } children = { 'Pures: ' + puresSize } > </ Button >
127
+ < Button onClick = { ( ) => filterAction ( 'remove' ) } children = { 'Removes: ' + removesSize } > </ Button >
128
+ < Button onClick = { ( ) => filterAction ( 'rename' ) } children = { 'Renaming: ' + renamingsSize } > </ Button >
129
+ < Button onClick = { ( ) => filterAction ( 'required' ) } children = { 'Requireds: ' + requiredsSize } > </ Button >
130
+ < Button onClick = { ( ) => filterAction ( 'todo' ) } children = { 'Todos: ' + todoSize } > </ Button >
131
+ </ SimpleGrid >
132
+ < Heading as = "h3" size = "md" >
133
+ API Size
106
134
</ Heading >
107
135
< Box width = "100%" >
108
136
< Flex wrap = "wrap" >
@@ -117,6 +145,9 @@ export const StatisticsView: React.FC = function () {
117
145
</ Box >
118
146
</ Flex >
119
147
</ Box >
148
+ < Heading as = "h3" size = "md" >
149
+ API Size per Minimum Usefulness Threshold
150
+ </ Heading >
120
151
< Box width = "100%" >
121
152
< Flex wrap = "wrap" >
122
153
< Box minWidth = "350px" flex = "1 1 33%" >
@@ -130,65 +161,6 @@ export const StatisticsView: React.FC = function () {
130
161
</ Box >
131
162
</ Flex >
132
163
</ Box >
133
- < Heading as = "h3" size = "md" >
134
- Annotations
135
- </ Heading >
136
- < Wrap mx = "auto" padding = "10px 10px 10px 10px" >
137
- < WrapItem >
138
- < Button
139
- onClick = { ( ) => filterAction ( 'attribute' ) }
140
- children = { 'Attributes: ' + attributesSize }
141
- > </ Button >
142
- </ WrapItem >
143
- < WrapItem >
144
- < Button
145
- onClick = { ( ) => filterAction ( 'boundary' ) }
146
- children = { 'Boundaries: ' + boundariesSize }
147
- > </ Button >
148
- </ WrapItem >
149
- < WrapItem >
150
- < Button
151
- onClick = { ( ) => filterAction ( 'calledAfter' ) }
152
- children = { 'CalledAfter: ' + calledAftersSize }
153
- > </ Button >
154
- </ WrapItem >
155
- < WrapItem >
156
- < Button onClick = { ( ) => filterAction ( 'constant' ) } children = { 'Constants: ' + constantsSize } > </ Button >
157
- </ WrapItem >
158
- < WrapItem >
159
- < Button
160
- onClick = { ( ) => filterAction ( 'description' ) }
161
- children = { 'Descriptions: ' + descriptionSize }
162
- > </ Button >
163
- </ WrapItem >
164
- < WrapItem >
165
- < Button onClick = { ( ) => filterAction ( 'enum' ) } children = { 'Enums: ' + enumsSize } > </ Button >
166
- </ WrapItem >
167
- < WrapItem >
168
- < Button onClick = { ( ) => filterAction ( 'group' ) } children = { 'Groups: ' + groupsSize } > </ Button >
169
- </ WrapItem >
170
- < WrapItem >
171
- < Button onClick = { ( ) => filterAction ( 'move' ) } children = { 'Move: ' + movesSize } > </ Button >
172
- </ WrapItem >
173
- < WrapItem >
174
- < Button onClick = { ( ) => filterAction ( 'optional' ) } children = { 'Optionals: ' + optionalsSize } > </ Button >
175
- </ WrapItem >
176
- < WrapItem >
177
- < Button onClick = { ( ) => filterAction ( 'pure' ) } children = { 'Pures: ' + puresSize } > </ Button >
178
- </ WrapItem >
179
- < WrapItem >
180
- < Button onClick = { ( ) => filterAction ( 'remove' ) } children = { 'Removes: ' + removesSize } > </ Button >
181
- </ WrapItem >
182
- < WrapItem >
183
- < Button onClick = { ( ) => filterAction ( 'rename' ) } children = { 'Renaming: ' + renamingsSize } > </ Button >
184
- </ WrapItem >
185
- < WrapItem >
186
- < Button onClick = { ( ) => filterAction ( 'required' ) } children = { 'Requireds: ' + requiredsSize } > </ Button >
187
- </ WrapItem >
188
- < WrapItem >
189
- < Button onClick = { ( ) => filterAction ( 'todo' ) } children = { 'Todos: ' + todoSize } > </ Button >
190
- </ WrapItem >
191
- </ Wrap >
192
164
</ VStack >
193
165
) ;
194
166
} ;
@@ -272,6 +244,7 @@ let createLineChart = function (
272
244
labels : number [ ] ,
273
245
getValue : Function ,
274
246
title : string ,
247
+ xAxisLabel : string ,
275
248
) : ReactElement {
276
249
const options = {
277
250
responsive : true ,
@@ -284,6 +257,14 @@ let createLineChart = function (
284
257
text : title ,
285
258
} ,
286
259
} ,
260
+ scales : {
261
+ x : {
262
+ title : {
263
+ display : true ,
264
+ text : xAxisLabel ,
265
+ } ,
266
+ } ,
267
+ } ,
287
268
} ;
288
269
289
270
const dataValues = new Map ( ) ;
0 commit comments