We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 85df38b commit 100b342Copy full SHA for 100b342
src/components/DistributionReport.tsx
@@ -21,7 +21,12 @@ function countCategory2ForCategory1(
21
const count = data.filter(
22
row => row[column1] === category1 && row[column2] === category2
23
).length;
24
- return count;
+
25
+ const total = data.filter(row => row[column1] === category1).length;
26
+ if (total === 0) {
27
+ return 0;
28
+ }
29
+ return (count / total) * 100;
30
}
31
32
interface DistributionReport {
@@ -328,7 +333,7 @@ export const DistributionReport = (
328
333
>
329
334
<GroupBarChart
330
335
yAxisLabel={t(
331
- 'distribution.frequency'
336
+ 'distribution.percentage'
332
337
)}
338
title={`${column} = ${item}`}
339
data={categories2.map(
0 commit comments